HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/mercurial/thirdparty/attr/__pycache__/_make.cpython-310.pyc
o

�]Lbb��@sddlmZmZmZddlZddlZddlmZddlm	Z	ddl
mZmZm
Z
mZmZddlmZmZmZejZdZd	Zd
Zei�ZGdd�de�Ze�Z	edd
d
dd
difdd�Zdd�Zdd�Zdd�Z dd�Z!		
	dBdd�Z"er{dd�Z#ndd�Z#dd�Z$dCd d!�Z%dCd"d#�Z&dDd$d%�Z'd&d'�Z(d(d)�Z)d*d+�Z*d,d-�Z+d.d/�Z,Gd0d1�d1e�Z-d2d3�e-j.D�Z/e%e&e'e-e/d4�e/d4�d5d3�e/D�d4�Z-Gd6d7�d7e�Z0e&e'e0��Z0e"d
dd8�Gd9d:�d:e��Z1effd;d<�Z2e"d
d
d=�Gd>d?�d?e��Z3d@dA�Z4dS)E�)�absolute_import�division�print_functionN)�
itemgetter�)�_config)�PY2�	iteritems�isclass�iterkeys�metadata_proxy)�DefaultAlreadySetError�FrozenInstanceError�NotAnAttrsClassErrorz__attr_convert_{}z__attr_factory_{}z/    {attr_name} = property(itemgetter({index}))c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�_Nothingz�
    Sentinel class to indicate the lack of a value when ``None`` is ambiguous.

    All instances of `_Nothing` are equal.
    cC�|S�N���selfrr�A/usr/lib/python3/dist-packages/mercurial/thirdparty/attr/_make.py�__copy__�z_Nothing.__copy__cCrrr)r�_rrr�__deepcopy__"rz_Nothing.__deepcopy__cCs
|jtkSr)�	__class__r�r�otherrrr�__eq__%�
z_Nothing.__eq__cCs
||kSrrrrrr�__ne__(rz_Nothing.__ne__cC�dS)N�NOTHINGrrrrr�__repr__+rz_Nothing.__repr__cCr!)Nl�>[=rrrrr�__hash__.rz_Nothing.__hash__N)
�__name__�
__module__�__qualname__�__doc__rrrr r#r$rrrrrsrTc
Cs8|dur|dur|durtd��t||||||||d�S)a�
    Create a new attribute on a class.

    ..  warning::

        Does *not* do anything unless the class is also decorated with
        :func:`attr.s`!

    :param default: A value that is used if an ``attrs``-generated ``__init__``
        is used and no value is passed while instantiating or the attribute is
        excluded using ``init=False``.

        If the value is an instance of :class:`Factory`, its callable will be
        used to construct a new value (useful for mutable datatypes like lists
        or dicts).

        If a default is not set (or set manually to ``attr.NOTHING``), a value
        *must* be supplied when instantiating; otherwise a :exc:`TypeError`
        will be raised.

        The default can also be set using decorator notation as shown below.

    :type default: Any value.

    :param validator: :func:`callable` that is called by ``attrs``-generated
        ``__init__`` methods after the instance has been initialized.  They
        receive the initialized instance, the :class:`Attribute`, and the
        passed value.

        The return value is *not* inspected so the validator has to throw an
        exception itself.

        If a ``list`` is passed, its items are treated as validators and must
        all pass.

        Validators can be globally disabled and re-enabled using
        :func:`get_run_validators`.

        The validator can also be set using decorator notation as shown below.

    :type validator: ``callable`` or a ``list`` of ``callable``\ s.

    :param bool repr: Include this attribute in the generated ``__repr__``
        method.
    :param bool cmp: Include this attribute in the generated comparison methods
        (``__eq__`` et al).
    :param hash: Include this attribute in the generated ``__hash__``
        method.  If ``None`` (default), mirror *cmp*'s value.  This is the
        correct behavior according the Python spec.  Setting this value to
        anything else than ``None`` is *discouraged*.
    :type hash: ``bool`` or ``None``
    :param bool init: Include this attribute in the generated ``__init__``
        method.  It is possible to set this to ``False`` and set a default
        value.  In that case this attributed is unconditionally initialized
        with the specified default value or factory.
    :param callable convert: :func:`callable` that is called by
        ``attrs``-generated ``__init__`` methods to convert attribute's value
        to the desired format.  It is given the passed-in value, and the
        returned value will be used as the new value of the attribute.  The
        value is converted before being passed to the validator, if any.
    :param metadata: An arbitrary mapping, to be used by third-party
        components.  See :ref:`extending_metadata`.

    ..  versionchanged:: 17.1.0 *validator* can be a ``list`` now.
    ..  versionchanged:: 17.1.0
        *hash* is ``None`` and therefore mirrors *cmp* by default .
    NTF�6Invalid value for hash.  Must be True, False, or None.��default�	validator�repr�cmp�hash�init�convert�metadata)�	TypeError�
_CountingAttrr*rrr�attr8sF��r5cCsvd�|�}d�|�dg}|r"t|�D]\}}|�tj||d��qn|�d�dti}ttd�|�dd	�|�||S)
z�
    Create a tuple subclass to hold `Attribute`s for an `attrs` class.

    The subclass is a bare tuple with properties for names.

    class MyClassAttributes(tuple):
        __slots__ = ()
        x = property(itemgetter(0))
    z{}Attributeszclass {}(tuple):z    __slots__ = ())�index�	attr_namez    passr�
��exec)�format�	enumerate�append�_tuple_property_patr�eval�compile�join)�cls_name�
attr_names�attr_class_name�attr_class_template�ir7�globsrrr�_make_attr_tuple_class�s

�
��
rHc
sRg�t|jdd��D]}t|dd�}|dur#���fdd�|D��q|dur3dd�|j��D�}n	d	d�t|�D�}d
d�t|dd�d
�D�}dd��|D�}t|j	|�}|�dd�t|dd�d
�D��|_
d}|j
D]7}	|dur�|	�vr�t||	j|	�|dur�|	j
tur�|	jdur�tdj|	d���|dur�|	j
tur�|	jdur�d}qodS)z�
    Transforms all `_CountingAttr`s on a class into `Attribute`s and saves the
    list in `__attrs_attrs__`.

    If *these* is passed, use that and don't look for them on the class.
    r����__attrs_attrs__Nc3s�|]	}|�vr|VqdSrr��.0�a��	super_clsrr�	<genexpr>���z#_transform_attrs.<locals>.<genexpr>cSs"g|]
\}}t|t�r||f�qSr��
isinstancer4�rL�namer5rrr�
<listcomp>�s�z$_transform_attrs.<locals>.<listcomp>cSsg|]\}}||f�qSrr)rLrU�carrrrV�s�cS�g|]\}}tj||d��qS�)rUrW��	Attribute�from_counting_attr�rLr7rWrrrrV����cS�
|djS�Nr��counter��errr�<lambda>��
z"_transform_attrs.<locals>.<lambda>)�keycSsg|]}|j�qSr�rUrKrrrrV�scSrXrYrZr]rrrrV�r^cSr_r`rarcrrrre�rfFTzqNo mandatory attributes allowed after an attribute with a default value or factory.  Attribute in question: {a!r})rM)�reversed�__mro__�getattr�extend�__dict__�itemsr	�sortedrHr%rJ�setattrrUr+r"r0�
ValueErrorr;)
�cls�these�c�	sub_attrs�ca_list�non_super_attrsrC�
AttrsClass�had_defaultrMrrNr�_transform_attrs�sJ����
�
��

��rzcC�t��)z4
    Attached to frozen classes as __setattr__.
    �r�rrU�valuerrr�_frozen_setattrs��rcCr{)z4
    Attached to frozen classes as __delattr__.
    r|)rrUrrr�_frozen_delattrs�r�r�Fc
	s0���������f	dd�}
