+
    i(>                      a  0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
HtHtHt ^ RIHtHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHtHtHtH t H!t!H"t" ^ RI#H$t$H%t%H&t&H't'H(t( ^ RI)H*t* ^ RI+H,t,H-t-H.t. ^ RI/H0t0 ^RI1H2t2H3t3 ^RI4H5t5 ]$'       dC   ]]6]%3,          ]]7]%3,          ,          t8R]9R&   ]]6,          ]]7,          ,          t:R]9R&   ^RI;H<t< ]6]=]>]7]?]@]A]3P                  ]]]!]	P                  ]]"]DP                  ]FP                  0tGR]9R&   ]H]I]J]K]L]]]0tMR]9R&   R R ltNR R ltOR R ltPR R ltQR  R! ltRR" R# ltS]'! R$4      tTR% R& ltUR' R( ltV]'! R)4      tWR*]7/R+ R, lltX ! R- R.]2P                  4      tZ]$'       d   R/ R0 lt[M
 ! R1 R24      t[]'! R34      t\R4 R5 lt]]^! 4       t_R6 R7 lt`R8 R9 lta]P                  ! R:R;7       ! R< R=4      4       tc]'! R>R?R@7      td]'! RA4      te ! RB RC]&]d]e3,          4      tfR# )DzBucket of reusable internal utilities.

This should be reduced as much as possible with functions only used in one place, moved to that place.
)annotationsN)OrderedDictdefaultdictdeque)CallableIterableMapping)Set)deepcopy)cached_property)	Parameter)zip_longest)BuiltinFunctionTypeCodeTypeFunctionTypeGeneratorType
LambdaType
ModuleType)TYPE_CHECKINGAnyGenericTypeVaroverload)MISSING)	TypeAlias	TypeGuard
deprecated)PydanticDeprecatedSince211)_repr_typing_extra)import_cached_base_modelr   MappingIntStrAnyAbstractSetIntStr)	BaseModelzset[type[Any]]IMMUTABLE_NON_COLLECTIONS_TYPESBUILTIN_COLLECTIONSc                    V ^8  d   QhRRRR/# )   paramr   returnbool )formats   "`/home/wkmabra/.openclaw/workspace/venv/lib/python3.14/site-packages/pydantic/_internal/_utils.py__annotate__r.   J   s     V VY V4 V    c                \    V P                   \        P                  \        P                  39   # )a*  Return whether the parameter accepts a positional argument.

```python {test="skip" lint="skip"}
def func(a, /, b, *, c):
    pass

params = inspect.signature(func).parameters
can_be_positional(params['a'])
#> True
can_be_positional(params['b'])
#> True
can_be_positional(params['c'])
#> False
```
)kindr   POSITIONAL_ONLYPOSITIONAL_OR_KEYWORD)r(   s   &r-   can_be_positionalr4   J   s$      ::)33Y5T5TUUUr/   c                    V ^8  d   QhRRRR/# r'   vr   r)   r*   r+   )r,   s   "r-   r.   r.   ]   s     N NS NT Nr/   c           	     V    \        V \        \        \        \        \
        \        34      # N)
isinstancelisttupleset	frozensetr   r   r7   s   &r-   sequence_liker@   ]   s    a$sI}eLMMr/   c               $    V ^8  d   QhRRRRRR/# )r'   or   class_or_tuplez(type[Any] | tuple[type[Any], ...] | Noner)   r*   r+   )r,   s   "r-   r.   r.   a   s#      # /W \` r/   c                >     \        W4      #   \         d     R # i ; iF)r:   	TypeError)rB   rC   s   &&r-   lenient_isinstancerG   a   s$    !,, s   
 c               $    V ^8  d   QhRRRRRR/# )r'   clsr   rC   r)   r*   r+   )r,   s   "r-   r.   r.   h   s!      C   r/   c                     \        V \        4      ;'       d    \        W4      #   \         d&    \        T \        P
                  4      '       d    R # h i ; irE   )r:   type
