
    #ht                         S SK r S SKrS SKJrJrJrJrJr  S SKJ	r	  SSK
Jr  SSKJr  S SKJrJr  SSKJr  SS	KJr  S S
KJr  S SKJr   " S S\5      rg)    N)DictIterableOptionalSetUnion)	text_type   )	Component)Event)	Containercalendar_string_to_containers)Timeline)Todo)CalendarParser)CalendarSerializerc            	          \ rS rSrSr " S S5      r    SS\\\4   S\	\
   S\	\   S	\4S
 jjr\S 5       rS\4S jrS\	\   4S jrS\S\4S jrS\S\4S jr\S\\   4S j5       r\R0                  S\\   SS4S j5       rS rSrg)Calendar   z
Represents an unique rfc5545 iCalendar.

Attributes:

    events: a set of Event contained in the Calendar
    todos: a set of Todo contained in the Calendar
    timeline: a Timeline instance linked to this Calendar

c                        \ rS rSrSr\r\rSr	g)Calendar.Meta   	VCALENDAR N)
__name__
__module____qualname____firstlineno__namer   parserr   
serializer__static_attributes__r       M/Users/user/Downloads/htwk/venv/lib/python3.13/site-packages/ics/icalendar.pyMetar      s    '
r"   r$   Nimportseventstodoscreatorc                    0 U l         [        5       U l        [        5       U l        [	        SS9U l        SU l        SU l        [        U 5      U l	        Uba  [        U[        5      (       a  U R                  U5        g[        U5      n[        U5      S:w  a  [        S5      eU R                  US   5        gUb$  U R                  R                  [        U5      5        Ub$  U R                  R                  [        U5      5        X@l        g)aQ  Instantiates a new Calendar.

Args:
    imports (**str**): data to be imported into the Calendar,
    events (**Set[Event]**): Events to be added to the calendar
    todos (Set[Todo]): Todos to be added to the calendar
    creator (string): uid of the creator program.

If ``imports`` is specified, every other argument will be ignored.
r   )r   Nr	   zbMultiple calendars in one file are not supported by this method. Use ics.Calendar.parse_multiple()r   )
_timezonessetr&   r'   r   extrascalemethodr   timeline
isinstance	_populater   lenNotImplementedErrorupdate_creator)selfr%   r&   r'   r(   
containerss         r#   __init__Calendar.__init__!   s    $ !#"%% #
K0

 '9--w':7C
z?a'-|~ ~ z!}-!""3v;/ 

!!#e*-#Mr"   c                 N    [        U5      nU Vs/ s H  o0" US9PM
     sn$ s  snf )zn"
Parses an input string that may contain mutiple calendars
and retruns a list of :class:`ics.event.Calendar`
)r%   )r   )clsstringr7   cs       r#   parse_multipleCalendar.parse_multipleM   s*     36:
(23
1A
333s   "returnc                     SR                  [        U R                  5      [        U R                  5      S:  a  SOS[        U R                  5      [        U R                  5      S:  a  S5      $ S5      $ )Nz(<Calendar with {} event{} and {} todo{}>r	   s )formatr2   r&   r'   r6   s    r#   __repr__Calendar.__repr__V   s`    9VC$t{{+a/CR

Otzz?Q.C8	8 578	8r"   c              #   v   #    [         R                  " S[        5        U R                  5        Sh  vN   g N7f)zReturns:
iterable: an iterable version of seralize(), line per line
(with line-endings).

Example:
    Can be used to write calendar to a file:

    >>> c = Calendar(); c.events.add(Event(name="My cool event"))
    >>> open('my.ics', 'w').writelines(c)
zUsing Calendar as Iterable is deprecated and will be removed in version 0.8. Use the explicit calendar.serialize_iter() instead.N)warningswarnDeprecationWarningserialize_iterrE   s    r#   __iter__Calendar.__iter__]   s1      	BCU	W &&(((s   /979otherc                    [        U[        5      (       d  [        eS H)  nU R                  U5      UR                  U5      :w  d  M)    g   U R                  UR                  :H  =(       a    U R
                  UR
                  :H  $ )N)r,   r-   r.   r(   F)r0   r   r3   __getattribute__r&   r'   )r6   rO   attrs      r#   __eq__Calendar.__eq__m   sg    %**%%;D$$T*e.D.DT.JJ < u||+L$**2KLr"   c                 .    U R                  U5      (       + $ )N)rS   )r6   rO   s     r#   __ne__Calendar.__ne__v   s    ;;u%%%r"   c                     U R                   $ )zGet or set the calendar's creator.

|  Will return a string.
|  May be set to a string.
|  Creator is the PRODID iCalendar property.
|  It uniquely identifies the program that created the calendar.
)r5   rE   s    r#   r(   Calendar.creatory   s     }}r"   valuec                     [        U[        5      (       d#  [        SR                  [	        U5      5      5      eXl        g )Nz)Event.creator must be unicode data not {})r0   r   
ValueErrorrD   typer5   )r6   rZ   s     r#   r(   rY      s2    %++HOOPTUZP[\]]r"   c                 N   [         R                   " U 5      nUR                  R                  5       Ul        [         R                   " U R                  5      Ul        [         R                   " U R                  5      Ul        [         R                   " U R
                  5      Ul        U$ )z3
Returns:
    Calendar: an exact deep copy of self
)copyr,   cloner&   r'   r*   )r6   r`   s     r#   r`   Calendar.clone   sg    
 		$kk'')yy-ii

+99T__5r"   )r5   r*   r&   r,   r.   r-   r/   r'   )NNNN)r   r   r   r   __doc__r$   r   strr   r   r   r   r8   classmethodr>   rF   rM   objectboolrS   rV   propertyr   r(   setterr`   r!   r   r"   r#   r   r      s   	( ( *."& $*$sI~&*$ *$ ~	*$
 *$X 4 48# 8)(3- ) MF Mt M&F &t & #   ^^Xc] t  

r"   r   )r_   rI   typingr   r   r   r   r   sixr   	componentr
   eventr   ics.grammar.parser   r   r/   r   todor   ics.parsers.icalendar_parserr   $ics.serializers.icalendar_serializerr   r   r   r"   r#   <module>rq      s7      7 7     F   7 CDy Dr"   