403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/attr/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/attr/__pycache__/converters.cpython-310.pyc
o

;j&�@sVdZddlZddlmZddlmZmZmZgd�Zdd�Z	edfd	d
�Z
dd�ZdS)
z
Commonly useful converters.
�N�)�_AnnotationExtractor)�NOTHING�Factory�pipe)�default_if_none�optionalr�to_boolcsP�fdd�}t��}|��}|rtj||jd<|��}|r&tj||jd<|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
    cs|durdS�|�S�N���val��	converterr�C/opt/saltstack/salt/lib/python3.10/site-packages/attr/converters.py�optional_converter$sz$optional.<locals>.optional_converterr
�return)rZget_first_param_type�typing�Optional�__annotations__Zget_return_type)rrZxtr�tZrtrrrrsrcs��tur|durd}t|���tur|durd}t|��|dur$t|��t�t�r:�jr2d}t|���fdd�}|S�fdd�}|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
    Nz(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.cs|dur|S���Sr
)�factoryr��defaultrr�default_if_none_converterXsz2default_if_none.<locals>.default_if_none_convertercs|dur|S�Sr
rrrrrr`s)r�	TypeErrorr�
isinstanceZ
takes_self�
ValueError)rr�msgrrrrr6s 
�rcCsht|t�r	|��}hd�}hd�}z||vrWdS||vr WdSWn	ty*Ynwd|��}t|��)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�1�truer�on�yZyes>F�no�n�falseZoff�0�fTFzCannot convert value to bool: )r�str�lowerrr)r
ZtruthyZfalsyrrrrr	is
��
r	)�__doc__rZ_compatr�_makerrr�__all__rrr	rrrr�<module>s 3

Youez - 2016 - github.com/yon3zu
LinuXploit