Ë
    £2Úi  ã                   óP   — d Z ddlZddlmZ ddlmZmZmZ g d¢Zd„ Z	edfd„Z
d	„ Zy)
z
Commonly useful converters.
é    Né   )Ú_AnnotationExtractor)ÚNOTHINGÚFactoryÚpipe)Údefault_if_noneÚoptionalr   Úto_boolc                 óð   ‡ — ˆ fd„}t        ‰ «      }|j                  «       }|r t        j                  |   |j                  d<   |j                  «       }|r t        j                  |   |j                  d<   |S )aO  
    A converter that allows an attribute to be optional. An optional attribute
    is one which can be set to ``None``.

    Type annotations will be inferred from the wrapped converter's, if it
    has any.

    :param callable converter: the converter that is used for non-``None``
        values.

    .. versionadded:: 17.1.0
    c                 ó   •— | €y  ‰| «      S ©N© )ÚvalÚ	converters    €úF/var/www/html/acx/venv/lib/python3.12/site-packages/attr/converters.pyÚoptional_converterz$optional.<locals>.optional_converter$   s   ø€ Øˆ;ØÙ˜‹~Ðó    r   Úreturn)r   Úget_first_param_typeÚtypingÚOptionalÚ__annotations__Úget_return_type)r   r   ÚxtrÚtÚrts   `    r   r	   r	      sp   ø€ ôô
 ˜yÓ
)€Cà× Ñ Ó"€AÙÜ4:·O±OÀAÑ4FÐ×*Ñ*¨5Ñ1à	×	Ñ	Ó	€BÙ	Ü7=·±ÀrÑ7JÐ×*Ñ*¨8Ñ4àÐr   c                 óÜ   ‡ — ‰ t         u r|€t        d«      ‚‰ t         ur|�t        d«      ‚|�t        |«      Š t        ‰ t        «      r‰ j                  rt        d«      ‚ˆ fd„}|S ˆ fd„}|S )aœ  
    A converter that allows to replace ``None`` values by *default* or the
    result of *factory*.

    :param default: Value to be used if ``None`` is passed. Passing an instance
       of `attrs.Factory` is supported, however the ``takes_self`` option
       is *not*.
    :param callable factory: A callable that takes no parameters whose result
       is used if ``None`` is passed.

    :raises TypeError: If **neither** *default* or *factory* is passed.
    :raises TypeError: If **both** *default* and *factory* are passed.
    :raises ValueError: If an instance of `attrs.Factory` is passed with
       ``takes_self=True``.

    .. versionadded:: 18.2.0
    z(Must pass either `default` or `factory`.z5Must pass either `default` or `factory` but not both.z1`takes_self` is not supported by default_if_none.c                 ó,   •— | �| S ‰j                  «       S r   )Úfactory©r   Údefaults    €r   Údefault_if_none_converterz2default_if_none.<locals>.default_if_none_converterY   s   ø€ ØˆØ�
à—?‘?Ó$Ð$r   c                 ó   •— | �| S ‰S r   r   r    s    €r   r"   z2default_if_none.<locals>.default_if_none_convertera   s   ø€ ØˆØ�
àˆNr   )r   Ú	TypeErrorr   Ú
isinstanceÚ
takes_selfÚ
ValueError)r!   r   r"   s   `  r   r   r   6   s‰   ø€ ð$ ”'Ñ˜g˜oÜÐBÓCÐCà”gÑ 'Ð"5ÜØCó
ð 	
ð ÐÜ˜'Ó"ˆä�'œ7Ô#Ø×ÒÜØCóð ô	%ð %Ð$ô	ð %Ð$r   c                 ó¤   — t        | t        «      r| j                  «       } h d£}h d£}	 | |v ry| |v ry	 t	        d| › �«      ‚# t        $ r Y Œw xY w)a  
    Convert "boolean" strings (e.g., from env. vars.) to real booleans.

    Values mapping to :code:`True`:

    - :code:`True`
    - :code:`"true"` / :code:`"t"`
    - :code:`"yes"` / :code:`"y"`
    - :code:`"on"`
    - :code:`"1"`
    - :code:`1`

    Values mapping to :code:`False`:

    - :code:`False`
    - :code:`"false"` / :code:`"f"`
    - :code:`"no"` / :code:`"n"`
    - :code:`"off"`
    - :code:`"0"`
    - :code:`0`

    :raises ValueError: for any other value.

    .. versionadded:: 21.3.0
    >   TÚ1r   ÚyÚonÚyesÚtrue>   FÚ0ÚfÚnÚnoÚoffÚfalseTFzCannot convert value to bool: )r%   ÚstrÚlowerr$   r'   )r   ÚtruthyÚfalsys      r   r
   r
   j   sj   € ô4 �#”sÔØ�i‰i‹kˆÚ:€FÚ;€EðØ�&‰=ØØ�%‰<Øð ô
 Ð5°c°UÐ;Ó
<Ð<øô ò áðús   ªA ¯A Á	AÁA)Ú__doc__r   Ú_compatr   Ú_maker   r   r   Ú__all__r	   r   r
   r   r   r   ú<module>r<      s7   ðñó
 å )ß )Ñ )ò€òð@ $¨Tó 1%óh&=r   