|dur|
S|
|�S)a�
    A class decorator that adds `dunder
    <https://wiki.python.org/moin/DunderAlias>`_\ -methods according to the
    specified attributes using :func:`attr.ib` or the *these* argument.

    :param these: A dictionary of name to :func:`attr.ib` mappings.  This is
        useful to avoid the definition of your attributes within the class body
        because you can't (e.g. if you want to add ``__repr__`` methods to
        Django models) or don't want to.

        If *these* is not ``None``, ``attrs`` will *not* search the class body
        for attributes.

    :type these: :class:`dict` of :class:`str` to :func:`attr.ib`

    :param str repr_ns: When using nested classes, there's no way in Python 2
        to automatically detect that.  Therefore it's possible to set the
        namespace explicitly for a more meaningful ``repr`` output.
    :param bool repr: Create a ``__repr__`` method with a human readable
        represantation of ``attrs`` attributes..
    :param bool str: Create a ``__str__`` method that is identical to
        ``__repr__``.  This is usually not necessary except for
        :class:`Exception`\ s.
    :param bool cmp: Create ``__eq__``, ``__ne__``, ``__lt__``, ``__le__``,
        ``__gt__``, and ``__ge__`` methods that compare the class as if it were
        a tuple of its ``attrs`` attributes.  But the attributes are *only*
        compared, if the type of both classes is *identical*!
    :param hash: If ``None`` (default), the ``__hash__`` method is generated
        according how *cmp* and *frozen* are set.

        1. If *both* are True, ``attrs`` will generate a ``__hash__`` for you.
        2. If *cmp* is True and *frozen* is False, ``__hash__`` will be set to
           None, marking it unhashable (which it is).
        3. If *cmp* is False, ``__hash__`` will be left untouched meaning the
           ``__hash__`` method of the superclass will be used (if superclass is
           ``object``, this means it will fall back to id-based hashing.).

        Although not recommended, you can decide for yourself and force
        ``attrs`` to create one (e.g. if the class is immutable even though you
        didn't freeze it programmatically) by passing ``True`` or not.  Both of
        these cases are rather special and should be used carefully.

        See the `Python documentation \
        <https://docs.python.org/3/reference/datamodel.html#object.__hash__>`_
        and the `GitHub issue that led to the default behavior \
        <https://github.com/python-attrs/attrs/issues/136>`_ for more details.
    :type hash: ``bool`` or ``None``
    :param bool init: Create a ``__init__`` method that initialiazes the
        ``attrs`` attributes.  Leading underscores are stripped for the
        argument name.  If a ``__attrs_post_init__`` method exists on the
        class, it will be called after the class is fully initialized.
    :param bool slots: Create a slots_-style class that's more
        memory-efficient.  See :ref:`slots` for further ramifications.
    :param bool frozen: Make instances immutable after initialization.  If
        someone attempts to modify a frozen instance,
        :exc:`attr.exceptions.FrozenInstanceError` is raised.

        Please note:

            1. This is achieved by installing a custom ``__setattr__`` method
               on your class so you can't implement an own one.

            2. True immutability is impossible in Python.

            3. This *does* have a minor a runtime performance :ref:`impact
               <how-frozen>` when initializing new instances.  In other words:
               ``__init__`` is slightly slower with ``frozen=True``.

            4. If a class is frozen, you cannot modify ``self`` in
               ``__attrs_post_init__`` or a self-written ``__init__``. You can
               circumvent that limitation by using
               ``object.__setattr__(self, "attribute_name", value)``.

        ..  _slots: https://docs.python.org/3.5/reference/datamodel.html#slots

    ..  versionadded:: 16.0.0 *slots*
    ..  versionadded:: 16.1.0 *frozen*
    ..  versionadded:: 16.3.0 *str*, and support for ``__attrs_post_init__``.
    ..  versionchanged::
            17.1.0 *hash* supports ``None`` as value which is also the default
            now.
    cs�t|dd�durtd���dur�durtd���r/�dur)dd�|j��D�}ntt���}t|��t|�p9�}�durDt	|�d�}�durL|j
