
    hNN                     0   S r SSKrSSKrSSKJr  SSKJr  SSKJrJr  SSK	J
r
JrJrJr  SSKJr  SS	KJr  / S
QrS rS r\S 5       r\" SSSS9 " S S5      5       rS r\" SSSS9 " S S5      5       rS=S jr\" SSSS9 " S S5      5       rS r\" SSSS9 " S S5      5       rS r\" SSSS9 " S S5      5       rS  r\" SSSS9 " S! S"5      5       r S>S# jr!\" SSSS9 " S$ S%5      5       r"S>S& jr#\" SSSS9 " S' S(5      5       r$S) r%S* r&S+ r'S, r(\" SSSS9 " S- S.5      5       r)S/ r*\" SSSS9 " S0 S15      5       r+S2 r,\" SSSS9 " S3 S45      5       r-S5 r.\" SSSS9 " S6 S75      5       r/S\0\14S8.S9 jr2\" SSSS9 " S: S;5      5       r3S< r4g)?z
Commonly useful validators.
    N)contextmanager)Pattern   )get_run_validatorsset_run_validators)_AndValidatorand_attribattrs)default_if_none)NotCallableError)r	   deep_iterabledeep_mappingdisabledgeget_disabledgtin_instance_ofis_callablelelt
matches_remax_lenmin_lennot_optionalor_set_disabledc                 $    [        U (       + 5        g)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   )r   s    A/var/www/html/env/lib/python3.13/site-packages/attr/validators.pyr   r   *   s     8|$    c                       [        5       (       + $ )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"   r   r   <   s     "###r#   c               #   b   #    [        S5         Sv   [        S5        g! [        S5        f = f7f)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   / /,/FT)reprslotsunsafe_hashc                   .    \ rS rSr\" 5       rS rS rSrg)_InstanceOfValidatorZ   c           	          [        X0R                  5      (       dH  SUR                   SU R                  < SU< SUR                  < S3	n[	        UUU R                  U5      eg)@
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msgs        r"   __call___InstanceOfValidator.__call__^   sf     %++dii[
499-veYkRWRaRaQddfgC			  ,r#   c                 $    SU R                   < S3$ )Nz <instance_of validator for type >r4   r9   s    r"   __repr___InstanceOfValidator.__repr__k       1$))a@@r#   r%   N	__name__
__module____qualname____firstlineno__r
   r4   r>   rD   __static_attributes__r%   r#   r"   r+   r+   Z       8DAr#   r+   c                     [        U 5      $ )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+   rB   s    r"   r   r   o         %%r#   )r'   frozenr(   c                   <    \ rS rSr\" 5       r\" 5       rS rS rSr	g)_MatchesReValidator   c                     U R                  U5      (       dD  SUR                   SU R                  R                  < SU< S3n[        UUU R                  U5      eg)r.   r/   z' must match regex z (z	 doesn't)N)
match_funcr5   pattern
ValueErrorr8   s        r"   r>   _MatchesReValidator.__call__   s`     u%%dii[ 3DLL4H4H3K2eYV_`C	  &r#   c                 $    SU R                   < S3$ )Nz"<matches_re validator for pattern rA   )rV   rC   s    r"   rD   _MatchesReValidator.__repr__   s    3DLL3C1EEr#   r%   N)
rH   rI   rJ   rK   r
   rV   rU   r>   rD   rL   r%   r#   r"   rR   rR      s    hGJFr#   rR   c           
      &   [         R                  S[         R                  [         R                  4nX#;  aD  SR	                  SR                  [        S [        U5       5       5      5      5      n[        U5      e[        U [        5      (       a  U(       a  Sn[        U5      eU nO[         R                  " X5      nU[         R                  L a  UR                  nO,U[         R                  L a  UR                  nOUR                  n[        XV5      $ )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   \   #    U  H"  o=(       a    UR                   =(       d    S v   M$     g7f)NoneN)rH   ).0es     r"   	<genexpr>matches_re.<locals>.<genexpr>   s!     N=M(ajj3V3=Ms   *,zR'flags' can only be used with a string pattern; pass flags to re.compile() instead)re	fullmatchsearchmatchformatjoinsortedsetrW   r3   r   r7   compilerR   )regexflagsfuncvalid_funcsr=   rV   rU   s          r"   r   r      s    * <<ryy"((;K)00IINS=MNN

 o%!!fCC. **U*rxx]]
		^^
&&
w33r#   c                   .    \ rS rSr\" 5       rS rS rSrg)_OptionalValidator   c                 0    Uc  g U R                  XU5        g N	validatorr9   r:   r;   r<   s       r"   r>   _OptionalValidator.__call__   s    =t5)r#   c                 $    SU R                   < S3$ )Nz<optional validator for z	 or None>rt   rC   s    r"   rD   _OptionalValidator.__repr__   s    )$..);9EEr#   r%   N)	rH   rI   rJ   rK   r
   ru   r>   rD   rL   r%   r#   r"   rp   rp      s    I*Fr#   rp   c                 v    [        U [        [        45      (       a  [        [	        U 5      5      $ [        U 5      $ )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.
)r3   listtuplerp   r   rt   s    r"   r   r      s0     )dE]++!-	":;;i((r#   c                   :    \ rS rSr\" 5       r\" SS9rS rS rSr	g)_InValidator   F)hashc                      X0R                   ;   nU(       d:  SUR                   SU R                  < SU< S3n[	        UUU R                  U5      eg ! [         a    Sn NPf = f)NFr/   z' must be in r1   ))optionsr7   r5   _original_optionsrW   )r9   r:   r;   r<   
in_optionsr=   s         r"   r>   _InValidator.__call__   sx    	,,.J dii[d.D.D-GveYVWXC&&	    	J	s   A A! A!c                 $    SU R                   < S3$ )Nz<in_ validator with options rA   )r   rC   s    r"   rD   _InValidator.__repr__   s    -d.D.D-GqIIr#   r%   N)
rH   rI   rJ   rK   r
   r   r   r>   rD   rL   r%   r#   r"   r~   r~      s    hGE*Jr#   r~   c                 r    U n[        U [        [        [        45      (       a  [	        U 5      n [        X5      $ )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.
)r3   r{   dictri   r|   r~   )r   repr_optionss     r"   r   r     s1    8 L'D$,--...r#   c                        \ rS rSrS rS rSrg)_IsCallableValidatori$  c                     [        U5      (       d.  Sn[        UR                  UR                  X3R                  S9US9eg)r.   z?'{name}' must be callable (got {value!r} that is a {actual!r}).)r5   r<   actual)r=   r<   N)callabler   rf   r5   r6   )r9   r:   r;   r<   messages        r"   r>   _IsCallableValidator.__call__&  sN     8  #NN% #  	  r#   c                     g)Nz<is_callable validator>r%   rC   s    r"   rD   _IsCallableValidator.__repr__6  s    (r#   r%   N)rH   rI   rJ   rK   r>   rD   rL   r%   r#   r"   r   r   $  s     )r#   r   c                      [        5       $ )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.
)r   r%   r#   r"   r   r   :  s      !!r#   c                   Z    \ rS rSr\" \" 5       S9r\" S\" \" 5       5      S9rS r	S r
Srg)_DeepIterableiJ  rt   Ndefaultru   c                 x    U R                   b  U R                  XU5        U H  nU R                  XU5        M     gr.   Niterable_validatormember_validator)r9   r:   r;   r<   members        r"   r>   _DeepIterable.__call__Q  s:     "".##D6F!!$f5 r#   c                 h    U R                   c  SOSU R                   < 3nSU SU R                  < S3$ )N  z<deep_iterable validator forz iterables of rA   r   )r9   iterable_identifiers     r"   rD   _DeepIterable.__repr__[  sP     &&. T,,/0 	 ++>*?T225Q8	
r#   r%   )rH   rI   rJ   rK   r
   r   r   r   r   r>   rD   rL   r%   r#   r"   r   r   J  s0    6 76	
r#   r   c                 ^    [        U [        [        45      (       a  [        U 6 n [	        X5      $ )a  
A validator that performs deep validation of an iterable.

Args:
    member_validator: Validator to apply to iterable members.

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

Raises
    TypeError: if any sub-validators fail

.. versionadded:: 19.1.0
)r3   r{   r|   r	   r   r   r   s     r"   r   r   g  s.     "T5M22!12)>>r#   c                   p    \ rS rSr\" \" 5       S9r\" \" 5       S9r\" S\" \" 5       5      S9r	S r
S rSrg)_DeepMappingi{  rt   Nr   c                     U R                   b  U R                  XU5        U H)  nU R                  XU5        U R                  XX4   5        M+     gr   )mapping_validatorkey_validatorvalue_validator)r9   r:   r;   r<   keys        r"   r>   _DeepMapping.__call__  sL     !!-""4u5Ct3/  UZ8 r#   c                 @    SU R                   < SU R                  < S3$ )Nz,<deep_mapping validator for objects mapping z to rA   )r   r   rC   s    r"   rD   _DeepMapping.__repr__  s(    =d>P>P=SSWX\XlXlWoopqqr#   r%   )rH   rI   rJ   rK   r
   r   r   r   r   r   r>   rD   rL   r%   r#   r"   r   r   {  s9    []3M{}5Otx7NO	9rr#   r   c                     [        XU5      $ )ag  
A validator that performs deep validation of a dictionary.

Args:
    key_validator: Validator to apply to dictionary keys.

    value_validator: Validator to apply to dictionary values.

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

.. versionadded:: 19.1.0

Raises:
    TypeError: if any sub-validators fail
)r   )r   r   r   s      r"   r   r     s    " 8IJJr#   c                   J    \ rS rSr\" 5       r\" 5       r\" 5       rS rS r	Sr
g)_NumberValidatori  c                     U R                  X0R                  5      (       d7  SUR                   SU R                   SU R                   SU 3n[	        U5      eg)r.   r/   r0   r   : N)compare_funcboundr5   
compare_oprW   r8   s        r"   r>   _NumberValidator.__call__  sS       

