
    F2j=                     l    d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ  G d de          ZdgZd	S )
z BOOLEAN values from :rfc:`5545`.    )AnyClassVar)CaselessDict)Self)JCalParsingError)
Parametersc            	       >    e Zd ZU dZdZee         ed<   eed<    e	ddd          Z
dd	d
edeeef         dz  dedef fdZdefdZedefd            Zededefd            Zedee         fd            ZddlmZ dedefdZededefd            Z xZS )vBooleana  Boolean

    Value Name:  BOOLEAN

    Purpose:  This value type is used to identify properties that contain
      either a "TRUE" or "FALSE" Boolean value.

    Format Definition:  This value type is defined by the following
      notation:

    .. code-block:: text

        boolean    = "TRUE" / "FALSE"

    Description:  These values are case-insensitive text.  No additional
      content value encoding is defined for this value type.

    Example:  The following is an example of a hypothetical property that
      has a BOOLEAN value type:

    .. code-block:: python

        TRUE

    .. code-block:: pycon

        >>> from icalendar.prop import vBoolean
        >>> boolean = vBoolean.from_ical('TRUE')
        >>> boolean
        True
        >>> boolean = vBoolean.from_ical('FALSE')
        >>> boolean
        False
        >>> boolean = vBoolean.from_ical('True')
        >>> boolean
        True
    BOOLEANdefault_valueparamsTF)truefalseNr   argskwargsreturnc                j     t                      j        | g|R i |}t          |          |_        |S )N)super__new__r   r   )clsr   r   r   self	__class__s        ^/home/thesage/.hermes/hermes-agent/venv/lib/python3.11/site-packages/icalendar/prop/boolean.pyr   zvBoolean.__new__7   s>     uwws4T444V44 ((    c                     | rdndS )uv  Converts a :class:`~icalendar.prop.boolean.vBoolean` to a BOOLEAN property type.

        This class method takes a ``vBoolean``—a Python boolean value—and converts it to an iCalendar BOOLEAN property type, in compliance with :rfc:`5545#section-3.3.2`.

        Returns:
            Either "TRUE" or "FALSE" as bytes, depending on the value of the ``vBoolean``.
        s   TRUEs   FALSE r   s    r   to_icalzvBoolean.to_ical>   s     ,wwH,r   c                      t          |           S )z<BOOLEAN property type according to :rfc:`5545#section-3.3.2`)boolr   s    r   
ical_valuezvBoolean.ical_valueH   s     Dzzr   icalc                 h    	 | j         |         S # t          $ r}t          d|           |d }~ww xY w)Nz Expected 'TRUE' or 'FALSE'. Got )BOOL_MAP	Exception
ValueError)r   r#   es      r   	from_icalzvBoolean.from_icalM   sQ    	O<%% 	O 	O 	OFFFGGQN	Os    
1,1c                 .     | d           | d          gS )zExamples of vBoolean.TFr   )r   s    r   exampleszvBoolean.examplesT   s$     CIICJJ
 	
r   r   )VALUEnamec                     || j                                         | j                                        t	          |           gS )zBThe jCal representation of this property according to :rfc:`7265`.)r   to_jcalr,   lowerr!   )r   r-   s     r   r/   zvBoolean.to_jcal^   s3    dk))++TZ-=-=-?-?dLLr   jcal_propertyc                     t          j        ||            t          j        |d         t          | d            | |d         t	          j        |                    S )zParse jCal from :rfc:`7265` to a vBoolean.

        Parameters:
            jcal_property: The jCal property to parse.

        Raises:
            ~error.JCalParsingError: If the provided jCal is invalid.
           r   )r   validate_propertyvalidate_value_typer!   r   from_jcal_property)r   r1   s     r   	from_jcalzvBoolean.from_jcalb   sb     	*=#>>>,]1-=tS!LLLs!0??
 
 
 	
r   )__name__
__module____qualname____doc__r   r   str__annotations__r   r   r%   r   dictr   r   bytesr   propertyr!   r"   classmethodr)   listr+   icalendar.paramr,   r/   r7   __classcell__)r   s   @r   r
   r
      s        $ $L $-M8C=,,,|TE::;;H :>  !%c3h$!6IL	     - - - - - D    X OS OT O O O [O 
d 
 
 
 [
 &%%%%%MC MD M M M M 
d 
t 
 
 
 [
 
 
 
 
r   r
   N)r;   typingr   r   icalendar.caselessdictr   icalendar.compatibilityr   icalendar.errorr   icalendar.parserr   intr
   __all__r   r   r   <module>rL      s    & &                 / / / / / / ( ( ( ( ( ( , , , , , , ' ' ' ' ' 'f
 f
 f
 f
 f
s f
 f
 f
R ,r   