+
     XhS  c                   s   R t ^ RIt^ RIt^ RIHt ^ RIHt ^RIHtHt ^RI	H
t
HtHtHt ^RIHt ^RIHt . R;OtR tR	 t]R
 4       t]! RRRR7       ! R R4      4       tR t]! RRRR7       ! R R4      4       tR<R lt]! RRRR7       ! R R4      4       tR t]! RRRR7       ! R R4      4       tR t]! RRRR7       ! R R4      4       tR t]! RRRR7       ! R R4      4       t R=R  lt!]! RRRR7       ! R! R"4      4       t"R>R# lt#]! RRRR7       ! R$ R%4      4       t$R& t%R' t&R( t'R) t(]! RRRR7       ! R* R+4      4       t)R, t*]! RRRR7       ! R- R.4      4       t+R/ t,]! RRRR7       ! R0 R14      4       t-R2 t.]! RRRR7       ! R3 R44      4       t/R5RR6]0]13/R7 lt2]! RRRR7       ! R8 R94      4       t3R: t4R# )?z
Commonly useful validators.
N)contextmanager)Pattern)get_run_validatorsset_run_validators)_AndValidatorand_attribattrs)default_if_none)NotCallableErrorc                s&    \        V '       * 4       R# )z
Globally disable or enable running validators.

By default, they are run.

Args:
    disabled (bool): If `True`, disable running all validators.

.. warning::

    This function is not thread-safe!

.. versionadded:: 21.3.0
Nr   )disabled   &4/usr/lib/python3.14/site-packages/attr/validators.pyset_disabledr   *   s     8|$    c                 s     \        4       '       * # )z
Return a bool indicating whether validators are currently disabled or not.

Returns:
    bool:`True` if validators are currently disabled.

.. versionadded:: 21.3.0
)r    r   r   get_disabledr   <   s     "###r   c               #  sd   "   \        R4        Rx  \        R4       R#   \        R4       i ; i5i)z
Context manager that disables running validators within its context.

.. warning::

    This context manager is not thread-safe!

.. versionadded:: 21.3.0
FNTr
   r   r   r   r   r   H   s(      u!4 4 s   0  0-0FT)reprslotsZunsafe_hashc                   s:   a  ] tR t^Zt o ]! 4       tR tR tRtV t	R# )_InstanceOfValidatorc           	     s    \        W0P                  4      '       gI   RVP                   RV P                  : RV: RVP                  : R2	p\	        VVV P                  V4      hR# )@
We use a callable class to be able to change the ``__repr__``.
'
' must be  (got z that is a ).N)
isinstancetypename	__class__	TypeErrorselfinstattrvaluemsg   &&&& r   __call__Z_InstanceOfValidator.__call__^   sf     %++dii[
499-veYkRWRaRaQddfgC			  ,r   c                $    R V P                   : R2# )z <instance_of validator for type >r   r    r   r   __repr__Z_InstanceOfValidator.__repr__k       1$))a@@r   r   N
__name__
__module____qualname____firstlineno__r   r   r&   r+   __static_attributes____classdictcell__Z__classdict__   @r   r   r   Z        8DA Ar   r   c                    \        V 4      # )a  
A validator that raises a `TypeError` if the initializer is called with a
wrong type for this particular attribute (checks are performed using
`isinstance` therefore it's also valid to pass a tuple of types).

Args:
    type (type | tuple[type]): The type to check for.

Raises:
    TypeError:
        With a human readable error message, the attribute (of type
        `attrs.Attribute`), the expected type, and the value it got.
)r   r)   r   r   instance_ofr8   o         %%r   )r   Zfrozenr   c                   sH   a  ] tR t^t o ]! 4       t]! 4       tR tR tRt	V t
R# )_MatchesReValidatorc                s    V P                  V4      '       gE   RVP                   RV P                  P                  : RV: R2p\        VVV P                  V4      hR# )r   r   z' must match regex z (z	 doesn't)N)
match_funcr   pattern
ValueErrorr   r%   r   r&   Z_MatchesReValidator.__call__   s`     u%%dii[ 3DLL4H4H3K2eYV_`C	  &r   c                r'   )z"<matches_re validator for pattern r(   )r<   r*   r   r   r+   Z_MatchesReValidator.__repr__   s    3DLL3C1EEr   r   N)r.   r/   r0   r1   r   r<   r;   r&   r+   r2   r3   r4   r5   r   r:   r:      s$     hGJF Fr   r:   c           
     s0   \         P                  R\         P                  \         P                  3pW#9  dE   RP	                  RP                  \        R \        V4       4       4      4      4      p\        V4      h\        V \        4      '       d   V'       d   Rp\        V4      hT pM\         P                  ! W4      pV\         P                  J d   VP                  pM-V\         P                  J d   VP                  pMVP                  p\        WV4      # )a  
