HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/usr/lib/python3/dist-packages/attr/__pycache__/_funcs.cpython-38.pyc
U

]�]�%�@s�ddlmZmZmZddlZddlmZddlmZm	Z	m
Z
ddlmZdde
dfd	d
�Zdd�Zddedfd
d�Zdd�Zdd�Zdd�ZdS)�)�absolute_import�division�print_functionN�)�	iteritems)�NOTHING�_obj_setattr�fields)�AttrsAttributeNotFoundErrorTFc
s�t|j�}��}|D]�}t||j�}�dk	r8�||�s8q|dkr�t|j�rbt|d����||j<q�t|ttt	f�r��dkr�|jnt}	|	���fdd�|D��||j<q�t|t
�rڈ�����fdd�t|�D��||j<q�|||j<q|||j<q|S)a�
    Return the ``attrs`` attribute values of *inst* as a dict.

    Optionally recurse into other ``attrs``-decorated classes.

    :param inst: Instance of an ``attrs``-decorated class.
    :param bool recurse: Recurse into classes that are also
        ``attrs``-decorated.
    :param callable filter: A callable whose return code determines whether an
        attribute or element is included (``True``) or dropped (``False``).  Is
        called with the `attr.Attribute` as the first argument and the
        value as the second argument.
    :param callable dict_factory: A callable to produce dictionaries from.  For
        example, to produce ordered dictionaries instead of normal Python
        dictionaries, pass in ``collections.OrderedDict``.
    :param bool retain_collection_types: Do not convert to ``list`` when
        encountering an attribute whose type is ``tuple`` or ``set``.  Only
        meaningful if ``recurse`` is ``True``.

    :rtype: return type of *dict_factory*

    :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
        class.

    ..  versionadded:: 16.0.0 *dict_factory*
    ..  versionadded:: 16.1.0 *retain_collection_types*
    NTcsg|]}t|�����qS���_asdict_anything��.0�i��dict_factory�filter�retain_collection_typesr�-/usr/lib/python3/dist-packages/attr/_funcs.py�
<listcomp>:s��zasdict.<locals>.<listcomp>c3s.|]&\}}t|����t|����fVqdS�Nr�rZkkZvv��dfrrrr�	<genexpr>Cs	����zasdict.<locals>.<genexpr>)r	�	__class__�getattr�name�has�asdict�
isinstance�tuple�list�set�dictr)
�inst�recurserrr�attrs�rv�a�v�cfr�rrrrrr 
s<"

���
	�r cs�t|jdd�dk	r$t|d����}npt|tttf�rb�dkrB|jnt}|���fdd�|D��}n2t|t�r�������fdd�t|�D��}n|}|S)zK
    ``asdict`` only works on attrs instances, this works on anything.
    �__attrs_attrs__NTcsg|]}t|�����qSrrrrrrr_s��z$_asdict_anything.<locals>.<listcomp>c3s.|]&\}}t|����t|����fVqdSrrrrrrrhs��z#_asdict_anything.<locals>.<genexpr>)	rrr r!r"r#r$r%r)�valrrrr)r,rr-rr
Us ��
�
r
c
st|j�}g}|�|D]�}t||j�}�dk	r:�||�s:q|dkr�t|j�rf|�t|d���d��n�t|tt	t
f�r��dkr�|jnt	}	|�|	���fdd�|D���nJt|t�r�dkr�|jnt}
|�|
��fdd�t|�D���n
|�|�q|�|�q�t	k�r|S�|�S)a1
    Return the ``attrs`` attribute values of *inst* as a tuple.

    Optionally recurse into other ``attrs``-decorated classes.

    :param inst: Instance of an ``attrs``-decorated class.
    :param bool recurse: Recurse into classes that are also
        ``attrs``-decorated.
    :param callable filter: A callable whose return code determines whether an
        attribute or element is included (``True``) or dropped (``False``).  Is
        called with the `attr.Attribute` as the first argument and the
        value as the second argument.
    :param callable tuple_factory: A callable to produce tuples from.  For
        example, to produce lists instead of tuples.
    :param bool retain_collection_types: Do not convert to ``list``
        or ``dict`` when encountering an attribute which type is
        ``tuple``, ``dict`` or ``set``.  Only meaningful if ``recurse`` is
        ``True``.

    :rtype: return type of *tuple_factory*

    :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
        class.

    ..  versionadded:: 16.2.0
    NT�r'r�
tuple_factoryrc	s,g|]$}t|j�r$t|d���d�n|�qS)Tr0�rr�astuple)r�j�r�retainr1rrr�s
���zastuple.<locals>.<listcomp>c3sJ|]B\}}t|j�r"t|��d�n|t|j�r<t|��d�n|fVqdS))r1rNr2r)r6r1rrr�s ������zastuple.<locals>.<genexpr>)
r	rrrr�appendr3r!r"r#r$r%r)r&r'rr1rr(r)r*r+r,rrr5rr3tsJ!

��	
���
��r3cCst|dd�dk	S)z�
    Check whether *cls* is a class with ``attrs`` attributes.

    :param type cls: Class to introspect.
    :raise TypeError: If *cls* is not a class.

    :rtype: bool
    r.N)r)�clsrrrr�s	rcKsvddl}|jdtdd�t�|�}t|j�}t|�D]<\}}t||t�}|tkrdt	dj
||jd���t|||�q4|S)a�
    Copy *inst* and apply *changes*.

    :param inst: Instance of a class with ``attrs`` attributes.
    :param changes: Keyword changes in the new copy.

    :return: A copy of inst with *changes* incorporated.

    :raise attr.exceptions.AttrsAttributeNotFoundError: If *attr_name* couldn't
        be found on *cls*.
    :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
        class.

    ..  deprecated:: 17.1.0
        Use `evolve` instead.
    rNz6assoc is deprecated and will be removed after 2018/01.�)�
stacklevelz&{k} is not an attrs attribute on {cl}.)�kZcl)�warnings�warn�DeprecationWarning�copyr	rrrrr
�formatr)r&�changesr<�newr(r;r+r*rrr�assoc�s&�

��rCcKsb|j}t|�}|D]D}|jsq|j}|ddkr4|n
|dd�}||krt||�||<q|f|�S)a�
    Create a new instance, based on *inst* with *changes* applied.

    :param inst: Instance of a class with ``attrs`` attributes.
    :param changes: Keyword changes in the new copy.

    :return: A copy of inst with *changes* incorporated.

    :raise TypeError: If *attr_name* couldn't be found in the class
        ``__init__``.
    :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
        class.

    ..  versionadded:: 17.1.0
    r�_rN)rr	Zinitrr)r&rAr8r(r*Z	attr_nameZ	init_namerrr�evolve	srE)Z
__future__rrrr?Z_compatr�_makerrr	�
exceptionsr
r%r r
r"r3rrCrErrrr�<module>s$�
K!�
c&