|_�durTt|�}�durd�durd�durdtd	���dusp�durq�durqn�dus��dur��dur��dur�t
|�}nd|_�dur�t||�}|dur�t|_t|_�dur�t|�}�dur�t|j�}t|�|d
<|D]}|�|d�q�|�dd�t|dd�}t|�|j|j|�}|dur�||_|S)
Nrz(attrs only works with new-style classes.FTz3__str__ can only be generated if a __repr__ exists.cSsg|]\}}t|t�r|�qSrrRrTrrrrVNs
�z,attributes.<locals>.wrap.<locals>.<listcomp>)�nsr)�	__slots__rmr')rkr3rqrmrn�listrrz�_has_frozen_superclass�	_add_reprr#�__str__�_add_cmp�	_add_hashr$�	_add_initr�__setattr__r��__delattr__�_add_pickle�dict�tuple�pop�typer%�	__bases__r')rrrv�effectively_frozen�cls_dict�ca_name�qualname�	r.�frozenr/r0r-�repr_ns�slots�strrsrr�wrapBs^��
� 


zattributes.<locals>.wrapNr)�	maybe_clsrsr�r-r.r/r0r�r�r�r�rr�r�
attributes�sUBr�cCs"t|jdd�tjko|jjtjkS)�b
        Check whether *cls* has a frozen ancestor by looking at its
        __setattr__.
        r&N)rkr�rr&r%�rrrrrr��s���r�cCs
|jtkS)r�)r�rr�rrrr��s
cst�fdd�|D��S)z:
    Create a tuple of all values of *obj*'s *attrs*.
    c3��|]	}t�|j�VqdSr�rkrUrK��objrrrP�rQz"_attrs_to_tuple.<locals>.<genexpr>)r�)r��attrsrr�r�_attrs_to_tuple�sr�cs.�durdd�|jD���fdd�}||_|S)z%
    Add a hash method to *cls*.
    NcSs.g|]}|jdus|jdur|jdur|�qS)TN)r/r.rKrrrrV�s
�z_add_hash.<locals>.<listcomp>cstt|���S��1
        Automatically created by attrs.
        )r/r�r�r�rr�hash_�sz_add_hash.<locals>.hash_)rJr$)rrr�r�rr�rr��s�r�cs��durdd�|jD���fdd���fdd���fdd	�}�fd
d�}�fdd
�}�fdd�}�fdd�}�|_||_||_||_||_||_|S)z*
    Add comparison methods to *cls*.
    NcS�g|]}|jr|�qSr)r.rKrrrrV��z_add_cmp.<locals>.<listcomp>cs
t|��S)z&
        Save us some typing.
        )r�r�r�rr�attrs_to_tuple�s
z _add_cmp.<locals>.attrs_to_tuplecs |j|jur�|��|�kStSr�)r�NotImplementedr�r�rr�eq��z_add_cmp.<locals>.eqcs�||�}|turtS|Sr�)r�)rr�result)r�rr�ne�s
z_add_cmp.<locals>.necs t||j�r�|��|�kStSr��rSrr�rr�rr�lt�r�z_add_cmp.<locals>.ltcs t||j�r�|��|�kStSr�r�rr�rr�le�r�z_add_cmp.<locals>.lecs t||j�r�|��|�kStSr�r�rr�rr�gt�r�z_add_cmp.<locals>.gtcs t||j�r�|��|�kStSr�r�rr�rr�ge�r�z_add_cmp.<locals>.ge)rJrr �__lt__�__le__�__gt__�__ge__)rrr�r�r�r�r�r�r)r�r�r�rr��s 	
				r�cs0�durdd�|jD����fdd�}||_|S)z%
    Add a repr method to *cls*.
    NcSr�r)r-rKrrrrVr�z_add_repr.<locals>.<listcomp>csj�j}�durt|dd�}|dur|�dd�d}n|j}n�d|j}d�|d��fd	d
