+
     Xh  c                   sX    R t ^ RIt^RIHt ^RIHtHtHtHt . ROt	R t
]R3R ltR tR# )z
Commonly useful converters.
N)_AnnotationExtractor)NOTHING	ConverterFactorypipec                s  a  \        S \        4      '       d   V 3R lpMV 3R lp\        S 4      pVP                  4       pV'       d%   \        P
                  V,          VP                  R&   VP                  4       pV'       d%   \        P
                  V,          VP                  R&   \        S \        4      '       d   \        VRRR7      # V# )a;  
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.

Args:
    converter (typing.Callable):
        the converter that is used for non-`None` values.

.. versionadded:: 17.1.0
c                 s"   < V f   R # S! WV4      # N )valZinstZfield	converters   &&&4/usr/lib/python3.14/site-packages/attr/converters.pyoptional_converter$optional.<locals>.optional_converter&   s    {S..    c                 s    < V f   R # S! V 4      # r   r   )r   r      &r	   r
   r   -   s    {S>!r   r   ZreturnT)
takes_selfZtakes_field)
isinstancer   r    Zget_first_param_typetypingZOptionalZ__annotations__Zget_return_type)r   r
   ZxtrtZrts   f    r	   optionalr      s     )Y''	/	"
 y
)C  "A4:OOA4F**51				B	7=r7J**84)Y''+$OOr   c                s  a  S \         J d   Vf   Rp\        V4      hS \         Jd   Ve   Rp\        V4      hVe   \        V4      o \        S \        4      '       d(   S P                  '       d   Rp\        V4      hV 3R lpV# V 3R lpV# )a  
A converter that allows to replace `None` values by *default* or the result
of *factory*.

Args:
    default:
        Value to be used if `None` is passed. Passing an instance of
        `attrs.Factory` is supported, however the ``takes_self`` option is
        *not*.

    factory (typing.Callable):
        A callable that takes no parameters whose result is used if `None`
        is passed.

Raises:
    TypeError: If **neither** *default* or *factory* is passed.

    TypeError: If **both** *default* and *factory* are passed.

    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                 s0   < V e   V # SP                  4       # r   )factoryr   defaultr   r	   default_if_none_converter2default_if_none.<locals>.default_if_none_converterl   s    
??$$r   c                 s   < V e   V # S# r   r   r   r   r	   r   r   t   s    
Nr   )r   Z	TypeErrorr   r   r   
ValueError)r   r   msgr   s   f&  r	   default_if_noner   B   s    4 'go8ng'"5En'"'7##ECS/!	% %$	 %$r   c                s    \        V \        4      '       d   V P                  4       p V R9   d   R# V R9   d   R# RV : 2p\        V4      h)a  
Convert "boolean" strings (for example, from environment variables) to real
booleans.

Values mapping to `True`:

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

Values mapping to `False`:

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

Raises:
    ValueError: For any other value.

.. versionadded:: 21.3.0
TFzCannot convert value to bool: )TZtruer   ZyesZyZonZ1i   )FZfalseZfZnoZnZoffZ0i    )r   ZstrZlowerr   )r   r   s   & r	   to_boolr   }   sJ    8 #siik
;;
==*3'
2C
S/r   )r   r   r   r   )Z__doc__r   Z_compatr    Z_maker   r   r   r   Z__all__r   r   r   r   r   r	   <module>r      s7     ) 4 4*Z $T 8%v%r   