Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/icalendar/enums.py: 97%

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

77 statements  

1"""Enumerations for different types in the RFCs.""" 

2 

3from enum import Enum as _Enum 

4 

5 

6class Enum(_Enum): 

7 """Enum class that can be pickled.""" 

8 

9 def __reduce_ex__(self, _p): 

10 """For pickling.""" 

11 return self.__class__, (self._name_,) 

12 

13 

14class StrEnum(str, Enum): 

15 """Enum for strings.""" 

16 

17 def __str__(self) -> str: 

18 """Convert to a string. 

19 

20 This is needed when we set the value directly in components. 

21 """ 

22 return self.value 

23 

24 

25class PARTSTAT(StrEnum): 

26 """Enum for PARTSTAT from :rfc:`5545`. 

27 

28 Values: 

29 ``NEEDS_ACTION``, 

30 ``ACCEPTED``, 

31 ``DECLINED``, 

32 ``TENTATIVE``, 

33 ``DELEGATED``, 

34 ``COMPLETED``, 

35 ``IN_PROCESS`` 

36 

37 Purpose: 

38 To specify the participation status for the calendar user 

39 specified by the property. 

40 

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 """ 

53 

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" 

61 

62 

63class STATUS(StrEnum): 

64 """Enum for STATUS from :rfc:`5545`. 

65 

66 Values for :class:`icalendar.cal.event.Event`: 

67 ``CONFIRMED``, 

68 ``TENTATIVE``, 

69 ``CANCELLED`` 

70 

71 Values for :class:`icalendar.cal.todo.Todo`: 

72 ``NEEDS_ACTION``, 

73 ``COMPLETED``, 

74 ``IN_PROCESS``, 

75 ``CANCELLED`` 

76 

77 Values for :class:`icalendar.cal.journal.Journal`: 

78 ``DRAFT``, 

79 ``FINAL``, 

80 ``CANCELLED`` 

81 

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 """ 

94 

95 # Event 

96 TENTATIVE = "TENTATIVE" 

97 CONFIRMED = "CONFIRMED" 

98 CANCELLED = "CANCELLED" 

99 

100 # VTodo 

101 NEEDS_ACTION = "NEEDS-ACTION" 

102 COMPLETED = "COMPLETED" 

103 IN_PROCESS = "IN-PROCESS" 

104 # CANCELLED 

105 

106 # Journal 

107 DRAFT = "DRAFT" 

108 FINAL = "FINAL" 

109 # CANCELLED 

110 

111 

112class FBTYPE(StrEnum): 

113 """Enum for FBTYPE from :rfc:`5545`. 

114 

115 Values: 

116 ``FREE``, 

117 ``BUSY``, 

118 ``BUSY_UNAVAILABLE``, 

119 ``BUSY_TENTATIVE`` 

120 

121 See also :class:`BUSYTYPE`. 

122 

123 Purpose: 

124 To specify the free or busy time type. 

125 

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 """ 

140 

141 FREE = "FREE" 

142 BUSY = "BUSY" 

143 BUSY_UNAVAILABLE = "BUSY-UNAVAILABLE" 

144 BUSY_TENTATIVE = "BUSY-TENTATIVE" 

145 

146 

147class CUTYPE(StrEnum): 

148 """Enum for CTYPE from :rfc:`5545`. 

149 

150 Values: 

151 ``INDIVIDUAL``, 

152 ``GROUP``, 

153 ``RESOURCE``, 

154 ``ROOM``, 

155 ``UNKNOWN`` 

156 

157 Purpose: 

158 To identify the type of calendar user specified by the property. 

159 

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 """ 

168 

169 INDIVIDUAL = "INDIVIDUAL" 

170 GROUP = "GROUP" 

171 RESOURCE = "RESOURCE" 

172 ROOM = "ROOM" 

173 UNKNOWN = "UNKNOWN" 

174 

175 

176class RELTYPE(StrEnum): 

177 """Enum for RELTYPE from :rfc:`5545`. 

178 

179 Values: 

180 ``PARENT``, 

181 ``CHILD``, 

182 ``SIBLING`` 

183 

184 Purpose: 

185 To specify the type of hierarchical relationship associated 

186 with the calendar component specified by the property. 

187 

188 Description: 

189 This parameter can be specified on a property that 

190 references another related calendar. The parameter specifies the 

191 hierarchical relationship type of the calendar component 

192 referenced by the property. The parameter value can be PARENT, to 

193 indicate that the referenced calendar component is a superior of 

194 calendar component; CHILD to indicate that the referenced calendar 

195 component is a subordinate of the calendar component; or SIBLING 

196 to indicate that the referenced calendar component is a peer of 

197 the calendar component. If this parameter is not specified on an 

198 allowable property, the default relationship type is PARENT. 

199 Applications MUST treat x-name and iana-token values they don't 

200 recognize the same way as they would the PARENT value. 

201 

202 """ 

