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:: ics
258 RELATED-TO;RELTYPE=SIBLING:19960401-080045-4000F192713@
259 example.com
261 Usage inside of RELATED-TO according to :rfc:`9253`:
263 .. code-block:: ics
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: ``BINARY``, ``BOOLEAN``, ``CAL_ADDRESS``, ``DATE``, ``DATE_TIME``,
374 ``DURATION``, ``FLOAT``, ``INTEGER``, ``PERIOD``, ``RECUR``, ``TEXT``, ``TIME``,
375 ``URI``, ``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 BINARY = "BINARY"
395 BOOLEAN = "BOOLEAN"
396 CAL_ADDRESS = "CAL-ADDRESS"
397 DATE = "DATE"
398 DATE_TIME = "DATE-TIME"
399 DURATION = "DURATION"
400 FLOAT = "FLOAT"
401 INTEGER = "INTEGER"
402 PERIOD = "PERIOD"
403 RECUR = "RECUR"
404 TEXT = "TEXT"
405 TIME = "TIME"
406 URI = "URI"
407 UTC_OFFSET = "UTC-OFFSET"
410class BUSYTYPE(StrEnum):
411 """Enum for BUSYTYPE from :rfc:`7953`.
413 Values:
414 ``BUSY``,
415 ``BUSY_UNAVAILABLE``,
416 ``BUSY_TENTATIVE``
418 Description:
419 This property is used to specify the default busy time
420 type. The values correspond to those used by the :class:`FBTYPE`
421 parameter used on a "FREEBUSY" property, with the exception that
422 the "FREE" value is not used in this property. If not specified
423 on a component that allows this property, the default is "BUSY-
424 UNAVAILABLE".
426 Example:
427 The following is an example of this property:
429 .. code-block:: ics
431 BUSYTYPE:BUSY
432 """
434 BUSY = "BUSY"
435 BUSY_UNAVAILABLE = "BUSY-UNAVAILABLE"
436 BUSY_TENTATIVE = "BUSY-TENTATIVE"
439class CLASS(StrEnum):
440 """Enum for CLASS from :rfc:`5545`.
442 Values:
443 ``PUBLIC``,
444 ``PRIVATE``,
445 ``CONFIDENTIAL``
447 Description:
448 An access classification is only one component of the
449 general security system within a calendar application. It
450 provides a method of capturing the scope of the access the
451 calendar owner intends for information within an individual
452 calendar entry. The access classification of an individual
453 iCalendar component is useful when measured along with the other
454 security components of a calendar system (e.g., calendar user
455 authentication, authorization, access rights, access role, etc.).
456 Hence, the semantics of the individual access classifications
457 cannot be completely defined by this memo alone. Additionally,
458 due to the "blind" nature of most exchange processes using this
459 memo, these access classifications cannot serve as an enforcement
460 statement for a system receiving an iCalendar object. Rather,
461 they provide a method for capturing the intention of the calendar
462 owner for the access to the calendar component. If not specified
463 in a component that allows this property, the default value is
464 PUBLIC. Applications MUST treat x-name and iana-token values they
465 don't recognize the same way as they would the PRIVATE value.
466 """
468 PUBLIC = "PUBLIC"
469 PRIVATE = "PRIVATE"
470 CONFIDENTIAL = "CONFIDENTIAL"
473class TRANSP(StrEnum):
474 """Enum for TRANSP from :rfc:`5545`.
476 Values:
477 ``OPAQUE``,
478 ``TRANSPARENT``
480 Description:
481 Time Transparency is the characteristic of an event
482 that determines whether it appears to consume time on a calendar.
483 Events that consume actual time for the individual or resource
484 associated with the calendar SHOULD be recorded as OPAQUE,
485 allowing them to be detected by free/busy time searches. Other
486 events, which do not take up the individual's (or resource's) time
487 SHOULD be recorded as TRANSPARENT, making them invisible to free/
488 busy time searches.
489 """
491 OPAQUE = "OPAQUE"
492 TRANSPARENT = "TRANSPARENT"
495__all__ = [
496 "BUSYTYPE",
497 "CLASS",
498 "CUTYPE",
499 "FBTYPE",
500 "PARTSTAT",
501 "RANGE",
502 "RELATED",
503 "RELTYPE",
504 "ROLE",
505 "STATUS",
506 "TRANSP",
507 "VALUE",
508]