A validator that raises `ValueError` if the initializer is called with a
string that doesn't match *regex*.

Args:
    regex (str, re.Pattern):
        A regex string or precompiled pattern to match against

    flags (int):
        Flags that will be passed to the underlying re function (default 0)

    func (typing.Callable):
        Which underlying `re` function to call. Valid options are
        `re.fullmatch`, `re.search`, and `re.match`; the default `None`
        means `re.fullmatch`. For performance reasons, the pattern is
        always precompiled using `re.compile`.

.. versionadded:: 19.2.0
.. versionchanged:: 21.3.0 *regex* can be a pre-compiled pattern.
Nz'func' must be one of {}.z, c              3   s`   "   T F$  q;'       d    VP                   ;'       g    R x  K&  	  R# 5i)ZNoneN)r.   )Z.0Ze   & r   Z	<genexpr>Zmatches_re.<locals>.<genexpr>   s'     N=M((ajj33V3=Ms   ...zR'flags' can only be used with a string pattern; pass flags to re.compile() instead)reZ	fullmatchZsearchZmatchformatZjoinZsortedsetr=   r   r   r   Zcompiler:   )ZregexZflagsZfuncZvalid_funcsr$   r<   r;   s   &&&    r   
matches_rerB      s    * <<ryy"((;K)00IINS=MNN

 o%!!fCC. **U*rxx]]
		^^
&&
w33r   c                   s:   a  ] tR t^t o ]! 4       tR tR tRtV t	R# )_OptionalValidatorc                s6    Vf   R # V P                  WV4       R # N	validatorr    r!   r"   r#      &&&&r   r&   Z_OptionalValidator.__call__   s    =t5)r   c                r'   )z<optional validator for z	 or None>rE   r*   r   r   r+   Z_OptionalValidator.__repr__   s    )$..);9EEr   r   N)
r.   r/   r0   r1   r   rF   r&   r+   r2   r3   r4   r5   r   rC   rC      s     I*F Fr   rC   c                sx    \        V \        \        34      '       d   \        \	        V 4      4      # \        V 4      # )a  
A validator that makes an attribute optional.  An optional attribute is one
which can be set to `None` in addition to satisfying the requirements of
the sub-validator.

Args:
    validator
        (typing.Callable | tuple[typing.Callable] | list[typing.Callable]):
        A validator (or validators) that is used for non-`None` values.

.. versionadded:: 15.1.0
.. versionchanged:: 17.1.0 *validator* can be a list of validators.
.. versionchanged:: 23.1.0 *validator* can also be a tuple of validators.
)r   listtuplerC   r   rE   r   r   optionalrK      s0     )dE]++!-	":;;i((r   c                   sL   a  ] tR t^t o ]! 4       t]! RR7      tR tR tRt	V t
R# )_InValidatorF)Zhashc                s     W0P                   9   pV'       g;   RVP                   RV P                  : RV: R2p\	        VVV P                  V4      hR#   \         d    R p LSi ; i)Fr   z' must be in r   Z)N)optionsr   r   _original_optionsr=   )r    r!   r"   r#   Z
in_optionsr$      &&&&  r   r&   Z_InValidator.__call__   sx    	,,.J dii[d.D.D-GveYVWXC&&	    	J	s   A A$#A$c                r'   )z<in_ validator with options r(   )rN   r*   r   r   r+   Z_InValidator.__repr__   s    -d.D.D-GqIIr   r   N)r.   r/   r0   r1   r   rM   rN   r&   r+   r2   r3   r4   r5   r   rL   rL      s(     hGE*J Jr   rL   c                st    T p\        V \        \        \        34      '       d   \	        V 4      p \        W4      # )a  
A validator that raises a `ValueError` if the initializer is called with a
value that does not belong in the *options* provided.

The check is performed using ``value in options``, so *options* has to
support that operation.

To keep the validator hashable, dicts, lists, and sets are transparently
transformed into a `tuple`.

Args:
    options: Allowed options.

Raises:
    ValueError:
        With a human readable error message, the attribute (of type
        `attrs.Attribute`), the expected options, and the value it got.

.. versionadded:: 17.1.0
.. versionchanged:: 22.1.0
   The ValueError was incomplete until now and only contained the human
   readable error message. Now it contains all the information that has
   been promised since 17.1.0.
.. versionchanged:: 24.1.0
   *options* that are a list, dict, or a set are now transformed into a
   tuple to keep the validator hashable.
)r   rI   ZdictrA   rJ   rL   )rM   Zrepr_optionsr>   r   in_rP     s1    8 L'D$,--...r   c                   s,   a  ] tR tRt o R tR tRtV tR# )_IsCallableValidatori$  c                s    \        V4      '       g5   Rp\        VP                  VP                  W3P                  R7      VR7      hR# )r   z?'{name}' must be callable (got {value!r} that is a {actual!r}).)r   r#   Zactual)r$   r#   N)Zcallabler	   r@   r   r   )r    r!   r"   r#   Zmessager%   r   r&   Z_IsCallableValidator.__call__&  sN     8  #NN% #  	  r   c                s    R # )z<is_callable validator>r   r*   r   r   r+   Z_IsCallableValidator.__repr__6  s    (r   r   N)r.   r/   r0   r1   r&   r+   r2   r3   r4   r5   r   rQ   rQ   $  s      ) )r   rQ   c                 s    \        4       # )ad  
A validator that raises a `attrs.exceptions.NotCallableError` if the
initializer is called with a value for this particular attribute that is
not callable.

.. versionadded:: 19.1.0

Raises:
    attrs.exceptions.NotCallableError:
        With a human readable error message containing the attribute
        (`attrs.Attribute`) name, and the value it got.
)rQ   r   r   r   is_callablerR   :  s      !!r   c                   sr   a  ] tR tRt o ]! ]! 4       R7      t]! R]! ]! 4       4      R7      tR t	R t
RtV tR# )_DeepIterableiJ  rE   N)ZdefaultrF   c                s|    V P                   e   V P                  WV4       V F  pV P                  WV4       K  	  R# r   Niterable_validatormember_validator)r    r!   r"   r#   Zmemberr%   r   r&   Z_DeepIterable.__call__Q  s:     "".##D6F!!$f5 r   c                sj    V P                   f   RMRV P                   : 2pRV RV P                  : R2# )NZ  z<deep_iterable validator forz iterables of r(   rU   )r    Ziterable_identifierr>   r   r+   Z_DeepIterable.__repr__[  sP     &&. T,,/0 	 ++>*?T225Q8	
r   r   )r.   r/   r0   r1   r   rR   rW   rK   rV   r&   r+   r2   r3   r4   r5   r   rS   rS   J  s8     6 76	
 	
r   rS   c                s    \        V \        \        34      '       d
   \        V !  p \        V\        \        34      '       d
   \        V!  p\	        W4      # )a  
A validator that performs deep validation of an iterable.

Args:
    member_validator: Validator(s) to apply to iterable members.

    iterable_validator:
        Validator(s) to apply to iterable itself (optional).

Raises
    TypeError: if any sub-validators fail

.. versionadded:: 19.1.0

.. versionchanged:: 25.4.0
   *member_validator* and *iterable_validator* can now be a list or tuple
   of validators.
)r   rI   rJ   r   rS   rW   rV   s   &&r   deep_iterablerZ   g  sL    & "T5M22!12$tUm44!#56)>>r   c                   s   a  ] tR tRt o ]! ]! ]! 4       4      R7      t]! ]! ]! 4       4      R7      t]! ]! ]! 4       4      R7      t	R t
R tRtV tR# )_DeepMappingi  rE   c                s    V P                   e   V P                  WV4       V FK  pV P                  e   V P                  WV4       V P                  f   K3  V P                  WW4,          4       KM  	  R# rT   )mapping_validatorkey_validatorvalue_validator)r    r!   r"   r#   Zkeyr%   r   r&   Z_DeepMapping.__call__  sd     !!-""4u5C!!-""4s3##/$$T<	 r   c                @    R V P                   : RV P                  : R2# )z,<deep_mapping validator for objects mapping z to r(   )r]   r^   r*   r   r   r+   Z_DeepMapping.__repr__  s(    =d>P>P=SSWX\XlXlWoopqqr   r   N)r.   r/   r0   r1   r   rK   rR   r]   r^   r\   r&   r+   r2   r3   r4   r5   r   r[   r[     sJ     Xkm%<=Mx'>?O+-)@A=r rr   r[   c                s"   V f   Vf   Rp\        V4      h\        V \        \        34      '       d
   \	        V !  p \        V\        \        34      '       d
   \	        V!  p\        V\        \        34      '       d
   \	        V!  p\        WV4      # )aZ  
A validator that performs deep validation of a dictionary.

All validators are optional, but at least one of *key_validator* or
*value_validator* must be provided.

Args:
    key_validator: Validator(s) to apply to dictionary keys.

    value_validator: Validator(s) to apply to dictionary values.

    mapping_validator:
        Validator(s) to apply to top-level mapping attribute.

.. versionadded:: 19.1.0

.. versionchanged:: 25.4.0
   *key_validator* and *value_validator* are now optional, but at least one
   of them must be provided.

.. versionchanged:: 25.4.0
   *key_validator*, *value_validator*, and *mapping_validator* can now be a
   list or tuple of validators.

Raises:
    TypeError: If any sub-validator fails on validation.

    ValueError:
        If neither *key_validator* nor *value_validator* is provided on
        instantiation.
zAAt least one of key_validator or value_validator must be provided)r=   r   rI   rJ   r   r[   )r]   r^   r\   r$   s   &&& r   deep_mappingr`     s    D !8O 	 o-$//m,/D%=110#dE]33 "348IJJr   c                   sV   a  ] tR tRt o ]! 4       t]! 4       t]! 4       tR tR t	Rt
V tR# )_NumberValidatori  c                s    V P                  W0P                  4      '       g8   RVP                   RV P                   RV P                   RV 2p\	        V4      hR# )r   r   r   rX   : N)compare_funcboundr   
compare_opr=   r   r%   r   r&   Z_NumberValidator.__call__  sS       