203 

204 PARENT = "PARENT" 

205 CHILD = "CHILD" 

206 SIBLING = "SIBLING" 

207 

208 

209class RANGE(StrEnum): 

210 """Enum for RANGE from :rfc:`5545`. 

211 

212 Values: 

213 ``THISANDFUTURE``, 

214 ``THISANDPRIOR`` (deprecated) 

215 

216 Purpose: 

217 To specify the effective range of recurrence instances from 

218 the instance specified by the recurrence identifier specified by 

219 the property. 

220 

221 Description: 

222 This parameter can be specified on a property that 

223 specifies a recurrence identifier. The parameter specifies the 

224 effective range of recurrence instances that is specified by the 

225 property. The effective range is from the recurrence identifier 

226 specified by the property. If this parameter is not specified on 

227 an allowed property, then the default range is the single instance 

228 specified by the recurrence identifier value of the property. The 

229 parameter value can only be "THISANDFUTURE" to indicate a range 

230 defined by the recurrence identifier and all subsequent instances. 

231 The value "THISANDPRIOR" is deprecated by this revision of 

232 iCalendar and MUST NOT be generated by applications. 

233 """ 

234 

235 THISANDFUTURE = "THISANDFUTURE" 

236 THISANDPRIOR = "THISANDPRIOR" # deprecated 

237 

238 

239class RELATED(StrEnum): 

240 """Enum for RELATED from :rfc:`5545`. 

241 

242 Values: 

243 ``START``, 

244 ``END`` 

245 

246 Purpose: 

247 To specify the relationship of the alarm trigger with 

248 respect to the start or end of the calendar component. 

249 

250 Description: 

251 This parameter can be specified on properties that 

252 specify an alarm trigger with a "DURATION" value type. The 

253 parameter specifies whether the alarm will trigger relative to the 

254 start or end of the calendar component. The parameter value START 

255 will set the alarm to trigger off the start of the calendar 

256 component; the parameter value END will set the alarm to trigger 

257 off the end of the calendar component. If the parameter is not 

258 specified on an allowable property, then the default is START. 

259 """ 

260 

261 START = "START" 

262 END = "END" 

263 

264 

265class ROLE(StrEnum): 

266 """Enum for ROLE from :rfc:`5545`. 

267 

268 Values: 

269 ``CHAIR``, 

270 ``REQ_PARTICIPANT``, 

271 ``OPT_PARTICIPANT``, 

272 ``NON_PARTICIPANT`` 

273 

274 Purpose: 

275 To specify the participation role for the calendar user 

276 specified by the property. 

277 

278 Description: 

279 This parameter can be specified on properties with a 

280 CAL-ADDRESS value type. The parameter specifies the participation 

281 role for the calendar user specified by the property in the group 

282 schedule calendar component. If not specified on a property that 

283 allows this parameter, the default value is REQ-PARTICIPANT. 

284 Applications MUST treat x-name and iana-token values they don't 

285 recognize the same way as they would the REQ-PARTICIPANT value. 

286 

287 """ 

288 

289 CHAIR = "CHAIR" 

290 REQ_PARTICIPANT = "REQ-PARTICIPANT" 

291 OPT_PARTICIPANT = "OPT-PARTICIPANT" 

292 NON_PARTICIPANT = "NON-PARTICIPANT" 

293 

294 

295class VALUE(StrEnum): 

296 """VALUE datatypes as defined in :rfc:`5545`. 

297 

298 Attributes: ``BOOLEAN``, ``CAL_ADDRESS``, ``DATE``, ``DATE_TIME``, ``DURATION``, 

299 ``FLOAT``, ``INTEGER``, ``PERIOD``, ``RECUR``, ``TEXT``, ``TIME``, ``URI``, 

300 ``UTC_OFFSET`` 

301 

302 Description: 

303 This parameter specifies the value type and format of 

304 the property value. The property values MUST be of a single value 

305 type. For example, a "RDATE" property cannot have a combination 

306 of DATE-TIME and TIME value types. 

307 

308 If the property's value is the default value type, then this 

309 parameter need not be specified. However, if the property's 

310 default value type is overridden by some other allowable value 

311 type, then this parameter MUST be specified. 

312 

313 Applications MUST preserve the value data for x-name and iana- 

314 token values that they don't recognize without attempting to 

315 interpret or parse the value data. 

316 

317 """ 