issubclassrF   r   WithArgsTypes)rI   rC   s   &&r-   lenient_issubclassrN   h   sI    #t$HHC)HH c=6677s   % % +AAc                    V ^8  d   QhRRRR/# )r'   rI   r   r)   zTypeGuard[type[BaseModel]]r+   )r,   s   "r-   r.   r.   q   s     G G G : Gr/   c                B    \        4       p\        W4      ;'       d    WJ# )zReturns true if cls is a _proper_ subclass of BaseModel, and provides proper type-checking,
unlike raw calls to lenient_issubclass.
)r    rN   )rI   r#   s   & r-   is_model_classrQ   q   s"     )*Ic-FF#2FFr/   c                    V ^8  d   QhRRRR/# )r'   
identifierstrr)   r*   r+   )r,   s   "r-   r.   r.   z   s     K KC KD Kr/   c                h    V P                  4       ;'       d    \        P                  ! V 4      '       * # )zChecks that a string is a valid identifier and not a Python keyword.
:param identifier: The identifier to test.
:return: True if the identifier is valid.
)isidentifierkeyword	iskeyword)rS   s   &r-   is_valid_identifierrY   z   s)    
 ""$JJW->->z-J)JJr/   KeyTypec               $    V ^8  d   QhRRRRRR/# )r'   mappingzdict[KeyType, Any]updating_mappingsr)   r+   )r,   s   "r-   r.   r.      s$      + AS Xj r/   c                   V P                  4       pV Fn  pVP                  4        FW  w  rEWB9   dI   \        W$,          \        4      '       d-   \        V\        4      '       d   \	        W$,          V4      W$&   KS  WRV&   KY  	  Kp  	  V# r9   )copyitemsr:   dictdeep_update)r\   r]   updated_mappingupdating_mappingkr7   s   &*    r-   rb   rb      ss    llnO-$**,DA#
?3Et(L(LQ[\]_cQdQd%01CQ%G"%&"	 - . r/   c               $    V ^8  d   QhRRRRRR/# )r'   r\   zdict[Any, Any]updater   r)   Noner+   )r,   s   "r-   r.   r.      s&     G G^ Gs Gt Gr/   c                    T P                  VP                  4        UUu/ uF  w  r#Vf   K  W#bK  	  upp4       R # u uppi r9   )rg   r`   )r\   rg   re   r7   s   &,  r-   update_not_nonerj      s.    NNV\\^E^TQqDAD^EFEs   <
<
Tname_factoryc               $    V ^8  d   QhRRRRRR/# )r'   
input_listzlist[T] | tuple[T, ...]rl   zCallable[[T], str]r)   zlist[T]r+   )r,   s   "r-   r.   r.      s(      ' % 	r/   c                   . p. pV  FH  pV! V4      pWS9  d%   VP                  V4       VP                  V4       K5  WBVP                  V4      &   KJ  	  V# )zMake a list unique while maintaining order.
We update the list if another one with the same name is set
(e.g. model validator overridden in subclass).
)appendindex)rn   rl   resultresult_namesr7   v_names   &$    r-   unique_listru      s[     F La%'MM!12<%%f-.  Mr/   c                      ] tR t^tRtRtR R ltR R ltR R ltR R	 lt	R
 R lt
]RR R ll4       t]R R l4       t]R R l4       t]R R l4       tR R ltRtR# )
ValueItemszOClass for more convenient calculation of excluded or included fields on values.c               $    V ^8  d   QhRRRRRR/# )r'   valuer   r`   $AbstractSetIntStr | MappingIntStrAnyr)   rh   r+   )r,   s   "r-   r.   ValueItems.__annotate__   s#     . .c .*N .SW .r/   c                	    V P                  V4      p\        V\        \        34      '       d   V P	                  V\        V4      4      pW n        R # r9   )_coerce_itemsr:   r;   r<   _normalize_indexeslen_items)selfry   r`   s   &&&r-   __init__ValueItems.__init__   s>    ""5)edE]++++E3u:>E(-r/   c                    V ^8  d   QhRRRR/# r'   itemr   r)   r*   r+   )r,   s   "r-   r.   r{      s     3 3 3 3r/   c                V    V P                  V P                  P                  V4      4      # )zGCheck if item is fully excluded.

:param item: key or index of a value
)is_truer   getr   r   s   &&r-   is_excludedValueItems.is_excluded   s     
 ||DKKOOD122r/   c                    V ^8  d   QhRRRR/# r   r+   )r,   s   "r-   r.   r{      s     # # # #r/   c                    WP                   9   # )zPCheck if value is contained in self._items.