33dii[
4??*;1TZZL5'RCS/! 4r#   c                 <    SU R                    SU R                   S3$ )Nz<Validator for x r   rA   )r   r   rC   s    r"   rD   _NumberValidator.__repr__  s     "4??"31TZZLBBr#   r%   N)rH   rI   rJ   rK   r
   r   r   r   r>   rD   rL   r%   r#   r"   r   r     s"    HEJ8L"Cr#   r   c                 8    [        U S[        R                  5      $ )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
<)r   operatorr   vals    r"   r   r          Chkk22r#   c                 8    [        U S[        R                  5      $ )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<=)r   r   r   r   s    r"   r   r          Cx{{33r#   c                 8    [        U S[        R                  5      $ )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>=)r   r   r   r   s    r"   r   r     r   r#   c                 8    [        U S[        R                  5      $ )z
A validator that raises `ValueError` if the initializer is called with a
number smaller or equal to *val*.

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

Args:
   val: Exclusive lower bound for values

.. versionadded:: 21.3.0
rA   )r   r   r   r   s    r"   r   r     r   r#   c                   .    \ rS rSr\" 5       rS rS rSrg)_MaxLengthValidatori  c                     [        U5      U R                  :  a3  SUR                   SU R                   S[        U5       3n[        U5      eg)r.   Length of 'z' must be <= r   N)len
max_lengthr5   rW   r8   s        r"   r>   _MaxLengthValidator.__call__  H     u:'		{-7H3u:,WCS/! (r#   c                 "    SU R                    S3$ )Nz<max_len validator for rA   )r   rC   s    r"   rD   _MaxLengthValidator.__repr__      ((9;;r#   r%   N)	rH   rI   rJ   rK   r
   r   r>   rD   rL   r%   r#   r"   r   r         J"<r#   r   c                     [        U 5      $ )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
)r   lengths    r"   r   r          v&&r#   c                   .    \ rS rSr\" 5       rS rS rSrg)_MinLengthValidatori  c                     [        U5      U R                  :  a3  SUR                   SU R                   S[        U5       3n[        U5      eg)r.   r   z' must be >= r   N)r   
min_lengthr5   rW   r8   s        r"   r>   _MinLengthValidator.__call__  r   r#   c                 "    SU R                    S3$ )Nz<min_len validator for rA   )r   rC   s    r"   rD   _MinLengthValidator.__repr__  r   r#   r%   N)	rH   rI   rJ   rK   r
   r   r>   rD   rL   r%   r#   r"   r   r     r   r#   r   c                     [        U 5      $ )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   r   s    r"   r   r     r   r#   c                   .    \ rS rSr\" 5       rS rS rSrg)_SubclassOfValidatori,  c                     [        X0R                  5      (       d:  SUR                   SU R                  < SU< S3n[        UUU R                  U5      eg)r.   r/   z' must be a subclass of r1   r2   N)