��D���S)r�Nr'z>.rrI�.z{0}({1})�, c3s*�|]}|jdtt�|j��VqdS)�=N)rUr-rkrKrrrrPs�"�z+_add_repr.<locals>.repr_.<locals>.<genexpr>)rrk�rsplitr%r;rA)r�real_clsr��
class_name�r�r�rr�repr_s��z_add_repr.<locals>.repr_)rJr#)rrr�r�r�rr�rr�s
r�cCs�dd�|jD�}t��}t|�}t|t�s|�d�}|�|�d�|�	��}t
||t|dd��\}}i}t||d�}	t
dd	�|D��}
|�t|
d
��|durSt|d<t|	||�|d
}t|�d|�d�|ftj|<||_|S)zR
    Add a __init__ method to *cls*.  If *frozen* is True, make it immutable.
    cSs g|]}|js|jtur|�qSr)r0r+r"rKrrrrV)s�
�z_add_init.<locals>.<listcomp>zutf-8z<attrs generated init {0}>�__attrs_post_init__Fr:css�|]}|j|fVqdSrrhrKrrrrP=��z_add_init.<locals>.<genexpr>)r"�	attr_dictT�_cached_setattr�__init__N)rJ�hashlib�sha1r-rS�bytes�encode�updater;�	hexdigest�_attrs_to_scriptrkr@r�r"�_obj_setattrr?�len�
splitlines�	linecache�cacher�)rrr�r�r��r�unique_filename�scriptrG�locs�bytecoder�r0rrrr�%s@


�
��
�r�cCs dd�}dd�}||_||_|S)zC
    Add pickle helpers, needed for frozen and slotted classes
    cst�fdd�t�j�D��S)�(
        Play nice with pickle.
        c3r�rr�rKr�rrrP]rQz9_add_pickle.<locals>._slots_getstate__.<locals>.<genexpr>)r��fieldsrr�rr�r�_slots_getstate__Ysz&_add_pickle.<locals>._slots_getstate__cSs6t�|t�}tt|j�|�D]
\}}||j|�qdS)r�N)r��__get__r[�zipr�rrU)r��state�__bound_setattrrMr~rrr�_slots_setstate___s�z&_add_pickle.<locals>._slots_setstate__)�__getstate__�__setstate__)rrr�r�rrrr�Us
r�cCs8t|�std��t|dd�}|durtdj|d���|S)a�
    Returns the tuple of ``attrs`` attributes for a class.

    The tuple also allows accessing the fields by their names (see below for
    examples).

    :param type cls: Class to introspect.

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

    :rtype: tuple (with name accesors) of :class:`attr.Attribute`

    ..  versionchanged:: 16.2.0 Returned tuple allows accessing the fields
        by name.
    zPassed object must be a class.rJNz({cls!r} is not an attrs-decorated class.r�)r
r3rkrr;)rrr�rrrr�ls
�r�cCsDtjdurdSt|j�D]}|j}|dur|||t||j��qdS)z�
    Validate all attributes on *inst* that have a validator.

    Leaves all exceptions through.

    :param inst: Instance of a class with ``attrs`` attributes.
    FN)r�_run_validatorsr�rr,rkrU)�instrM�vrrr�validate�s