:param item: key or index of value
r   r   s   &&r-   is_includedValueItems.is_included   s    
 {{""r/   c                    V ^8  d   QhRRRR/# )r'   ez	int | strr)   z+AbstractSetIntStr | MappingIntStrAny | Noner+   )r,   s   "r-   r.   r{      s     8 8Y 8+V 8r/   c                n    V P                   P                  V4      pV P                  V4      '       g   V# R# )z}:param e: key or index of element on value
:return: raw values for element if self._items is dict and contain needed element
N)r   r   r   )r   r   r   s   && r-   for_elementValueItems.for_element   s/     {{q!<<--t747r/   c               $    V ^8  d   QhRRRRRR/# )r'   r`   r!   v_lengthintr)   zdict[int | str, Any]r+   )r,   s   "r-   r.   r{      s#     #  # (8 # C # L` # r/   c                   / pRpVP                  4        F  w  rV\        V\        4      '       gI   \        V\        4      '       g3   V P	                  V4      '       g   \        RV RVP                   24      hVR8X  d   V P                  V4      pK}  \        V\        4      '       g   \        R4      hV^ 8  d	   W%,           MTpV P                  WcP                  V4      4      W7&   K  	  V'       g   V# V P	                  V4      '       d'   \        V4       F  pVP                  VR4       K  	  V# \        V4       FA  pVP                  V/ 4      pV P	                  V4      '       d   K.  V P                  WH4      W5&   KC  	  V# )a-  :param items: dict or set of indexes which will be normalized
:param v_length: length of sequence indexes of which will be

>>> self._normalize_indexes({0: True, -2: True, -1: True}, 4)
{0: True, 2: True, 3: True}
>>> self._normalize_indexes({'__all__': True}, 4)
{0: True, 1: True, 2: True, 3: True}
Nz,Unexpected type of exclude value for index "z" __all__zExcluding fields from a sequence of sub-models or dicts must be performed index-wise: expected integer keys or keyword "__all__".)r`   r:   r   AbstractSetr   rF   	__class___coerce_valuer   merger   range
setdefault)	r   r`   r   normalized_items	all_itemsir7   normalized_inormalized_items	   &&&      r-   r~   ValueItems._normalize_indexes   sY    24	KKMDAq'**jK.H.HDLLYZOO"NqcQSTUT_T_S` abbI~ ..q1	a%%A  ,-q58<aL-1ZZ;O;OP\;]-^* " ##<<	""8_ ++As3 %##xA.99!R@O<<00&*jj&L # !  r/   c               (    V ^8  d   QhRRRRRRRR/# )r'   baser   override	intersectr*   r)   r+   )r,   s   "r-   r.   r{      s(     # # # # # #r/   c                Z   V P                  V4      pV P                  V4      pVf   V# V P                  V4      '       g   Vf   V# V P                  V4      '       d   V'       d   V# T# V'       d;   V Uu. uF  qDV9   g   K  VNK  	  upV Uu. uF  qDV9   g   K  VNK  	  up,           pM*\        V4      V Uu. uF  qDV9  g   K  VNK  	  up,           p/ pV F?  pV P                  VP	                  V4      VP	                  V4      VR7      pVf   K;  WvV&   KA  	  V# u upi u upi u upi )a   Merge a `base` item with an `override` item.

Both `base` and `override` are converted to dictionaries if possible.
Sets are converted to dictionaries with the sets entries as keys and
Ellipsis as values.

Each key-value pair existing in `base` is merged with `override`,
while the rest of the key-value pairs are updated recursively with this function.

Merging takes place based on the "union" of keys if `intersect` is
set to `False` (default) and on the intersection of keys if
`intersect` is set to `True`.
)r   )r   r   r;   r   r   )rI   r   r   r   re   
merge_keysmergedmerged_items   &&&&    r-   r   ValueItems.merge   s    $$X.  &K;;tO;;x  $42(2 %);T(]!!T;(>`(Q[_V_qq(>``Jd(&L(Qtmqq(&LLJ')A))DHHQKaI)VK&'q	 
  <>`&Ls$   5DDD#D#9D(D(c                    V ^8  d   QhRRRR/# )r'   r`   rz   r)   r!   r+   )r,   s   "r-   r.   r{     s      A FV r/   c                	    \        V \        4      '       d    V # \        V \        4      '       d   \        P	                  V R 4      p V # \        V RR4      p\        RV 24      h).r   z???z!Unexpected type of exclude value )r:   r   r   ra   fromkeysgetattrrF   )r`   
class_names   & r-   r}   ValueItems._coerce_items  sb    eW%%  {++MM%-E  !U;J?
|LMMr/   c                    V ^8  d   QhRRRR/# )r'   ry   r   r)   r+   )r,   s   "r-   r.   r{   &  s     ( (# (# (r/   c                	^    Ve   V P                  V4      '       d   V# V P                  V4      # r9   )r   r}   )rI   ry   s   &&r-   r   ValueItems._coerce_value%  s+    =CKK..L  ''r/   c                    V ^8  d   QhRRRR/# r6   r+   )r,   s   "r-   r.   r{   ,  s     % %3 %4 %r/   c                	"    V R J ;'       g    V RJ # )T.r+   r?   s   &r-   r   ValueItems.is_true+  s    Dy$$AH$r/   c                   V ^8  d   QhRR/# )r'   r)   z_repr.ReprArgsr+   )r,   s   "r-   r.   r{   /  s     % %~ %r/   c                	     R V P                   3.# r9   r   r   s   &r-   __repr_args__ValueItems.__repr_args__/  s    t{{#$$r/   r   N)r   _typerE   )__name__
__module____qualname____firstlineno____doc__	__slots__r   r   r   r   r~   classmethodr   staticmethodr}   r   r   r   __static_attributes__r+   r/   r-   rw   rw      s    Y#I.3#8# J # #J   ( (
 % %% %r/   rw   c               $    V ^8  d   QhRRRRRR/# )r'   namerT   	get_valuezCallable[[], T]r)   rk   r+   )r,   s   "r-   r.   r.   5  s    KKKKQKr/   c                    R # r9   r+   r   r   s   &&r-   LazyClassAttributer   5  s    r/   c                  H    ] tR tRtRtR R lt]R R l4       tR R ltR	t	R