33dii[
4??*;1TZZL5'RCS/! 4r   c                s<    R V P                    RV P                   R2# )z<Validator for x rX   r(   )re   rd   r*   r   r   r+   Z_NumberValidator.__repr__  s     "4??"31TZZLBBr   r   N)r.   r/   r0   r1   r   rd   re   rc   r&   r+   r2   r3   r4   r5   r   ra   ra     s+     HEJ8L"C Cr   ra   c                8    \        V R\        P                  4      # )z
A validator that raises `ValueError` if the initializer is called with a
number larger or equal to *val*.

The validator uses `operator.lt` to compare the values.

Args:
    val: Exclusive upper bound for values.

.. versionadded:: 21.3.0
Z<)ra   operatorltZvalr   r   rh   rh          Chkk22r   c                rf   )z
A validator that raises `ValueError` if the initializer is called with a
number greater than *val*.

The validator uses `operator.le` to compare the values.

Args:
    val: Inclusive upper bound for values.

.. versionadded:: 21.3.0
z<=)ra   rg   leri   r   r   rk   rk          Cx{{33r   c                rf   )z
A validator that raises `ValueError` if the initializer is called with a
number smaller than *val*.

The validator uses `operator.ge` to compare the values.

Args:
    val: Inclusive lower bound for values

.. versionadded:: 21.3.0
z>=)ra   rg   geri   r   r   rm   rm     rl   r   c                rf   )z
A validator that raises `ValueError` if the initializer is called with a
number smaller or equal to *val*.