issubclassr4   r5   r7   r8   s        r"   r>   _SubclassOfValidator.__call__0  sY     %++dii[ 8VE9TVWC			  ,r#   c                 $    SU R                   < S3$ )Nz <subclass_of validator for type rA   rB   rC   s    r"   rD   _SubclassOfValidator.__repr__=  rF   r#   r%   NrG   r%   r#   r"   r   r   ,  rM   r#   r   c                     [        U 5      $ )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   rB   s    r"   _subclass_ofr   A  rO   r#   c                   t    \ rS rSr\" 5       r\" \" S5      S9r\" \" \	" \
5      \" \5      S9S9rS rS rSrg	)
_NotValidatoriR  zCnot_ validator child '{validator!r}' did not raise a captured error)	converterr   rt   c                      U R                  XU5        [        U R                  R                  U R                   U R                  S9UU R                   UU R                  5      e! U R                   a     g f = f)Nru   	exc_types)ru   rW   r=   rf   r   rv   s       r"   r>   _NotValidator.__call__b  su    	NN4u- "nn"nn    	 	 ~~ 		s   A# #A65A6c                 @    SU R                   < SU R                  < S3$ )Nz<not_ validator wrapping z, capturing rA   r   rC   s    r"   rD   _NotValidator.__repr__s  s"    *4>>*<LHZZ[\\r#   r%   N)rH   rI   rJ   rK   r
   ru   r   r=   r   r   	Exceptionr   r|   r   r>   rD   rL   r%   r#   r"   r   r   R  sO    I