# )r   i9  zA descriptor exposing an attribute only accessible on a class (hidden from instances).

The attribute is lazily computed and cached during the first access.
c               $    V ^8  d   QhRRRRRR/# )r'   r   rT   r   zCallable[[], Any]r)   rh   r+   )r,   s   "r-   r.   LazyClassAttribute.__annotate__?  s"     	' 	' 	'1B 	't 	'r/   c                	    Wn         W n        R # r9   r   )r   r   r   s   &&&r-   r   LazyClassAttribute.__init__?  s    I&Nr/   c                   V ^8  d   QhRR/# )r'   r)   r   r+   )r,   s   "r-   r.   r   D  s     	$ 	$3 	$r/   c                	"    V P                  4       # r9   )r   r   s   &r-   ry   LazyClassAttribute.valueC  s    >>##r/   c               $    V ^8  d   QhRRRRRR/# )r'   instancer   ownerz	type[Any]r)   rh   r+   )r,   s   "r-   r.   r   G  s&     	a 	aC 	a	 	ad 	ar/   c                	p    Vf   V P                   # \        V P                  : RVP                  : R24      h)Nz attribute of z is class-only)ry   AttributeErrorr   r   )r   r   r   s   &&&r-   __get__LazyClassAttribute.__get__G  s4    zz! DII=u~~>PP^!_``r/   )r   r   N)
r   r   r   r   r   r   r   ry   r   r   r+   r/   r-   r   r   9  s,    	
	' 
	$ 
	$	a 	ar/   r   Objc                    V ^8  d   QhRRRR/# )r'   objr   r)   r+   )r,   s   "r-   r.   r.   P  s        r/   c                    V \         J d   V # V P                  pV\        9   d   V #  V '       g(   V\        9   d   V\        J d   V # V P                  4       # \        T 4      #   \        \        \        3 d     L#i ; i)zReturn type as is for immutable built-in types
Use obj.copy() for built-in empty collections
Use copy.deepcopy() for non-empty collections and unknown objects.
)
r   r   r$   r%   r<   r_   rF   
ValueErrorRuntimeErrorr
   )r   obj_types   & r-   smart_deepcopyr   P  sv    
 g~
}}H22
x#66"e+3;;
 C=	 z<0 s   A! A! A! !A:9A:c               $    V ^8  d   QhRRRRRR/# )r'   leftzIterable[Any]rightr)   r*   r+   )r,   s   "r-   r.   r.   h  s!       m  r/   c                J    \        W\        R7       F  w  r#W#Jg   K   R# 	  R# )zCheck that the items of `left` are the same objects as those in `right`.

>>> a, b = object(), object()
>>> all_identical([a, b, a], [a, b, a])
True
>>> all_identical([a, b, [a]], [a, b, [a]])  # new list object, while "equal" is not "identical"
False
)	fillvalueFT)r   	_SENTINEL)r   r   	left_item
right_items   &&  r-   all_identicalr   h  s'     "-TI!N	& "O r/   c               $    V ^8  d   QhRRRRRR/# )r'   ar   br)   r+   )r,   s   "r-   r.   r.   w  s!     % %# %# %# %r/   c                    V e   V # T# )zTReturn the first argument if it is not `None`, otherwise return the second argument.r+   )r   r   s   &&r-   get_first_not_noner   w  s    1$1$r/   T)frozenc                  Z    ] tR tRt$ RtRtR]R&   R R lt]'       d   R R lt	R	t
R
# R	t
R
# )SafeGetItemProxyi|  zWrapper redirecting `__getitem__` to `get` with a sentinel value as default