The validator uses `operator.gt` to compare the values.

Args:
   val: Exclusive lower bound for values

.. versionadded:: 21.3.0
r(   )ra   rg   gtri   r   r   rn   rn   	  rj   r   c                   :   a  ] tR tRt o ]! 4       tR tR tRtV t	R# )_MaxLengthValidatori  c                s    \        V4      V P                  8  d4   RVP                   RV P                   R\        V4       2p\        V4      hR# )r   Length of 'z' must be <= rb   N)len
max_lengthr   r=   r   r%   r   r&   Z_MaxLengthValidator.__call__  H     u:'		{-7H3u:,WCS/! (r   c                "    R V P                    R2# )z<max_len validator for r(   )rs   r*   r   r   r+   Z_MaxLengthValidator.__repr__$      ((9;;r   r   N)
r.   r/   r0   r1   r   rs   r&   r+   r2   r3   r4   r5   r   rp   rp          J"< <r   rp   c                r7   )z
A validator that raises `ValueError` if the initializer is called
with a string or iterable that is longer than *length*.

Args:
    length (int): Maximum length of the string or iterable

.. versionadded:: 21.3.0
)rp   Zlengthr   r   max_lenry   (       v&&r   c                   ro   )_MinLengthValidatori5  c                s    \        V4      V P                  8  d4   RVP                   RV P                   R\        V4       2p\        V4      hR# )r   rq   z' must be >= rb   N)rr   
min_lengthr   r=   r   r%   r   r&   Z_MinLengthValidator.__call__9  rt   r   c                ru   )z<min_len validator for r(   )r|   r*   r   r   r+   Z_MinLengthValidator.__repr__A  rv   r   r   N)
r.   r/   r0   r1   r   r|   r&   r+   r2   r3   r4   r5   r   r{   r{   5  rw   r   r{   c                r7   )z
A validator that raises `ValueError` if the initializer is called
with a string or iterable that is shorter than *length*.

Args:
    length (int): Minimum length of the string or iterable

.. versionadded:: 22.1.0
)r{   rx   r   r   min_lenr}   E  rz   r   c                   ro   )_SubclassOfValidatoriR  c                s    \        W0P                  4      '       g;   RVP                   RV P                  : RV: R2p\        VVV P                  V4      hR# )r   r   z' must be a subclass of r   r   N)Z
issubclassr   r   r   r   r%   r   r&   Z_SubclassOfValidator.__call__V  sY     %++dii[ 8VE9TVWC			  ,r   c                r'   )z <subclass_of validator for type r(   r)   r*   r   r   r+   Z_SubclassOfValidator.__repr__c  r,   r   r   Nr-   r4   r5   r   r~   r~   R  r6   r   r~   c                r7   )a  
A validator that raises a `TypeError` if the initializer is called with a
wrong type for this particular attribute (checks are performed using
`issubclass` therefore it's also valid to pass a tuple of types).

Args:
    type (type | tuple[type, ...]): The type(s) to check for.

Raises:
    TypeError:
        With a human readable error message, the attribute (of type
        `attrs.Attribute`), the expected type, and the value it got.
)r~   r)   r   r   _subclass_ofr   g  r9   r   c                   s   a  ] tR tRt o ]! 4       t]! ]! R4      R7      t]! ]! ]	! ]
4      ]! ]4      R7      R7      tR tR tRtV tR	# )
_NotValidatorix  zCnot_ validator child '{validator!r}' did not raise a captured error)Z	converterrY   rE   c                s     V P                  WV4       \        V P                  P                  V P                   V P                  R 7      VV P                   VV P                  4      h  T P                   d     R# i ; i)rF   	exc_typesN)rF   r=   r$   r@   r   rG   rH   r   r&   Z_NotValidator.__call__  su    	NN4u- "nn"nn    	 	 ~~ 		s   A& &A;:A;c                r_   )z<not_ validator wrapping z, capturing r(   r   r*   r   r   r+   Z_NotValidator.__repr__  s"    *4>>*<LHZZ[\\r   r   N)r.   r/   r0   r1   r   rF   r   r$   rZ   r   	Exceptionr8   rJ   r   r&   r+   r2   r3   r4   r5   r   r   r   x  sX     I
!-
C ))4*51
I"] ]r   r   r$   r   c               sZ     \        V4      p\        WV4      #   \         d    T3p Li ; i)a  
A validator that wraps and logically 'inverts' the validator passed to it.
It will raise a `ValueError` if the provided validator *doesn't* raise a
`ValueError` or `TypeError` (by default), and will suppress the exception
if the provided validator *does*.