��r�c
Cs�g}|dur|�d�dd�}dd�}ndd�}dd�}g}g}i}|D�]Q}	|	jr/|�|	�|	j}
|	j�d	�}t|	jt�}|rG|	jjrGd
}
nd}
|	jdur�|r�t	�
|	j�}|	jd
urt|�||
|d�
|
���t�
|	j�}|	j||<n
|�||
|d�
|
���|	jj
||<q$|	jd
ur�|�||
dj
|
d���t�
|	j�}|	j||<q$|�||
dj
|
d���q$|	jtur�|s�|�dj
||
d��|	jd
ur�|�||
|��|	j|t�
|	j�<q$|�||
|��q$|�rQ|�dj
|d��|�dj
|d��t	�
|	j�}|	jd
u�r,|�d||
|��|�d�|�d||
|d�
|
���|	j|t�
|	j�<n|�d||
|��|�d�|�d||
|d�
|
���|	jj
||<q$|�|�|	jd
u�rn|�||
|��|	j|t�
|	j�<q$|�||
|��q$|�r�t|d<|�d�|D]#}	d�
|	j�}d�
|	j�}
|�d�
||
|	j��|	j||<|	||
<�q�|�r�|�d�dj
d�|�|�r�d �|�nd!d"�|fS)#z�
    Return a script of an initializer for *attrs* and a dict of globals.

    The globals are expected by the generated script.

     If *frozen* is True, we cannot set the attributes directly so we use
    a cached ``object.__setattr__``.
    Tz8_setattr = _cached_setattr.__get__(self, self.__class__)cS�d||d�S)Nz(_setattr('%(attr_name)s', %(value_var)s)�r7�	value_varrr�rrr�
fmt_setter���z$_attrs_to_script.<locals>.fmt_settercS�t�|�}d|||d�S)Nz2_setattr('%(attr_name)s', %(conv)s(%(value_var)s))�r7r��conv��_init_convert_patr;�r7r��	conv_namerrr�fmt_setter_with_converter��
�z3_attrs_to_script.<locals>.fmt_setter_with_convertercSr�)Nzself.%(attr_name)s = %(value)s�r7r~rr�rrrr��r�cSr�)Nz,self.%(attr_name)s = %(conv)s(%(value_var)s)r�r�r�rrrr��r�rrr9FNz({0})z attr_dict['{attr_name}'].default)r7z+{arg_name}=attr_dict['{attr_name}'].default)�arg_namer7z{arg_name}=NOTHING)r�zif {arg_name} is not NOTHING:z    zelse:rz#if _config._run_validators is True:z__attr_validator_{}z	__attr_{}z    {}(self, {}, self.{})zself.__attrs_post_init__()z(def __init__(self, {args}):
    {lines}
r�z
    �pass)�args�lines)r=r,rU�lstriprSr+�Factory�
takes_selfr0�_init_factory_patr;r1r��factoryr"rrA)r�r��	post_initr�r�r�r��attrs_to_validate�names_for_globalsrMr7r��has_factory�
maybe_self�init_factory_namer��val_namerrrr��s�	�




��
������
�
�
�
�

�

��r�c@sDeZdZdZdZ	ddd�Zdd�Zedd	��Zd
d�Z	dd
�Z
dS)r[z�
    *Read-only* representation of an attribute.

    :attribute name: The name of the attribute.

    Plus *all* arguments of :func:`attr.ib`.
    )	rUr+r,r-r.r/r0r1r2Nc
Cs|t�|t�}
|
d|�|
d|�|
d|�|
d|�|
d|�|
d|�|
d|�|
d|�|
d	|	r9t|	��dSt�dS)
NrUr+r,r-r.r/r0r1r2)r�r�r[r�_empty_metadata_singleton)rrUr+r,r-r.r/r0r1r2�
bound_setattrrrrr�Bs







�zAttribute.__init__cCr{rr|r}rrrr�RszAttribute.__setattr__cs.�fdd�tjD�}|d|�j�jd�|��S)Ncs i|]}|dvr|t�|��qS)�rUr,r+)rk)rL�k�rWrr�
<dictcomp>Ws

�z0Attribute.from_counting_attr.<locals>.<dictcomp>r
r)r[r��
_validator�_default)rrrUrW�	inst_dictrrrr\Us
��zAttribute.from_counting_attrcst�fdd��jD��S)r�c3s,�|]}|dkr
t�|�nt�j�VqdS)r2N)rkr�r2�rLrUrrrrPgs��
�z)Attribute.__getstate__.<locals>.<genexpr>)r�r�rrrrr�cs�zAttribute.__getstate__cCsPt�|t�}t|j|�D]\}}|dkr|||�q|||r"t|�nt�qdS)r�r2N)r�r�r[r�r�rr)rr�r	rUr~rrrr�ks��zAttribute.__setstate__�NN)r%r&r'r(r�r�r��classmethodr\r�r�rrrrr[5s
�

r[cCs&g|]}t|tddd|dkdd��qS)NTr2�rUr+r,r-r.r/r0�r[r"rrrrrVxs
�
�rVr�cCr�r)r/rKrrrrV~r�c
@sZeZdZdZdZedd�dD��edddddd	dd
�fZdZdd
�Z	dd�Z
dd�ZdS)r4a
    Intermediate representation of attributes that uses a counter to preserve
    the order in which the attributes have been defined.

    *Internal* data structure of the attrs library.  Running into is most
    likely the result of a bug like a forgotten `@attr.s` decorator.
    )	rbrr-r.r/r0r2rr1c
