Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/icalendar/enums.py: 98%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""Enumerations for different types in the RFCs."""
3from enum import Enum as _Enum
6class Enum(_Enum):
7 """Enum class that can be pickled."""
9 def __reduce_ex__(self, _p):
10 """For pickling."""
11 return self.__class__, (self._name_,)
14class StrEnum(str, Enum):
15 """Enum for strings."""
17 def __str__(self) -> str:
18 """Convert to a string.
20 This is needed when we set the value directly in components.
21 """
22 return self.value
25class PARTSTAT(StrEnum):
26 """Enum for PARTSTAT from :rfc:`5545`.
28 Values:
29 ``NEEDS_ACTION``,
30 ``ACCEPTED``,
31 ``DECLINED``,
32 ``TENTATIVE``,
33 ``DELEGATED``,
34 ``COMPLETED``,
35 ``IN_PROCESS``
37 Purpose:
38 To specify the participation status for the calendar user
39 specified by the property.
41 Description:
42 This parameter can be specified on properties with a
43 CAL-ADDRESS value type. The parameter identifies the
44 participation status for the calendar user specified by the
45 property value. The parameter values differ depending on whether
46 they are associated with a group-scheduled "VEVENT", "VTODO", or
47 "VJOURNAL". The values MUST match one of the values allowed for
48 the given calendar component. If not specified on a property that
49 allows this parameter, the default value is NEEDS-ACTION.
50 Applications MUST treat x-name and iana-token values they don't
51 recognize the same way as they would the NEEDS-ACTION value.
52 """
54 NEEDS_ACTION = "NEEDS-ACTION"
55 ACCEPTED = "ACCEPTED"
56 DECLINED = "DECLINED"
57 TENTATIVE = "TENTATIVE"
58 DELEGATED = "DELEGATED"
59 COMPLETED = "COMPLETED"
60 IN_PROCESS = "IN-PROCESS"
63class STATUS(StrEnum):
64 """Enum for STATUS from :rfc:`5545`.
66 Values for :class:`icalendar.cal.event.Event`:
67 ``CONFIRMED``,
68 ``TENTATIVE``,
69 ``CANCELLED``
71 Values for :class:`icalendar.cal.todo.Todo`:
72 ``NEEDS_ACTION``,
73 ``COMPLETED``,
74 ``IN_PROCESS``,
75 ``CANCELLED``
77 Values for :class:`icalendar.cal.journal.Journal`:
78 ``DRAFT``,
79 ``FINAL``,
80 ``CANCELLED``
82 Description:
83 In a group-scheduled calendar component, the property
84 is used by the "Organizer" to provide a confirmation of the event
85 to the "Attendees". For example in a "VEVENT" calendar component,
86 the "Organizer" can indicate that a meeting is tentative,
87 confirmed, or cancelled. In a "VTODO" calendar component, the
88 "Organizer" can indicate that an action item needs action, is
89 completed, is in process or being worked on, or has been
90 cancelled. In a "VJOURNAL" calendar component, the "Organizer"
91 can indicate that a journal entry is draft, final, or has been
92 cancelled or removed.
93 """
95 # Event
96 TENTATIVE = "TENTATIVE"
97 CONFIRMED = "CONFIRMED"
98 CANCELLED = "CANCELLED"
100 # VTodo
101 NEEDS_ACTION = "NEEDS-ACTION"
102 COMPLETED = "COMPLETED"
103 IN_PROCESS = "IN-PROCESS"
104 # CANCELLED
106 # Journal
107 DRAFT = "DRAFT"
108 FINAL = "FINAL"
109 # CANCELLED
112class FBTYPE(StrEnum):
113 """Enum for FBTYPE from :rfc:`5545`.
115 Values:
116 ``FREE``,
117 ``BUSY``,
118 ``BUSY_UNAVAILABLE``,
119 ``BUSY_TENTATIVE``
121 See also :class:`BUSYTYPE`.
123 Purpose:
124 To specify the free or busy time type.
126 Description:
127 This parameter specifies the free or busy time type.
128 The value FREE indicates that the time interval is free for
129 scheduling. The value BUSY indicates that the time interval is
130 busy because one or more events have been scheduled for that
131 interval. The value BUSY-UNAVAILABLE indicates that the time
132 interval is busy and that the interval can not be scheduled. The
133 value BUSY-TENTATIVE indicates that the time interval is busy
134 because one or more events have been tentatively scheduled for
135 that interval. If not specified on a property that allows this
136 parameter, the default is BUSY. Applications MUST treat x-name
137 and iana-token values they don't recognize the same way as they
138 would the BUSY value.
139 """
141 FREE = "FREE"
142 BUSY = "BUSY"
143 BUSY_UNAVAILABLE = "BUSY-UNAVAILABLE"
144 BUSY_TENTATIVE = "BUSY-TENTATIVE"
147class CUTYPE(StrEnum):
148 """Enum for CTYPE from :rfc:`5545`.
150 Values:
151 ``INDIVIDUAL``,
152 ``GROUP``,
153 ``RESOURCE``,
154 ``ROOM``,
155 ``UNKNOWN``
157 Purpose:
158 To identify the type of calendar user specified by the property.
160 Description:
161 This parameter can be specified on properties with a
162 CAL-ADDRESS value type. The parameter identifies the type of
163 calendar user specified by the property. If not specified on a
164 property that allows this parameter, the default is INDIVIDUAL.
165 Applications MUST treat x-name and iana-token values they don't
166 recognize the same way as they would the UNKNOWN value.
167 """
169 INDIVIDUAL = "INDIVIDUAL"
170 GROUP = "GROUP"
171 RESOURCE = "RESOURCE"
172 ROOM = "ROOM"
173 UNKNOWN = "UNKNOWN"
176class RELTYPE(StrEnum):
177 """Enum for RELTYPE from :rfc:`5545`.
179 Values:
180 ``PARENT``,
181 ``CHILD``,
182 ``SIBLING``,
183 ``FINISHTOSTART``,
184 ``FINISHTOFINISH``,
185 ``STARTTOFINISH``,
186 ``STARTTOSTART``,
187 ``FIRST``,
188 ``NEXT``,
189 ``DEPENDS-ON``,
190 ``REFID``,
191 ``CONCEPT``
193 Purpose:
194 To specify the type of hierarchical relationship associated
195 with the calendar component specified by the property.
197 Description:
198 This parameter can be specified on a property that
199 references another related calendar. The parameter specifies the
200 hierarchical relationship type of the calendar component
201 referenced by the property. The parameter value can be PARENT, to
202 indicate that the referenced calendar component is a superior of
203 calendar component; CHILD to indicate that the referenced calendar
204 component is a subordinate of the calendar component; or SIBLING
205 to indicate that the referenced calendar component is a peer of
206 the calendar component. If this parameter is not specified on an
207 allowable property, the default relationship type is PARENT.
208 Applications MUST treat x-name and iana-token values they don't
209 recognize the same way as they would the PARENT value.
211 New Temporal RELTYPE Parameter Values (:rfc:`9253`):
212 RELTYPE=FINISHTOSTART
213 Task-B cannot start until Task-A finishes.
214 For example, when painting is complete, carpet laying can begin.
215 RELTYPE=FINISHTOFINISH
216 Task-B can only be completed after Task-A is finished.
217 The related tasks may run in parallel before completion.
218 RELTYPE=STARTTOFINISH
219 The start of Task-A (which occurs after Task-B) controls the
220 finish of Task-B. For example, ticket sales (Task-B) end
221 after the game starts (Task-A).
222 RELTYPE=STARTTOSTART
223 The start of Task-A triggers the start of Task-B,
224 that is, Task-B can start anytime after Task-A starts.
226 Additional New RELTYPE Parameter Values (:rfc:`9253`):
227 RELTYPE=FIRST
228 This indicates that the referenced calendar component is
229 the first in a series the referencing calendar component
230 is part of.
231 RELTYPE=NEXT
232 This indicates that the referenced calendar component
233 is the next in a series the referencing calendar component
234 is part of.
235 RELTYPE=DEPENDS-ON
236 This indicates that the current calendar component
237 depends on the referenced calendar component in some manner.
238 For example, a task may be blocked waiting on the other,
239 referenced, task.
240 RELTYPE=REFID
241 This establishes a reference from the current component to
242 components with a REFID property that matches the value given
243 in the associated RELATED-TO property.
244 RELTYPE=CONCEPT
245 This establishes a reference from the current component to
246 components with a CONCEPT property that matches the value
247 given in the associated RELATED-TO property.
249 Note that the relationship types of PARENT, CHILD, and SIBLING
250 establish a hierarchical relationship. The new types of FIRST
251 and NEXT are an ordering relationship.
253 Examples:
254 The following is an example from :rfc:`5545`:
256 .. code-block:: text
258 RELATED-TO;RELTYPE=SIBLING:19960401-080045-4000F192713@
259 example.com
261 Usage inside of RELATED-TO according to :rfc:`9253`:
263 .. code-block:: text
265 RELATED-TO;VALUE=URI;RELTYPE=STARTTOFINISH:
266 https://example.com/caldav/user/jb/cal/
267 19960401-080045-4000F192713.ics
268 """
270 PARENT = "PARENT"
271 CHILD = "CHILD"
272 SIBLING = "SIBLING"
273 FINISHTOSTART = "FINISHTOSTART"
274 FINISHTOFINISH = "FINISHTOFINISH"
275 STARTTOFINISH = "STARTTOFINISH"
276 STARTTOSTART = "STARTTOSTART"
277 FIRST = "FIRST"
278 NEXT = "NEXT"
279 DEPENDS_ON = "DEPENDS-ON"
280 REFID = "REFID"
281 CONCEPT = "CONCEPT"
284class RANGE(StrEnum):
285 """Enum for RANGE from :rfc:`5545`.
287 Values:
288 ``THISANDFUTURE``,
289 ``THISANDPRIOR`` (deprecated)
291 Purpose:
292 To specify the effective range of recurrence instances from
293 the instance specified by the recurrence identifier specified by
294 the property.
296 Description:
297 This parameter can be specified on a property that
298 specifies a recurrence identifier. The parameter specifies the
299 effective range of recurrence instances that is specified by the
300 property. The effective range is from the recurrence identifier
301 specified by the property. If this parameter is not specified on
302 an allowed property, then the default range is the single instance
303 specified by the recurrence identifier value of the property. The
304 parameter value can only be "THISANDFUTURE" to indicate a range
305 defined by the recurrence identifier and all subsequent instances.
306 The value "THISANDPRIOR" is deprecated by this revision of
307 iCalendar and MUST NOT be generated by applications.
308 """
310 THISANDFUTURE = "THISANDFUTURE"
311 THISANDPRIOR = "THISANDPRIOR" # deprecated
314class RELATED(StrEnum):
315 """Enum for RELATED from :rfc:`5545`.
317 Values:
318 ``START``,
319 ``END``
321 Purpose:
322 To specify the relationship of the alarm trigger with
323 respect to the start or end of the calendar component.
325 Description:
326 This parameter can be specified on properties that
327 specify an alarm trigger with a "DURATION" value type. The
328 parameter specifies whether the alarm will trigger relative to the
329 start or end of the calendar component. The parameter value START
330 will set the alarm to trigger off the start of the calendar
331 component; the parameter value END will set the alarm to trigger
332 off the end of the calendar component. If the parameter is not
333 specified on an allowable property, then the default is START.
334 """
336 START = "START"
337 END = "END"
340class ROLE(StrEnum):
341 """Enum for ROLE from :rfc:`5545`.
343 Values:
344 ``CHAIR``,
345 ``REQ_PARTICIPANT``,
346 ``OPT_PARTICIPANT``,
347 ``NON_PARTICIPANT``
349 Purpose:
350 To specify the participation role for the calendar user
351 specified by the property.
353 Description:
354 This parameter can be specified on properties with a
355 CAL-ADDRESS value type. The parameter specifies the participation
356 role for the calendar user specified by the property in the group
357 schedule calendar component. If not specified on a property that
358 allows this parameter, the default value is REQ-PARTICIPANT.
359 Applications MUST treat x-name and iana-token values they don't
360 recognize the same way as they would the REQ-PARTICIPANT value.
362 """
364 CHAIR = "CHAIR"
365 REQ_PARTICIPANT = "REQ-PARTICIPANT"
366 OPT_PARTICIPANT = "OPT-PARTICIPANT"
367 NON_PARTICIPANT = "NON-PARTICIPANT"
370class VALUE(StrEnum):
371 """VALUE datatypes as defined in :rfc:`5545`.
373 Attributes: ``BOOLEAN``, ``CAL_ADDRESS``, ``DATE``, ``DATE_TIME``, ``DURATION``,
374 ``FLOAT``, ``INTEGER``, ``PERIOD``, ``RECUR``, ``TEXT``, ``TIME``, ``URI``,
375 ``UTC_OFFSET``
377 Description:
378 This parameter specifies the value type and format of
379 the property value. The property values MUST be of a single value
380 type. For example, a "RDATE" property cannot have a combination
381 of DATE-TIME and TIME value types.
383 If the property's value is the default value type, then this
384 parameter need not be specified. However, if the property's
385 default value type is overridden by some other allowable value
386 type, then this parameter MUST be specified.
388 Applications MUST preserve the value data for x-name and iana-
389 token values that they don't recognize without attempting to
390 interpret or parse the value data.
392 """
394 BOOLEAN = "BOOLEAN"
395 CAL_ADDRESS = "CAL-ADDRESS"
396 DATE = "DATE"
397 DATE_TIME = "DATE-TIME"
398 DURATION = "DURATION"
399 FLOAT = "FLOAT"
400 INTEGER = "INTEGER"
401 PERIOD = "PERIOD"
402 RECUR = "RECUR"
403 TEXT = "TEXT"
404 TIME = "TIME"
405 URI = "URI"
406 UTC_OFFSET = "UTC-OFFSET"
409class BUSYTYPE(StrEnum):
410 """Enum for BUSYTYPE from :rfc:`7953`.
412 Values:
413 ``BUSY``,
414 ``BUSY_UNAVAILABLE``,
415 ``BUSY_TENTATIVE``
417 Description:
418 This property is used to specify the default busy time
419 type. The values correspond to those used by the :class:`FBTYPE`
420 parameter used on a "FREEBUSY" property, with the exception that
421 the "FREE" value is not used in this property. If not specified
422 on a component that allows this property, the default is "BUSY-
423 UNAVAILABLE".
425 Example:
426 The following is an example of this property:
428 .. code-block:: text
430 BUSYTYPE:BUSY
431 """
433 BUSY = "BUSY"
434 BUSY_UNAVAILABLE = "BUSY-UNAVAILABLE"
435 BUSY_TENTATIVE = "BUSY-TENTATIVE"
438class CLASS(StrEnum):
439 """Enum for CLASS from :rfc:`5545`.
441 Values:
442 ``PUBLIC``,
443 ``PRIVATE``,
444 ``CONFIDENTIAL``
446 Description:
447 An access classification is only one component of the
448 general security system within a calendar application. It
449 provides a method of capturing the scope of the access the
450 calendar owner intends for information within an individual
451 calendar entry. The access classification of an individual
452 iCalendar component is useful when measured along with the other
453 security components of a calendar system (e.g., calendar user
454 authentication, authorization, access rights, access role, etc.).
455 Hence, the semantics of the individual access classifications
456 cannot be completely defined by this memo alone. Additionally,
457 due to the "blind" nature of most exchange processes using this
458 memo, these access classifications cannot serve as an enforcement
459 statement for a system receiving an iCalendar object. Rather,
460 they provide a method for capturing the intention of the calendar
461 owner for the access to the calendar component. If not specified
462 in a component that allows this property, the default value is
463 PUBLIC. Applications MUST treat x-name and iana-token values they
464 don't recognize the same way as they would the PRIVATE value.
465 """
467 PUBLIC = "PUBLIC"
468 PRIVATE = "PRIVATE"
469 CONFIDENTIAL = "CONFIDENTIAL"
472class TRANSP(StrEnum):
473 """Enum for TRANSP from :rfc:`5545`.
475 Values:
476 ``OPAQUE``,
477 ``TRANSPARENT``
479 Description:
480 Time Transparency is the characteristic of an event
481 that determines whether it appears to consume time on a calendar.
482 Events that consume actual time for the individual or resource
483 associated with the calendar SHOULD be recorded as OPAQUE,
484 allowing them to be detected by free/busy time searches. Other
485 events, which do not take up the individual's (or resource's) time
486 SHOULD be recorded as TRANSPARENT, making them invisible to free/
487 busy time searches.
488 """
490 OPAQUE = "OPAQUE"
491 TRANSPARENT = "TRANSPARENT"
494__all__ = [
495 "BUSYTYPE",
496 "CLASS",
497 "CUTYPE",
498 "FBTYPE",
499 "PARTSTAT",
500 "RANGE",
501 "RELATED",
502 "RELTYPE",
503 "ROLE",
504 "STATUS",
505 "TRANSP",
506 "VALUE",
507]