Intended to be used with existing validators to compose logic without
needing to create inverted variants, for example, ``not_(in_(...))``.

Args:
    validator: A validator to be logically inverted.

    msg (str):
        Message to raise if validator fails. Formatted with keys
        ``exc_types`` and ``validator``.

    exc_types (tuple[type, ...]):
        Exception type(s) to capture. Other types raised by child
        validators will not be intercepted and pass through.

Raises:
    ValueError:
        With a human readable error message, the attribute (of type
        `attrs.Attribute`), the validator that failed to raise an
        exception, the value it got, and the expected exception types.

.. versionadded:: 22.2.0
)rJ   r   r   )rF   r$   r   s   &$$r   not_r     s8    :!)$	 33  !L	!s    **c                   ro   )_OrValidatori  c                s    V P                    F  p V! WV4        R # 	  RV P                   : RV: 2p\        V4      h  \         d     K?  i ; i)NzNone of z satisfied for value )
validatorsr   r=   )r    r!   r"   r#   vr$   rO   r   r&   Z_OrValidator.__call__  s\    A$e$  ! ++@	Jo  s   	>AAc                r'   )z<or validator wrapping r(   )r   r*   r   r   r+   Z_OrValidator.__repr__  s    ((;1==r   r   N)
r.   r/   r0   r1   r   r   r&   r+   r2   r3   r4   r5   r   r   r     s     J
> >r   r   c                 s    . pV  F7  pTP                  \        V\        4      '       d   VP                  MV.4       K9  	  \        \	        V4      4      # )a  
A validator that composes multiple validators into one.

