+
    TŎiS                        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                &    \        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   )disableds   &^/Users/ahmad/.openclaw/workspace/scripts/.venv/lib/python3.14/site-packages/attr/validators.pyset_disabledr   *   s     8|$    c                      \        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               #  d   "   \        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slotsunsafe_hashc                   :   a  ] tR t^Zt o ]! 4       tR tR tRtV t	R# )_InstanceOfValidatorc           	         \        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msgs   &&&& r   __call___InstanceOfValidator.__call__^   sf     %++dii[
499-veYkRWRaRaQddfgC			  ,r   c                $    R V P                   : R2# )z <instance_of validator for type >r"   r'   s   &r   __repr___InstanceOfValidator.__repr__k       1$))a@@r   r   N
__name__
__module____qualname____firstlineno__r   r"   r,   r2   __static_attributes____classdictcell____classdict__s   @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   r0   s   &r   instance_ofr@   o         %%r   )r   frozenr   c                   H   a  ] tR t^t o ]! 4       t]! 4       tR tR tRt	V t
R# )_MatchesReValidatorc                    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&   s   &&&& r   r,   _MatchesReValidator.__call__   s`     u%%dii[ 3DLL4H4H3K2eYV_`C	  &r   c                $    R V P                   : R2# )z"<matches_re validator for pattern r/   )rG   r1   s   &r   r2   _MatchesReValidator.__repr__   s    3DLL3C1EEr   r   N)r6   r7   r8   r9   r   rG   rF   r,   r2   r:   r;   r<   s   @r   rD   rD      s$     hGJF Fr   rD   c           
     0   \         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   `   "   T F$  q;'       d    VP                   ;'       g    R x  K&  	  R# 5i)NoneN)r6   ).0es   & r   	<genexpr>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)re	fullmatchsearchmatchformatjoinsortedsetrH   r!   r   r%   compilerD   )regexflagsfuncvalid_funcsr+   rG   rF   s   &&&    r   
matches_rer`      s    * <<ryy"((;K)00IINS=MNN

 o%!!fCC. **U*rxx]]
		^^
&&
w33r   c                   :   a  ] tR t^t o ]! 4       tR tR tRtV t	R# )_OptionalValidatorc                6    Vf   R # V P                  WV4       R # N	validatorr'   r(   r)   r*   s   &&&&r   r,   _OptionalValidator.__call__   s    =t5)r   c                $    R V P                   : R2# )z<optional validator for z	 or None>re   r1   s   &r   r2   _OptionalValidator.__repr__   s    )$..);9EEr   r   N)
r6   r7   r8   r9   r   rf   r,   r2   r:   r;   r<   s   @r   rb   rb      s     I*F Fr   rb   c                x    \        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tuplerb   r   re   s   &r   optionalrn      s0     )dE]++!-	":;;i((r   c                   L   a  ] tR t^t o ]! 4       t]! RR7      tR tR tRt	V t
R# )_InValidatorF)hashc                     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   )N)optionsr%   r#   _original_optionsrH   )r'   r(   r)   r*   
in_optionsr+   s   &&&&  r   r,   _InValidator.__call__   sx    	,,.J dii[d.D.D-GveYVWXC&&	    	J	s   A A$#A$c                $    R V P                   : R2# )z<in_ validator with options r/   )ru   r1   s   &r   r2   _InValidator.__repr__   s    -d.D.D-GqIIr   r   N)r6   r7   r8   r9   r   rt   ru   r,   r2   r:   r;   r<   s   @r   rp   rp      s(     hGE*J Jr   rp   c                t    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!   rl   dictrZ   rm   rp   )rt   repr_optionss   & r   in_r}     s1    8 L'D$,--...r   c                   ,   a  ] tR tRt o R tR tRtV tR# )_IsCallableValidatori$  c                    \        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*   actual)r+   r*   N)callabler   rW   r#   r$   )r'   r(   r)   r*   messages   &&&& r   r,   _IsCallableValidator.__call__&  sN     8  #NN% #  	  r   c                    R # )z<is_callable validator>r   r1   s   &r   r2   _IsCallableValidator.__repr__6  s    (r   r   N)r6   r7   r8   r9   r,   r2   r:   r;   r<   s   @r   r   r   $  s      ) )r   r   c                     \        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.
)r   r   r   r   is_callabler   :  s      !!r   c                   r   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)defaultrf   c                |    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*   members   &&&& r   r,   _DeepIterable.__call__Q  s:     "".##D6F!!$f5 r   c                j    V P                   f   RMRV P                   : 2pRV RV P                  : R2# )N  z<deep_iterable validator forz iterables of r/   r   )r'   iterable_identifiers   & r   r2   _DeepIterable.__repr__[  sP     &&. T,,/0 	 ++>*?T225Q8	
r   r   )r6   r7   r8   r9   r   r   r   rn   r   r,   r2   r:   r;   r<   s   @r   r   r   J  s8     6 76	
 	
