o
    .j                     @  s~   d Z ddlmZ ddlmZmZmZ ddlmZ ddl	m
Z
 ddlmZ er2ddlmZ ddlmZ G d	d
 d
eZd
gZdS )z!Parsing error value preservation.    )annotations)TYPE_CHECKINGAnyClassVar)BrokenCalendarProperty)DEFAULT_ENCODING)vText)Self)
Parametersc                      sp   e Zd ZU dZdZded< dZeddddfd$ fddZd%ddZ	d&ddZ
ed'dd Zed(d"d#Z  ZS ))vBrokenzProperty that failed to parse, preserving raw value as text.

    Represents property values that failed to parse with their expected
    type. The raw iCalendar string is preserved for round-trip serialization.
    TEXTzClassVar[str]default_value)expected_typeparse_errorproperty_nameNparamsdict[str, Any] | Noner   
str | Noner   r   BaseException | Nonevaluestr | bytesencodingstrreturnr	   c                  s*   t  j| |||d}||_||_||_|S )N)r   )super__new__r   r   r   )clsr   r   r   r   r   r   self	__class__ J/home/thesage/.local/lib/python3.10/site-packages/icalendar/prop/broken.pyr      s
   
zvBroken.__new__namec              	   C  s<   | dr	t|td|d| jd| jd| j | j)au  Raise BrokenCalendarProperty for attribute access.

        Attributes like ``.dt`` that the expected type would have
        raise :class:`~icalendar.error.BrokenCalendarProperty`
        with the original parse error chained. Private attributes
        (starting with ``_``) raise normal ``AttributeError`` to
        preserve ``getattr(..., default)`` patterns.
        _zCannot access z on broken property z (expected z): )
startswithAttributeErrorr   r   r   r   )r   r"   r    r    r!   __getattr__*   s   
	zvBroken.__getattr__c                 C  s(   | j j dt| d| jd| jdS )N(z, expected_type=z, property_name=))r   __name__r   r   r   )r   r    r    r!   __repr__;   s   zvBroken.__repr__	raw_valuer
   error	Exceptionc                 C  s   | |||||dS )z"Create vBroken from parse failure.)r   r   r   r   r    )r   r+   r   r   r   r,   r    r    r!   from_parse_errorB   s   
zvBroken.from_parse_error
list[Self]c                 C  s   | dddt ddgS )zExamples of vBroken.zINVALID-DATEz	date-timeDTSTARTzInvalid date format)r   r   r   )
ValueError)r   r    r    r!   examplesT   s   zvBroken.examples)r   r   r   r   r   r   r   r   r   r   r   r   r   r	   )r"   r   )r   r   )r+   r   r   r
   r   r   r   r   r,   r-   r   r	   )r   r/   )r)   
__module____qualname____doc__r   __annotations__	__slots__r   r   r&   r*   classmethodr.   r2   __classcell__r    r    r   r!   r      s    
 

r   N)r5   
__future__r   typingr   r   r   icalendar.errorr   icalendar.parser_toolsr   icalendar.prop.textr   icalendar.compatibilityr	   icalendar.parserr
   r   __all__r    r    r    r!   <module>   s    
Q