318 

319 BOOLEAN = "BOOLEAN" 

320 CAL_ADDRESS = "CAL-ADDRESS" 

321 DATE = "DATE" 

322 DATE_TIME = "DATE-TIME" 

323 DURATION = "DURATION" 

324 FLOAT = "FLOAT" 

325 INTEGER = "INTEGER" 

326 PERIOD = "PERIOD" 

327 RECUR = "RECUR" 

328 TEXT = "TEXT" 

329 TIME = "TIME" 

330 URI = "URI" 

331 UTC_OFFSET = "UTC-OFFSET" 

332 

333 

334class BUSYTYPE(StrEnum): 

335 """Enum for BUSYTYPE from :rfc:`7953`. 

336 

337 Values: 

338 ``BUSY``, 

339 ``BUSY_UNAVAILABLE``, 

340 ``BUSY_TENTATIVE`` 

341 

342 Description: 

343 This property is used to specify the default busy time 

344 type. The values correspond to those used by the :class:`FBTYPE` 

345 parameter used on a "FREEBUSY" property, with the exception that 

346 the "FREE" value is not used in this property. If not specified 

347 on a component that allows this property, the default is "BUSY- 

348 UNAVAILABLE". 

349 

350 Example: 

351 The following is an example of this property: 

352 

353 .. code-block:: text 

354 

355 BUSYTYPE:BUSY 

356 """ 

357 

358 BUSY = "BUSY" 

359 BUSY_UNAVAILABLE = "BUSY-UNAVAILABLE" 

360 BUSY_TENTATIVE = "BUSY-TENTATIVE" 

361 

362 

363class CLASS(StrEnum): 

364 """Enum for CLASS from :rfc:`5545`. 

365 

366 Values: 

367 ``PUBLIC``, 

368 ``PRIVATE``, 

369 ``CONFIDENTIAL`` 

370 

371 Description: 

372 An access classification is only one component of the 

373 general security system within a calendar application. It 

374 provides a method of capturing the scope of the access the 

375 calendar owner intends for information within an individual 

376 calendar entry. The access classification of an individual 

377 iCalendar component is useful when measured along with the other 

378 security components of a calendar system (e.g., calendar user 

379 authentication, authorization, access rights, access role, etc.). 

380 Hence, the semantics of the individual access classifications 

381 cannot be completely defined by this memo alone. Additionally, 

382 due to the "blind" nature of most exchange processes using this 

383 memo, these access classifications cannot serve as an enforcement 

384 statement for a system receiving an iCalendar object. Rather, 

385 they provide a method for capturing the intention of the calendar 

386 owner for the access to the calendar component. If not specified 

387 in a component that allows this property, the default value is 

388 PUBLIC. Applications MUST treat x-name and iana-token values they 

389 don't recognize the same way as they would the PRIVATE value. 

390 """ 

391 

392 PUBLIC = "PUBLIC" 

393 PRIVATE = "PRIVATE" 

394 CONFIDENTIAL = "CONFIDENTIAL" 

395 

396 

397class TRANSP(StrEnum): 

398 """Enum for TRANSP from :rfc:`5545`. 

399 

400 Values: 

401 ``OPAQUE``, 

402 ``TRANSPARENT`` 

403 

404 Description: 

405 Time Transparency is the characteristic of an event 

406 that determines whether it appears to consume time on a calendar. 

407 Events that consume actual time for the individual or resource 

408 associated with the calendar SHOULD be recorded as OPAQUE, 

409 allowing them to be detected by free/busy time searches. Other 

410 events, which do not take up the individual's (or resource's) time 

411 SHOULD be recorded as TRANSPARENT, making them invisible to free/ 

412 busy time searches. 

413 """ 

414 

415 OPAQUE = "OPAQUE" 

416 TRANSPARENT = "TRANSPARENT" 

417 

418 

419__all__ = [ 

420 "BUSYTYPE", 

421 "CLASS", 

422 "CUTYPE", 

423 "FBTYPE", 

424 "PARTSTAT", 

425 "RANGE", 

426 "RELATED", 

427 "RELTYPE", 

428 "ROLE", 

429 "STATUS", 

430 "TRANSP", 

431 "VALUE", 

432]