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

Method __init__

O365/calendar.py:103–149  ·  view source on GitHub ↗

A representation of an event recurrence properties :param Event event: event object :param dict recurrence: recurrence information

(self, event, recurrence=None)

Source from the content-addressed store, hash-verified

101# noinspection PyAttributeOutsideInit
102class EventRecurrence(ApiComponent):
103 def __init__(self, event, recurrence=None):
104 """ A representation of an event recurrence properties
105
106 :param Event event: event object
107 :param dict recurrence: recurrence information
108 """
109 super().__init__(protocol=event.protocol,
110 main_resource=event.main_resource)
111
112 self._event = event
113 recurrence = recurrence or {}
114 # recurrence pattern
115 recurrence_pattern = recurrence.get(self._cc('pattern'), {})
116
117 self.__interval = recurrence_pattern.get(self._cc('interval'), None)
118 self.__days_of_week = recurrence_pattern.get(self._cc('daysOfWeek'),
119 set())
120 self.__first_day_of_week = recurrence_pattern.get(
121 self._cc('firstDayOfWeek'), None)
122 if 'type' in recurrence_pattern.keys():
123 if 'weekly' not in recurrence_pattern['type'].lower():
124 self.__first_day_of_week = None
125
126 self.__day_of_month = recurrence_pattern.get(self._cc('dayOfMonth'),
127 None)
128 self.__month = recurrence_pattern.get(self._cc('month'), None)
129 self.__index = recurrence_pattern.get(self._cc('index'), 'first')
130
131 # recurrence range
132 recurrence_range = recurrence.get(self._cc('range'), {})
133
134 self.__occurrences = recurrence_range.get(
135 self._cc('numberOfOccurrences'), None)
136 self.__start_date = recurrence_range.get(self._cc('startDate'), None)
137 self.__end_date = recurrence_range.get(self._cc('endDate'), None)
138 self.__recurrence_time_zone = recurrence_range.get(
139 self._cc('recurrenceTimeZone'),
140 get_windows_tz(self.protocol.timezone))
141 # time and time zones are not considered in recurrence ranges...
142 # I don't know why 'recurrenceTimeZone' is present here
143 # Sending a startDate datetime to the server results in an Error:
144 # Cannot convert the literal 'datetime' to the expected type 'Edm.Date'
145 if recurrence_range:
146 self.__start_date = parse(
147 self.__start_date).date() if self.__start_date else None
148 self.__end_date = parse(
149 self.__end_date).date() if self.__end_date else None
150
151 def __repr__(self):
152 if not self.__interval:

Callers

nothing calls this directly

Calls 4

get_windows_tzFunction · 0.85
_ccMethod · 0.80
__init__Method · 0.45
getMethod · 0.45

Tested by

no test coverage detected