This makes is safe to use in `operator.itemgetter` when some keys may be missing
wrappedzMapping[str, Any]c                    V ^8  d   QhRRRR/# )r'   keyrT   r)   r   r+   )r,   s   "r-   r.   SafeGetItemProxy.__annotate__  s     0 0s 0# 0r/   c               	B    V P                   P                  V\        4      # r9   )r   r   r   r   r   s   ""r-   __getitem__SafeGetItemProxy.__getitem__  s    ||Y//r/   c                    V ^8  d   QhRRRR/# )r'   r   rT   r)   r*   r+   )r,   s   "r-   r.   r     s     	2 	2C 	2t 	2r/   c               	8    V P                   P                  V4      # r9   )r   __contains__r   s   ""r-   r  SafeGetItemProxy.__contains__  s    <<,,S11r/   r+   N)r   )r   r   r   r   r   r   __annotations__r   r   r  r   r+   r/   r-   r   r   |  s-     I0 	2 	2 r/   r   _ModelTr#   )bound_RTc                  x    ] tR tRtRtR R lt]R R l4       t]]! RRR	7      R
 R l4       4       tR R ltRt	R# )deprecated_instance_propertyi  a  A decorator exposing the decorated class method as a property, with a warning on instance access.

This decorator takes a class method defined on the `BaseModel` class and transforms it into
an attribute. The attribute can be accessed on both the class and instances of the class. If accessed
via an instance, a deprecation warning is emitted stating that instance access will be removed in V3.
c                    V ^8  d   QhRRRR/# )r'   fgetzCallable[[type[_ModelT]], _RT]r)   rh   r+   )r,   s   "r-   r.   )deprecated_instance_property.__annotate__  s      ; 4 r/   c               	    Wn         R # r9   r  )r   r  s   ""r-   r   %deprecated_instance_property.__init__  s    	r/   c               $    V ^8  d   QhRRRRRR/# )r'   r   rh   objtypetype[_ModelT]r)   r	  r+   )r,   s   "r-   r.   r    s    III}IIr/   c                	    R # r9   r+   r   r   r  s   &&&r-   r   $deprecated_instance_property.__get__  s    FIr/   zAccessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class.N)categoryc               $    V ^8  d   QhRRRRRR/# )r'   r   r  r  r  r)   r	  r+   )r,   s   "r-   r.   r    s    LLL-LCLr/   c                	    R # r9   r+   r  s   &&&r-   r   r    s	     JMr/   c               $    V ^8  d   QhRRRRRR/# )r'   r   z_ModelT | Noner  r  r)   r	  r+   )r,   s   "r-   r.   r    s!     6 6 6 63 6r/   c                	$   Ven   \         P                  R8  d   V P                  P                  MV P                  P                  P                  p\
        P                  ! RV: R2\        ^R7       V P                  P                  W4      ! 4       # )NzAccessing the zi attribute on the instance is deprecated. Instead, you should access this attribute from the model class.)r  
stacklevel)   
   )	sysversion_infor  r   __func__warningswarnr   r   )r   r   r  	attr_names   &&& r-   r   r    s     ##w. 		""YY''00  MM  .R R3	 yy  355r/   r  )
r   r   r   r   r   r   r   r   r   r   r+   r/   r-   r  r    sP     I I	J
 M  M6 6r/   r  )g__conditional_annotations__r   
__future__r   _annotationsdataclassesrW   r   r#  weakrefcollectionsr   r   r   collections.abcr   r   r   r	   r   r_   r
   	functoolsr   inspectr   	itertoolsr   typesr   r   r   r   r   r   typingr   r   r   r   r   pydantic_corer   typing_extensionsr   r   r   pydanticr    r   r   _import_utilsr    r   rT   r!   r  r"   mainr#   floatcomplexr*   bytesrK   NoneTyperefNotImplementedr   Ellipsisr$   r;   r=   r<   r>   ra   r%   r4   r@   rG   rN   rQ   rY   rZ   rb   rj   rk   ru   Representationrw   r   r   r   objectr   r   r   	dataclassr   r  r	  r  )r&  s   @r-   <module>rB     s  
 3   
   7 7 7 7 .  %  ! d d A A ! > > / " 3")#s("3gc3h6G"GiG#.s#3k#6F#FyF 
 		KK '3  0 				' ^ 	V&NGK )
G CL (+,C%%% C%L Ka a( en* H	%
 d#2 2 $22 );
/en$677C<#8 $6r/   