%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/attr/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/attr/__pycache__/_funcs.cpython-312.pyc

�

��eC���ddlZddlmZmZddlmZmZmZddlm	Z	dde
ddfd�Zd	�Zdde
dfd
�Zd�Zd�Zd
�Z	dd�Zy)�N�)�PY_3_9_PLUS�get_generic_base)�NOTHING�_obj_setattr�fields)�AttrsAttributeNotFoundErrorTFc�0����
�t|j�}|�}|D�]7}t||j�}	��
�||	�s�&��
�|||	�}	|dur�t	|	j�rt|	d�|����||j<�jt
|	ttttf�rK�dur|	jnt}
|	D�cgc]}t|d�|������}}	|
|�||j<��t
|	t�r3|�
�
�
���fd�|	j�D��||j<��|	||j<��)|	||j<��:|Scc}w#t$r't|
t�s�|
|�||j<Y��qwxYw)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 `attrs.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``.
    :param Optional[callable] value_serializer: A hook that is called for every
        attribute or dict key/value.  It receives the current instance, field
        and value and must return the (updated) value.  The hook is run *after*
        the optional *filter* has been applied.

    :rtype: return type of *dict_factory*

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

    ..  versionadded:: 16.0.0 *dict_factory*
    ..  versionadded:: 16.1.0 *retain_collection_types*
    ..  versionadded:: 20.3.0 *value_serializer*
    ..  versionadded:: 21.3.0 If a dict has a collection for a key, it is
        serialized as a tuple.
    T��recurse�filter�dict_factory�retain_collection_types�value_serializerF��is_keyr
rrrc
3�h�K�|])\}}t|d������t|d������f���+y�w�TrFN��_asdict_anything��.0�kk�vv�dfr
rrs   �����-/usr/lib/python3/dist-packages/attr/_funcs.py�	<genexpr>zasdict.<locals>.<genexpr>`sW����� �&��B�#)��#'�#)�)+�4K�-=�
�)��#(�#)�)+�4K�-=�
�� ���/2)r�	__class__�getattr�name�has�asdict�
isinstance�tuple�list�set�	frozensetr�	TypeError�
issubclass�dict�items)�instrr
rrr�attrs�rv�a�v�cf�ir,rs  ` ``       @rr#r#s����T
�4�>�>�"�E�	��B�
�A���D�!�&�&�!����f�Q��l���'� ��q�!�,�A��d�?��1�;�;��#�� �!�!-�,C�%5�
��1�6�6�
��A��t�S�)�<�=�$;�t�$C�Q�[�[����
��%��$�%�%1�0G�)9�
�
��
�,�!#�E��B�q�v�v�J��A�t�$�!��� �&#$�'�'�)�' ���1�6�6�
�,��1�6�6�
��B�q�v�v�J�CA�D�I��]
��!�,�%�b�%�0��"$�U��B�q�v�v�J�,�s�E �"E%�%,F�Fc
������	�t|jdd��t|d�|����}|St|tt
ttf�rG�dur
|j}n|rt}nt
}||D�cgc]}t|d�|������c}�}|St|t�r&|�	�	�	���fd�|j�D��}|S|}��
�dd|�}|Scc}w)zK
    ``asdict`` only works on attrs instances, this works on anything.
    �__attrs_attrs__NTrFrc
3�h�K�|])\}}t|d������t|d������f���+y�wrrrs   ����rrz#_asdict_anything.<locals>.<genexpr>�sW�����
�&��B�#!���!�!#�,C�%5�
�!�� �!�!#�,C�%5�
�
�
�r)r rr#r$r%r&r'r(rr+r,)
�valrr
rrrr/r2r3rs
  ` ``   @rrr|s����s�}�}�/��6�B�
����%�$;�-�

��r�I�c
�C�%��s�I�6�	7�"�d�*����B�
��B��B�
��

��!�� �!�!-�,C�%5�
�

�
��R�I�9
�C��	�
��
�
�&�)�)�+�'
�
��4�I�	���'�!�$��b�1�B�
�I��Q

s�5Cc���
�t|j�}g}|�
|D�]]}t||j�}|�
|||�s�&|du�r"t	|j�r |jt
|d|��
����`t|ttttf�rc�
dur|jnt}	|D�
cgc])}
t	|
j�rt
|
d|��
��n|
��+}}
	|j|	|����t|t�rG�
dur|jnt}|j|�
�fd�|j�D�����:|j|���M|j|���`�tur|S�|�Scc}
w#t$r)t|	t�s�|j|	|��Y���wxYw)a)
    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 `attrs.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 attrs.exceptions.NotAnAttrsClassError: If *cls* is not an *attrs*
        class.

    ..  versionadded:: 16.2.0
    T)rr
�
tuple_factoryrc3��K�|]Q\}}t|j�rt|����n|t|j�rt|����n|f���Sy�w))r9rN)r"r�astuple)rrr�retainr9s   ��rrzastuple.<locals>.<genexpr>sk������"#�B�� #�2�<�<�0�$� "�.;�8>��"$� #�2�<�<�0�$� "�.;�8>��"$���s�AA)rrr r!r"�appendr;r$r%r&r'r(r)r*r+r,)r-rr
r9rr.r/r0r1r2�jr,rr<s   `         @rr;r;�s����B
�4�>�>�"�E�	�B�
$�F�
�?���D�!�&�&�!����f�Q��l���d�?��1�;�;���	�	��� $�%�&3�06����A��t�S�)�<�=�$*�d�N�Q�[�[�������1�;�;�'��� $�%�&3�06�������*��I�I�b��i�(��A�t�$�$*�d�N�Q�[�[����	�	���"'(�g�g�i�#���,�	�	�!���I�I�a�L�?�B�$�&�2�=�M�"�,=�=��a��!�*�%�b�%�0���I�I�b�%�j�)�*�s�8.F�)F�.G�Gc�r�t|dd�}|�yt|�}|�t|dd�}|�||_|duSy)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
    r5NTF)r rr5)�clsr.�generic_base�
generic_attrss    rr"r"-sY��
�C�*�D�1�E����$�C�(�L�����.?��F�
��$�"/�C���D�(�(��c��tj|�}t|j�}|j�D]H\}}t	||t
�}|t
ur|�d|j�d�}t
|��t|||��J|S)a�
    Copy *inst* and apply *changes*.

    This is different from `evolve` that applies the changes to the arguments
    that create the new instance.

    `evolve`'s behavior is preferable, but there are `edge cases`_ where it
    doesn't work. Therefore `assoc` is deprecated, but will not be removed.

    .. _`edge cases`: https://github.com/python-attrs/attrs/issues/251

    :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 attrs.exceptions.AttrsAttributeNotFoundError: If *attr_name*
        couldn't be found on *cls*.
    :raise attrs.exceptions.NotAnAttrsClassError: If *cls* is not an *attrs*
        class.

    ..  deprecated:: 17.1.0
        Use `attrs.evolve` instead if you can.
        This function will not be removed du to the slightly different approach
        compared to `attrs.evolve`.
    z is not an attrs attribute on �.)�copyrrr,r rr	r)r-�changes�newr.�kr1r0�msgs        r�assocrKEs���6�)�)�D�/�C��4�>�>�"�E��
�
�� ���1��E�1�g�&����<��C�5�c�m�m�_�A�F�C�-�c�2�2��S�!�Q�� ��JrCc��|r	|\}n.	|jd�}ddl}|j
dtd�	�|j}t|�}|D];}|js�|j}|j}	|	|vs�-t||�||	<�=|d
i|��S#t$rdt|��d�}t|�d�wxYw#t$rd}t|�d�wxYw)a�
    Create a new instance, based on the first positional argument 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 attrs.exceptions.NotAnAttrsClassError: If *cls* is not an *attrs*
        class.

    .. versionadded:: 17.1.0
    .. deprecated:: 23.1.0
       It is now deprecated to pass the instance using the keyword argument
       *inst*. It will raise a warning until at least April 2024, after which
       it will become an error. Always pass the instance as a positional
       argument.
    z*evolve() takes 1 positional argument, but z were givenNr-z7evolve() missing 1 required positional argument: 'inst'rzgPassing the instance per keyword argument is deprecated and will stop working in, or after, April 2024.�)�
stacklevel�)�
ValueError�lenr)�pop�KeyError�warnings�warn�DeprecationWarningrr�initr!�aliasr )
�argsrGr-rJrTr@r.r0�	attr_name�	init_names
          r�evolver\ks���0�	+��G�T�
	+��;�;�v�&�D�
	��
�
�
:���		�	
��.�.�C��3�K�E�
�:���v�v���F�F�	��G�G�	��G�#�!(��y�!9�G�I��
:��>��>���;�	+�>�s�4�y�k��U�C��C�.�d�*�	+���	+�K�C��C�.�d�*�	+�s�B�B>�%B;�>Cc��t|dd�|k7rkddl}||d�}tr||d<|j|fi|��}|�t	|�n|D]+}|j
|vs�t
|d||j
��-||_|S)aA
    Resolve any strings and forward annotations in type annotations.

    This is only required if you need concrete types in `Attribute`'s *type*
    field. In other words, you don't need to resolve your types if you only
    use them for static type checking.

    With no arguments, names will be looked up in the module in which the class
    was created. If this is not what you want, e.g. if the name only exists
    inside a method, you may pass *globalns* or *localns* to specify other
    dictionaries in which to look up these names. See the docs of
    `typing.get_type_hints` for more details.

    :param type cls: Class to resolve.
    :param Optional[dict] globalns: Dictionary containing global variables.
    :param Optional[dict] localns: Dictionary containing local variables.
    :param Optional[list] attribs: List of attribs for the given class.
        This is necessary when calling from inside a ``field_transformer``
        since *cls* is not an *attrs* class yet.
    :param bool include_extras: Resolve more accurately, if possible.
        Pass ``include_extras`` to ``typing.get_hints``, if supported by the
        typing module. On supported Python versions (3.9+), this resolves the
        types more accurately.

    :raise TypeError: If *cls* is not a class.
    :raise attrs.exceptions.NotAnAttrsClassError: If *cls* is not an *attrs*
        class and you didn't pass any attribs.
    :raise NameError: If types cannot be resolved because of missing variables.

    :returns: *cls* so you can use this function also as a class decorator.
        Please note that you have to apply it **after** `attrs.define`. That
        means the decorator has to come in the line **before** `attrs.define`.

    ..  versionadded:: 20.1.0
    ..  versionadded:: 21.1.0 *attribs*
    ..  versionadded:: 23.1.0 *include_extras*

    �__attrs_types_resolved__Nr)�globalns�localns�include_extras�type)r �typingr�get_type_hintsrr!rr^)	r@r_r`�attribsrarc�kwargs�hints�fields	         r�
resolve_typesri�s���V�s�.��5��<��&�7�;���'5�F�#�$�%��%�%�c�4�V�4��$+�O�V�C�[��	?�E��z�z�U�"��U�F�E�%�*�*�,=�>�	?�(+��$��JrC)NNNT)rF�_compatrr�_makerrr�
exceptionsr	r+r#rr%r;r"rKr\rirOrCr�<module>rmsg���2�0�0�3�

���!��
n�bF�V
���!�e>�P�0#�L8�xDH�=rC

Zerion Mini Shell 1.0