!-
C ))4*51
I"]r#   r   )r=   r   c                X     [        U5      n[        XU5      $ ! [         a    U4n Nf = f)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
)r|   r7   r   )ru   r=   r   s      r"   r   r   w  s8    :!)$	 33  !L	!s    ))c                   .    \ rS rSr\" 5       rS rS rSrg)_OrValidatori  c                     U R                    H  n U" XU5          g    SU R                   < SU< 3n[        U5      e! [         a     M=  f = f)NzNone of z satisfied for value )
validatorsr   rW   )r9   r:   r;   r<   vr=   s         r"   r>   _OrValidator.__call__  s\    A$e$  ! ++@	Jo  s   	=
A
Ac                 $    SU R                   < S3$ )Nz<or validator wrapping rA   )r   rC   s    r"   rD   _OrValidator.__repr__  s    ((;1==r#   r%   N)	rH   rI   rJ   rK   r
   r   r>   rD   rL   r%   r#   r"   r   r     s    J
>r#   r   c                      / nU  H6  nUR                  [        U[        5      (       a  UR                  OU/5        M8     [        [	        U5      5      $ )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
)extendr3   r   r   r|   )r   valsr   s      r"   r   r     sD    & DJq,$?$?ALLaSI  d$$r#   )r   Nrs   )5__doc__r   rb   
contextlibr   r   _configr   r   _maker   r	   r
   r   
convertersr   
exceptionsr   __all__r   r   r   r+   r   rR   r   rp   r   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rW   r7   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?( E40r r 1r(K( 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  J	+B !4H E40> > 1>&%r#   