MCPcopy Index your code
hub / github.com/O365/python-o365 / __init__

Method __init__

O365/calendar.py:825–930  ·  view source on GitHub ↗

Create a calendar event representation :param parent: parent for this operation :type parent: Calendar or Schedule or ApiComponent :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified

(self, *, parent=None, con=None, **kwargs)

Source from the content-addressed store, hash-verified

823 }
824
825 def __init__(self, *, parent=None, con=None, **kwargs):
826 """ Create a calendar event representation
827
828 :param parent: parent for this operation
829 :type parent: Calendar or Schedule or ApiComponent
830 :param Connection con: connection to use if no parent specified
831 :param Protocol protocol: protocol to use if no parent specified
832 (kwargs)
833 :param str main_resource: use this resource instead of parent resource
834 (kwargs)
835 :param str calendar_id: id of the calender to add this event in
836 (kwargs)
837 :param bool download_attachments: whether or not to download attachments
838 (kwargs)
839 :param str subject: subject of the event (kwargs)
840 """
841 if parent and con:
842 raise ValueError('Need a parent or a connection but not both')
843 self.con = parent.con if parent else con
844
845 # Choose the main_resource passed in kwargs over parent main_resource
846 main_resource = kwargs.pop('main_resource', None) or (
847 getattr(parent, 'main_resource', None) if parent else None)
848
849 super().__init__(
850 protocol=parent.protocol if parent else kwargs.get('protocol'),
851 main_resource=main_resource)
852
853 cc = self._cc # alias
854 # internal to know which properties need to be updated on the server
855 self._track_changes = TrackerSet(casing=cc)
856 self.calendar_id = kwargs.get('calendar_id', None)
857 download_attachments = kwargs.get('download_attachments')
858 cloud_data = kwargs.get(self._cloud_data_key, {})
859
860 self.object_id = cloud_data.get(cc('id'), None)
861 self.__subject = cloud_data.get(cc('subject'),
862 kwargs.get('subject', '') or '')
863 body = cloud_data.get(cc('body'), {})
864 self.__body = body.get(cc('content'), '')
865 self.body_type = body.get(cc('contentType'),
866 'HTML') # default to HTML for new messages
867
868 self.__attendees = Attendees(event=self, attendees={
869 self._cloud_data_key: cloud_data.get(cc('attendees'), [])})
870 self.__categories = cloud_data.get(cc('categories'), [])
871
872 self.__created = cloud_data.get(cc('createdDateTime'), None)
873 self.__modified = cloud_data.get(cc('lastModifiedDateTime'), None)
874
875 local_tz = self.protocol.timezone
876 self.__created = parse(self.__created).astimezone(
877 local_tz) if self.__created else None
878 self.__modified = parse(self.__modified).astimezone(
879 local_tz) if self.__modified else None
880
881 self.__is_all_day = cloud_data.get(cc('isAllDay'), False)
882

Callers 5

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 10

TrackerSetClass · 0.85
AttendeesClass · 0.85
EventAttachmentsClass · 0.85
EventRecurrenceClass · 0.85
ResponseStatusClass · 0.85
download_attachmentsMethod · 0.80
from_valueMethod · 0.80
_recipient_from_cloudMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected