
    i                    *   d Z ddlmZ ddlZ G d de          Z G d de          Z G d d	e          Z G d
 de          Z G d de          Z	 G d de          Z
 G d de          Z G d de          ZddZ G d de          Zg dZdS )zErrors thrown by icalendar.    )annotationsNc                      e Zd ZdZdS )InvalidCalendarzmThe calendar given is not valid.

    This calendar does not conform with RFC 5545 or breaks other RFCs.
    N__name__
__module____qualname____doc__     J/root/projects/butler/venv/lib/python3.11/site-packages/icalendar/error.pyr   r                 r   r   c                      e Zd ZdZdS )BrokenCalendarPropertya  A property could not be parsed and its value is broken.

    This error is raised when accessing attributes on a
    :class:`~icalendar.prop.vBroken` property that would normally
    be present on the expected type. The original parse error
    is chained as ``__cause__``.
    Nr   r   r   r   r   r      s           r   r   c                      e Zd ZdZdS )IncompleteComponentaB  The component is missing attributes.

    The attributes are not required, otherwise this would be
    an InvalidCalendar. But in order to perform calculations,
    this attribute is required.

    This error is not raised in the UPPERCASE properties like .DTSTART,
    only in the lowercase computations like .start.
    Nr   r   r   r   r   r      s           r   r   c                      e Zd ZdZdS )IncompleteAlarmInformationzCThe alarms cannot be calculated yet because information is missing.Nr   r   r   r   r   r   %   s        MMMMr   r   c                      e Zd ZdZdS )LocalTimezoneMissingzbWe are missing the local timezone to compute the value.

    Use Alarms.set_local_timezone().
    Nr   r   r   r   r   r   )   r   r   r   c                      e Zd ZdZdS )ComponentEndMissingz\We are missing the end of a component that the alarm is for.

    Use Alarms.set_end().
    Nr   r   r   r   r   r   0   r   r   r   c                      e Zd ZdZdS )ComponentStartMissingz`We are missing the start of a component that the alarm is for.

    Use Alarms.set_start().
    Nr   r   r   r   r   r   7   r   r   r   c                      e Zd ZdZdS )#FeatureWillBeRemovedInFutureVersionz1This feature will be removed in a future version.Nr   r   r   r   r   r   >   s        ;;;;r   r   index	str | intreturnstrc                V    t          | t                    rd|  dS t          |           S )z6Create a JSON compatible representation for the index.")
isinstancer    )r   s    r   _repr_indexr$   B   s.    % 5|||u::r   c                       e Zd ZdZ e            Zddefd fdZeej	        dd                        Z
edd            Ze	 d d!d            ZedededediZe	 	 d"d#d            Ze	 	 d"d$d            Z xZS )%JCalParsingErrorz#Could not parse a part of the JCal. Nmessager    parser
str | typepath"list[str | int] | None | str | intvalueobjectc                   |                      |          | _        t          |t                    s|j        }|| _        || _        || _        |}d}| j        r0d                    d | j        D                       }| d| }|dz  }|r
| d| d| }|| j	        ur|d|z  }t                                          |           dS )zCreate a new JCalParsingError.r'   c                4    g | ]}d t          |           dS )[])r$   ).0r   s     r   
<listcomp>z-JCalParsingError.__init__.<locals>.<listcomp>_   s,     R R Ru!:[%7%7!:!:!: R R Rr   z:  zin z Got value: N)	_get_pathr+   r#   r    r   r)   r(   r-   join_default_valuesuper__init__)selfr(   r)   r+   r-   full_message	repr_path	__class__s          r   r:   zJCalParsingError.__init__N   s     NN4((	&#&& 	%_F
	9 	 R R	 R R RSSI'99<99LI 	@'??F??g??L+++45444L&&&&&r   path_components	int | strc              '     K   	 dV  dS # t           $ rQ} | t          |          |j        z   |j        |j        |j                                      |j                  |d}~ww xY w)zAutomatically re-raise the exception with path components added.

        Raises:
            ~error.JCalParsingError: If there was an exception in the context.
        N)r+   r)   r(   r-   )r&   listr+   r)   r(   r-   with_traceback__traceback__)clsr?   es      r   reraise_with_path_addedz(JCalParsingError.reraise_with_path_addedh   s      	5EEEEE 	5 	5 	5#/**QV3x	g	  
 nQ_--15	5s   
 
A%AA  A%r   list[str | int]c                @    | g } nt          | t                    s| g} | S )zReturn the path as a list.)r#   rB   )r+   s    r   r6   zJCalParsingError._get_pathz   s.     <DDD$'' 	6Dr   c                   |                      |          }t          |t                    rt          |          dk     rt	          d|||          t          |d         t
                    st	          d||dgz   |d                   t          |d         t                    st	          d||dgz   |d                   t          |d         t
                    st	          d	||dgz   |d                   d
S )zvValidate a jCal property.

        Raises:
            ~error.JCalParsingError: if the property is not valid.
           z2The property must be a list with at least 4 items.)r-   r   zThe name must be a string.   z!The parameters must be a mapping.   z%The VALUE parameter must be a string.N)r6   r#   rB   lenr&   r    dict)rE   jcal_propertyr)   r+   s       r   validate_propertyz"JCalParsingError.validate_property   s9    }}T""-.. 	#m2D2Dq2H2H"D#	    -*C00 	",fdaSjVWHX    -*D11 	"3s
#A&	    -*C00 	"7s
#A&	   	 	r   za stringz
an integerza floatz	a booleanexpected_typeKtype[str | int | float | bool] | tuple[type[str | int | float | bool], ...]c                     t          ||          sVt          |t                    r j        |         n d                     fd|D                       }  d| d|||          dS )z"Validate the type of a jCal value.z or c              3  2   K   | ]}j         |         V  d S N)_type_names)r3   trE   s     r   	<genexpr>z7JCalParsingError.validate_value_type.<locals>.<genexpr>   s*       K K!3 K K K K K Kr   zThe value must be .r)   r-   r+   N)r#   typerW   r7   )rE   jcalrR   r)   r+   	type_names   `     r   validate_value_typez$JCalParsingError.validate_value_type   s     $.. 	 mT22L..[[ K K K K] K K KKK 
 #1Y111	   	 	r   type[str | int | float | bool]c                
   |                      |          }t          |t                    s | d|||          t          |          D ]9\  }}t          ||          s$| j        |         } | d| d||||gz             :dS )z.Validate the type of each item in a jCal list.zThe value must be a list.r[   zEach item in the list must be rZ   N)r6   r#   rB   	enumeraterW   )rE   r]   rR   r)   r+   r   itemr^   s           r   validate_list_typez#JCalParsingError.validate_list_type   s     }}T""$%% 	#+	    %T?? 	 	KE4dM22 OM:	cAYAAA!	   	 	r   )r(   r    r)   r*   r+   r,   r-   r.   )r?   r@   )r+   r,   r   rH   rV   )r)   r*   r+   r,   )r'   N)rR   rS   r)   r*   r+   r,   )rR   r`   r)   r*   r+   r,   )r   r   r	   r
   r.   r8   r:   classmethod
contextlibcontextmanagerrG   staticmethodr6   rQ   r    intfloatboolrW   r_   rd   __classcell__)r>   s   @r   r&   r&   I   sN       --VXXN
  37&' ' ' ' ' ' '4 5 5 5  [5     \ 
 48	$ $ $ $ [$N 	Z\yk	K   37    [, 
  37    [    r   r&   )	r   r   r   r   r   r   r   r&   r   )r   r   r   r    )r
   
__future__r   rf   
ValueErrorr   r   r   r   r   r   r   DeprecationWarningr   r$   r&   __all__r   r   r   <module>rq      s   ! ! " " " " " "        j       _   	 	 	 	 	* 	 	 	N N N N N N N N    5       4       6   < < < < <*< < < <   X X X X Xz X X Xv
 
 
r   