When called on a value, it runs all wrapped validators until one of them is
satisfied.

Args:
    validators (~collections.abc.Iterable[typing.Callable]):
        Arbitrary number of validators.

Raises:
    ValueError:
        If no validator is satisfied. Raised with a human-readable error
        message listing all the wrapped validators and the value that
        failed all of them.

.. versionadded:: 24.1.0
)Zextendr   r   r   rJ   )r   Zvalsr   s   *  r   or_r     sD    & DJq,$?$?ALLaSI  d$$r   )r   rZ   r`   r   rm   r   rn   rP   r8   rR   rk   rh   rB   ry   r}   r   rK   r   r   )i    NrD   )NNN)5Z__doc__rg   r?   Z
contextlibr    r   Z_configr   r   Z_maker   r   r   r   Z
convertersr   Z
exceptionsr	   Z__all__r   r   r   r   r8   r:   rB   rC   rK   rL   rP   rQ   rR   rS   rZ   r[   r`   ra   rh   rk   rm   rn   rp   ry   r{   r}   r~   r   r   r=   r   r   r   r   r   r   r   <module>r      s    	 %  ; 5 5 ' (.%$	$ ! !" E40A A 1A(&" E$d+F F ,F*-4` E40
F 
F 1
F)* E40J J 1J. /F ED1) ) 2)*"  E40
 
 1
8?4 E40r r 1r,/Kd E$d+C C ,C"3443 E$d+< < ,<
' E$d+< < ,<
' E40A A 1A(&" E40!] !] 1!]H!44 !4J	+B !4H E40> > 1>&%r   