cs&�|]}t|tdddddd�VqdS)NTrrrrrrrP�s���
�z_CountingAttr.<genexpr>)rbrr-r.r/r0r2NTFrrc		Cshtjd7_tj|_||_|rt|ttf�rt|�|_n||_||_	||_
||_||_||_
||_dSr`)r4�cls_counterrbrrSr�r��and_rr-r.r/r0r1r2)	rr+r,r-r.r/r0r1r2rrrr��s
z_CountingAttr.__init__cCs&|jdur
||_|St|j|�|_|S)z�
        Decorator that adds *meth* to the list of validators.

        Returns *meth* unchanged.

        .. versionadded:: 17.1.0
        N)rr�r�methrrrr,�s

�z_CountingAttr.validatorcCs"|jturt��t|dd�|_|S)z�
        Decorator that allows to set the default for an attribute.

        Returns *meth* unchanged.

        :raises DefaultAlreadySetError: If default has been set before.

        .. versionadded:: 17.1.0
        T)r�)rr"r
r�rrrrr+�s

z_CountingAttr.default)r%r&r'r(r�r�r[rJrr�r,r+rrrrr4�s����	r4)r�r0c@s&eZdZdZe�Ze�Zddd�ZdS)r�a�
    Stores a factory callable.

    If passed as the default value to :func:`attr.ib`, the factory is used to
    generate a new value.

    :param callable factory: A callable that takes either none or exactly one
        mandatory positional argument depending on *takes_self*.
    :param bool takes_self: Pass the partially initialized instance that is
        being initialized as a positional argument.

    .. versionadded:: 17.1.0  *takes_self*
    FcCs||_||_dS)z�
        `Factory` is part of the default machinery so if we want a default
        value here, we have to implement it ourselves.
        N)rr�)rrr�rrrr��s
zFactory.__init__N)F)r%r&r'r(r5rr�r�rrrrr��s

r�cKsTt|t�r|}nt|ttf�rtdd�|D��}ntd��tdi|��t|||��S)a
    A quick way to create a new class called *name* with *attrs*.

    :param name: The name for the new class.
    :type name: str

    :param attrs: A list of names or a dictionary of mappings of names to
        attributes.
    :type attrs: :class:`list` or :class:`dict`

    :param tuple bases: Classes that the new class will subclass.

    :param attributes_arguments: Passed unmodified to :func:`attr.s`.

    :return: A new class with *attrs*.
    :rtype: type

    ..  versionadded:: 17.1.0 *bases*
    css�|]}|t�fVqdSr)r5rKrrrrP�r�zmake_class.<locals>.<genexpr>z(attrs argument must be a dict or a list.Nr)rSr�r�r�r3r�r�)rUr��bases�attributes_argumentsr�rrr�
make_class�s
r)r�r/c@seZdZdZe�Zdd�ZdS)�
_AndValidatorz2
    Compose many validators to a single one.
    cCs|jD]}||||�qdSr)�_validators)rr�r5r~r�rrr�__call__s
�z_AndValidator.__call__N)r%r&r'r(r5rrrrrrrsrcGs6g}|D]}|�t|t�r|jn|g�qtt|��S)z�
    A validator that composes multiple validators into one.

    When called on a value, it runs all wrapped validators.

    :param validators: Arbitrary number of validators.
    :type validators: callables

    .. versionadded:: 17.1.0
    )rlrSrrr�)�
validators�valsr,rrrrs�r)
NNNTTNTFFFrr)5�
__future__rrrr�r��operatorrr9r�_compatrr	r
rr�
exceptionsr
rr�objectr�r�r�r�r>rrr"r5rHrzrr�r�r�r�r�r�r�r�r�r�r�r�r[r��_ar4r�rrrrrrr�<module>sr
�V5
�



N0C��F

"