Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/icalendar/cal/component_factory.py: 100%

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

27 statements  

1"""A factory to create components.""" 

2 

3from __future__ import annotations 

4 

5from icalendar.caselessdict import CaselessDict 

6 

7 

8class ComponentFactory(CaselessDict): 

9 """All components defined in :rfc:`5545` are registered in this factory class. 

10 To get a component you can use it like this. 

11 """ 

12 

13 def __init__(self, *args, **kwargs): 

14 """Set keys to upper for initial dict.""" 

15 super().__init__(*args, **kwargs) 

16 from icalendar.cal.alarm import Alarm 

17 from icalendar.cal.availability import Availability 

18 from icalendar.cal.available import Available 

19 from icalendar.cal.calendar import Calendar 

20 from icalendar.cal.event import Event 

21 from icalendar.cal.free_busy import FreeBusy 

22 from icalendar.cal.journal import Journal 

23 from icalendar.cal.timezone import Timezone, TimezoneDaylight, TimezoneStandard 

24 from icalendar.cal.todo import Todo 

25 

26 self["VEVENT"] = Event 

27 self["VTODO"] = Todo 

28 self["VJOURNAL"] = Journal 

29 self["VFREEBUSY"] = FreeBusy 

30 self["VTIMEZONE"] = Timezone 

31 self["STANDARD"] = TimezoneStandard 

32 self["DAYLIGHT"] = TimezoneDaylight 

33 self["VALARM"] = Alarm 

34 self["VCALENDAR"] = Calendar 

35 self["AVAILABLE"] = Available 

36 self["VAVAILABILITY"] = Availability 

37 

38 

39__all__ = ["ComponentFactory"]