r   r   c                    \        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!   rl   rm   r   r   r   r   s   &&r   deep_iterabler   g  sL    & "T5M22!12$tUm44!#56)>>r   c                      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                    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# r   )mapping_validatorkey_validatorvalue_validator)r'   r(   r)   r*   keys   &&&& r   r,   _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   r1   s   &r   r2   _DeepMapping.__repr__  s(    =d>P>P=SSWX\XlXlWoopqqr   r   N)r6   r7   r8   r9   r   rn   r   r   r   r   r,   r2   r:   r;   r<   s   @r   r   r     sJ     Xkm%<=Mx'>?O+-)@A=r rr   r   c                "   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)rH   r!   rl   rm   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                   V   a  ] tR tRt o ]! 4       t]! 4       t]! 4       tR tR t	Rt
V tR# )_NumberValidatori  c                    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   r   : N)compare_funcboundr#   
compare_oprH   r&   s   &&&& r   r,   _NumberValidator.__call__  sS       

33dii[
4??*;1TZZL5'RCS/! 4r   c                <    R V P                    RV P                   R2# )z<Validator for x r   r/   )r   r   r1   s   &r   r2   _NumberValidator.__repr__  s     "4??"31TZZLBBr   r   N)r6   r7   r8   r9   r   r   r   r   r,   r2   r:   r;   r<   s   @r   r   r     s+     HEJ8L"C Cr   r   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
<)r   operatorltvals   &r   r   r          Chkk22r   c                8    \        V R\        P                  4      # )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   ler   s   &r   r   r          Cx{{33r   c                8    \        V R\        P                  4      # )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   ger   s   &r   r   r     r   r   c                8    \        V R\        P                  4      # )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/   )r   r   gtr   s   &r   r   r   	  r   r   c                   :   a  ] tR tRt o ]! 4       tR tR tRtV t	R# )_MaxLengthValidatori  c                    \        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 <= r   N)len
max_lengthr#   rH   r&   s   &&&& r   r,   _MaxLengthValidator.__call__  H     u:'		{-7H3u:,WCS/! (r   c                "    R V P                    R2# )z<max_len validator for r/   )r   r1   s   &r   r2   _MaxLengthValidator.__repr__$      ((9;;r   r   N)
r6   r7   r8   r9   r   r   r,   r2   r:   r;   r<   s   @r   r   r          J"< <r   r   c                    \        V 4      # )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   max_lenr   (       v&&r   c                   :   a  ] tR tRt o ]! 4       tR tR tRtV t	R# )_MinLengthValidatori5  c                    \        V4      V P                  8  d4   RVP                   RV P                   R\        V4       2p\        V4      hR# )r   r   z' must be >= r   N)r   
min_lengthr#   rH   r&   s   &&&& r   r,   _MinLengthValidator.__call__9  r   r   c                "    R V P                    R2# )z<min_len validator for r/   )r   r1   s   &r   r2   _MinLengthValidator.__repr__A  r   r   r   N)
r6   r7   r8   r9   r   r   r,   r2   r:   r;   r<   s   @r   r   r   5  r   r   r   c                    \        V 4      # )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   min_lenr   E  r   r   c                   :   a  ] tR tRt o ]! 4       tR tR tRtV t	R# )_SubclassOfValidatoriR  c                    \        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)
issubclassr"   r#   r%   r&   s   &&&& r   r,   _SubclassOfValidator.__call__V  sY     %++dii[ 8VE9TVWC			  ,r   c                $    R V P                   : R2# )z <subclass_of validator for type r/   r0   r1   s   &r   r2   _SubclassOfValidator.__repr__c  r4   r   r   Nr5   r<   s   @r   r   r   R  r>   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
`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   r0   s   &r   _subclass_ofr   g  rA   r   c                      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)	converterr   re   c                     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   rH   r+   rW   r   rg   s   &&&&r   r,   _NotValidator.__call__  su    	NN4u- "nn"nn    	 	 ~~ 		s   A& &A;:A;c                @    R V P                   : RV P                  : R2# )z<not_ validator wrapping z, capturing r/   r   r1   s   &r   r2   _NotValidator.__repr__  s"    *4>>*<LHZZ[\\r   r   N)r6   r7   r8   r9   r   rf   r
   r+   r   r   	Exceptionr@   rm   r   r,   r2   r:   r;   r<   s   @r   r   r   x  sX     I
!-
C ))4*51
I"] ]r   r   r+   r   c               Z     \        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
)rm   r%   r   )rf   r+   r   s   &$$r   not_r     s8    :!)$	 33  !L	!s    **c                   :   a  ] tR tRt o ]! 4       tR tR tRtV t	R# )_OrValidatori  c                    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   rH   )r'   r(   r)   r*   vr+   s   &&&&  r   r,   _OrValidator.__call__  s\    A$e$  ! ++@	Jo  s   	>AAc                $    R V P                   : R2# )z<or validator wrapping r/   )r   r1   s   &r   r2   _OrValidator.__repr__  s    ((;1==r   r   N)
r6   r7   r8   r9   r   r   r,   r2   r:   r;   r<   s   @r   r   r     s     J
> >r   r   c                     . 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
)extendr!   r   r   rm   )r   valsr   s   *  r   or_r     sD    & DJq,$?$?ALLaSI  d$$r   )r   r   r   r   r   r   r   r}   r@   r   r   r   r`   r   r   r   rn   r   r   )    Nrd   )NNN)5__doc__r   rS   
contextlibr   r   _configr   r   _maker   r   r   r	   
convertersr
   
exceptionsr   __all__r   r   r   r   r@   rD   r`   rb   rn   rp   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rH   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   