+
    7*iE  c                   s  a  R t?0 t ^ RIt^ RIt^ RIt^ RIHtHtHtHtHtH	t	H
t
HtHtHtHtHtHtHtHt ^ RIHtHt ^ RIHtHt ^ RIHt ^ RIHt ^ RIHtH t  ^ RI!H"t" ^ R	I#H$t$H%t%H&t&H't'H(t( ^ R
I)H*t*H+t+ ]PX                  R8  d   ^ RIH-t- ]PX                  R8  d   ^ RIHt ]! RRR7      t.]t/]]],          ]]]R3,          3,          t0]]/]],          3,          t1]PX                  R8  d&   ]]0]],          3,          t2]]],          ]13,          t3M]t2]t3]2! 4       t4]3! 4       t5 ! R R]4      t6R R lt7R R lt8/ Ps                  4       Pt                  t;] ^ k R R lt<R R lt=R R lt>R# ) i    N)TYPE_CHECKINGAnyClassVarDict
ForwardRefGenericIteratorListMappingOptionalTupleTypeTypeVarUnioncast)WeakKeyDictionaryWeakValueDictionary)	AnnotatedLiteral)gather_all_validators)DeferredType)	BaseModelcreate_model)JsonWrapper)display_as_typeget_all_type_hintsget_args
get_origintyping_base)all_identicallenient_issubclass)_UnionGenericAlias)r   GenericModelTGenericModel)Zbound.c                   s   a a ] tR t^@t o 0 oR	tRt]'       d   S^ k V 3R lR lt]V 3R lR l4       t	]V 3R lR l4       t
V V3R ltR	tV tR
# )r!   Fc                s   < V ^8  d   QhRS[ S[,          RS[S[ S[,          S[S[ S[,          R3,          3,          RS[ S[,          /#    clsparams.return)r   r    r   r   r
   format__classdict__   "9/usr/lib/python3.14/site-packages/pydantic/v1/generics.py__annotate__GenericModel.__annotate__K   sS     ] ]tM2 ]E$s)USWX[S\^aSaMbBb<c ]hlmphq ]    c                s  a  R V 3R llp\         P                  V! V4      4      pVe   V# S P                  '       d!   \        S P                  9  d   \        R4      h\        V\        4      '       g   V3pS \        J dF   \        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d   \        R4      h\        S R	4      '       g   \        R
S P                   R24      h\        S V4       \        \        S P                  V4      4      p\!        VP#                  4       VP%                  4       4      '       d   V'       d   S # S P'                  V4      p\)        S 4      p\+        S 4      P-                  4       pV UU	u/ uF  w  r\/        V	4      \0        Jg   K  WbK  	  p
pp	V
 Uu/ uF=  qS P2                  9   g   K  V\5        4       S P2                  V,          P6                  3bK?  	  pp\9        4       w  r\;        \<        \        ,          \?        V3RT;'       g    S P@                  RS 3\        S PC                  V4      4      ,           RRRVRR/VB 4      pV\D        V&   V'       dR   RpTp\F        PH                  VP@                  ,          PJ                  pWJd   VPM                  VV4      pVR,          pK"  S PN                  Vn'        \        \Q        VP%                  4       4       Uu/ uF  pVRbK  	  up4      pV'       * Vn        V'       d   VVn        V\         V! V4      &   \S        V4      ^8X  d   V\         V! V^ ,          4      &   \U        WW4       V# u up	pi u upi u upi )a  Instantiates a new class from a generic class `cls` and type variables `params`.

:param params: Tuple of types the class . Given a generic class
    `Model` with 2 type variables and a concrete model `Model[str, int]`,
    the value `(str, int)` would be passed to `params`.
:return: New model class inheriting from `cls` with instantiated
    types described by `params`. If no parameters are given, `cls` is
    returned as is.

c                s0    V ^8  d   QhR\         R\        /# )r#   _paramsr&   )r   CacheKeyr(      "r+   r,   Z4GenericModel.__class_getitem__.<locals>.__annotate__W   s     	& 	& 	& 	&r.   c                 s   < \        V 4      p\        V4      ^8X  d9   \        V^ ,          \        4      '       d   \	        V^ ,          4      V^,          3pSW3# )r#   )r   len
isinstancelisttuple)r/   argsr$      & r+   
_cache_keyZ2GenericModel.__class_getitem__.<locals>._cache_keyW   sI    G$D4yA~*T!Wd";";d1gQ0%%r.   Nz?Cannot parameterize a concrete instantiation of a generic modelc              3   sB   "   T F  p\        V\        4      x  K  	  R # 5iN)r4   r   ).0params   & r+   	<genexpr>Z1GenericModel.__class_getitem__.<locals>.<genexpr>e   s     &Vvez%'A'Avs   TFzDType parameters should be placed on typing.Generic, not GenericModel__parameters__zType z< must inherit from typing.Generic before being parameterized
__module__Z__base__Z
__config__Z__validators__Z__cls_kwargs__Z_)+_generic_types_cacheget__concrete__r   	__bases__	TypeErrorr4   r6   r!   Zanyhasattr__name__check_parameters_countZdictZzipr>   r   Zkeysvalues__concrete_name__r   r   itemsr   r   
__fields__r   Z
field_infoget_caller_frame_infor   r   r   r?   __parameterized_bases___assigned_parameterssysZmodulesZ__dict__Z
setdefaultZConfigiter_contained_typevarsr3   _prepare_model_fields)r$   r%   r9   Zcachedtypevars_mapZ
model_nameZ
validatorsZ
type_hintsZkvinstance_type_hintsfieldsZmodel_moduleZcalled_globallycreated_modelZobject_by_referenceZreference_nameZreference_module_globalsr<   Z
new_paramss   f&                  r+   __class_getitem__ZGenericModel.__class_getitem__K   s*   	& 	& &))*V*<=Ms}} <]^^&%((YF,33&Vv&V333&Vv&V#V#Vbccs,--eCLL>1mnoosF+59#c>P>PRX:Y5Z**,l.A.A.CDDJ **62
*3/
',224
0:\
jmS[>[tqt
\M`xM`iliwiwdwC!lncnnQ&7&B&BCCM`x(=(?%'993>> %(C(CL(Q"RR  	
  *  $ 
 /;]+"&'N'*{{=3K3K'L'U'U$%:&>&I&I.Zg&h##%"zz &=l>Q>Q>S&TU&TUUD[&TU

 *4^"+5M( 4AZ/0v;!:G F1I!67 	m5HWg ]xB Vs   M/*M/7M5,M5>M:c                s`   < V ^8  d   QhRS[ S[,          RS[S[ S[,          R3,          RS[/# r"   )r   r   r
   strr'   r*   r+   r,   r-      s3     5 5tCy 5%S	32G 5C 5r.   c                s    V Uu. uF  p\        V4      NK  	  ppRP                  V4      pV P                   RV R2# u upi )a  Compute class name for child classes.

:param params: Tuple of types the class . Given a generic class
    `Model` with 2 type variables and a concrete model `Model[str, int]`,
    the value `(str, int)` would be passed to `params`.
:return: String representing a the new class where `params` are
    passed to `cls` as type variables.

This method can be overridden to achieve a custom naming scheme for GenericModels.
z, Z[Z])r   ZjoinrF   )r$   r%   r<   Zparam_namesZparams_component   &&   r+   rI   ZGenericModel.__concrete_name__   sL     <BB6%u-6B99[1,,q!1 2!44 Cs   >c                sF   < V ^8  d   QhRS[ RS[S[S[,          ,          /# )r#   rR   r&   )Parametrizationr   r   r   r'   r*   r+   r,   r-      s+     =F =F? =FxPTUXPYGZ =Fr.   c           
   #  s  a "   R V 3R llpS P                    F  p\        V\        4      '       g   K  \        VRR4      '       g   K0  S \        9   d]   V\        9   d   KH  \        S ,          P                  4        UUu/ uF  w  rEWAP                  WU4      bK  	  pppV! W64       Rj  xL
  K  V! W14       Rj  xL
  K  	  R# u uppi  L" L5i)aM  
Returns unbound bases of cls parameterised to given type variables

:param typevars_map: Dictionary of type applications for binding subclasses.
    Given a generic class `Model` with 2 type variables [S, T]
    and a concrete model `Model[str, int]`,
    the value `{S: str, T: int}` would be passed to `typevars_map`.
:return: an iterator of generic sub classes, parameterised by `typevars_map`
    and other assigned parameters of `cls`

e.g.:
```
class A(GenericModel, Generic[T]):
    ...

class B(A[V], Generic[V]):
    ...

assert A[int] in B.__parameterized_bases__({V: int})
```
c                s~    V ^8  d   QhR\         \        ,          R\        R\        \         \        ,          ,          /# )r#   
base_modelmapped_typesr&   )r   r!   rZ   r   r1   r2   r+   r,   Z:GenericModel.__parameterized_bases__.<locals>.__annotate__   s3     	% 	%\*	%:I	%d<()	%r.   c              3   s   <a"   \         ;QJ d!    . V3R  lV P                   4       F  NK  	  5M! V3R  lV P                   4       4      pV P                  V4      pW0J g   VSJ d   R# Vx  R# 5i)c              3   s6   <"   T F  pSV,          x  K  	  R # 5ir:    )r;   r<   r\   r8   r+   r=   ZQGenericModel.__parameterized_bases__.<locals>.build_base_model.<locals>.<genexpr>   s     #_E^EL$7$7E^s   N)r6   r>   rW   )r[   r\   Zbase_parametersZparameterized_baser$   s   &f  r+   build_base_modelZ>GenericModel.__parameterized_bases__.<locals>.build_base_model   sZ      $e#_ZE^E^#_ee#_ZE^E^#__O!+!=!=o!N!/3E3L$$s   A+A/r>   N)rC   Z
issubclassr!   getattrrN   rJ   rA   )r$   rR   r^   r[   keyZvaluer\   s   f&     r+   rM   Z$GenericModel.__parameterized_bases__   s     0	% 	% --Jj,77Z)94@@ ,,!55  OccfNgNmNmNo5No
--e;;No ! 5  0
III ,JEEE9 (*5 J Fs0   A<C?CC)C*C;C<CCc                st   < V ^8  d   Qh/ S[ S[,          ;R&   ^ S9   d   S[ S[S[R3,          ,          ;R&   # )r#   rB   .r>   )r   boolr
   TypeVarType)r(   r)   __conditional_annotations__s   "r+   r,   r-   @   s2     4.(  	:{C'7!899 r.   r]   N)rF   r?   Z__qualname__Z__firstlineno__Z	__slots__rB   r    rW   ZclassmethodrI   rM   Z__annotate_func__Z__static_attributes__Z__classdictcell__)r)   rc   s   @@r+   r!   r!   @   sV     I#(L 	:] ]~ 5 5 =F =Fw  r.   c                s^    V ^8  d   QhR\         R\        \         \         3,          R\         /# )r#   type_type_mapr&   )r   r   r1   r2   r+   r,   r,      s/     O O OS(9 Oc Or.   c                sb  a S'       g   V # \        V 4      p\        V 4      pV\        J d&   VvrE\        \        VS4      \	        V4      3,          # V\
        J g    \        P                  R8  d   V\        J d   SP                  W 4      # V'       d   \        ;QJ d    . V3R lV 4       F  NK  	  5M! V3R lV 4       4      p\        W&4      '       d   V # VeV   \        V \        4      '       d@   \        V\        4      '       g*   \        V RR4      e   \        \        V P                  4      pVf   Q h\        P                  R8  d    V\         P"                  J d   \%        W64      # W6,          # V'       g   \'        V \(        4      '       dl   V P*                  '       gZ   V P,                  p\        ;QJ d    . V3R lV 4       F  NK  	  5M! V3R lV 4       4      p\        W&4      '       d   V # W,          # \        V \.        \0        34      '       d+   \1        V3R lV  4       4      p\        W4      '       d   V # V# V'       g4   \'        V \2        4      '       d   \        V P4                  S4      V n        V # SP                  W 4      p\        V\6        4      '       d   \9        V4      # V# )a  Return type with all occurrences of `type_map` keys recursively replaced with their values.

:param type_: Any type, class or generic alias
:param type_map: Mapping from `TypeVar` instance to concrete types.
:return: New type representing the basic structure of `type_` with all
    `typevar_map` keys recursively replaced.

>>> replace_types(Tuple[str, Union[List[str], float]], {str: int})
Tuple[int, Union[List[int], float]]

c              3   <   <"   T F  p\        VS4      x  K  	  R # 5ir:   replace_types)r;   argre   r8   r+   r=    replace_types.<locals>.<genexpr>  s     "U9C=h#?#?9   N_namec              3   rf   r:   rg   )r;   Ztre   r8   r+   r=   rj   0  s     "Qy!=H#=#=yrk   c              3   rf   r:   rg   )r;   Zelementre   r8   r+   r=   rj   8  s     SU']7H==Urk      i   rn   i
   )r   r   r   rh   r6   
ExtLiteralrO   version_infor   rA   r   r4   r   r_   typingrl   typesZ	UnionTyper   r   r!   rB   r>   r   r5   r   Z
inner_typerX   r   )	rd   re   Z	type_argsZorigin_typeZannotated_typeZannotationsZresolved_type_argsZresolved_listZnew_types	   &f       r+   rh   rh      s    IU#Ki'0$~x@%BTTUUz!s'7'76'AkU\F\||E)) "U"U9"UUU"U9"UU77 L#5+..{K88w-9
 "&%++6K&&& w&;%//+I%kFF.. -e\BB5K]K]K]((	"U"Qy"QUU"Qy"QQ77L(( %$&&SUSS..L -e[AA()9)98D ||E)H(C  (##r.   c                sd    V ^8  d   QhR\         \        ,          R\        \        R3,          RR/# )r#   r$   
parameters.r&   N)r   r!   r
   r   r1   r2   r+   r,   r,   M  s4     r r\ 2 rc3h rTX rr.   c           
      s    \        V4      p\        V P                  4      pW#8w  d,   W#8  d   R MRp\        RV RV P                   RV RV 24      hR# )ZmanyZfewzToo z parameters for z	; actual z, expected N)r3   r>   rD   rF   )r$   rt   ZactualZexpectedZdescriptionrY   r+   rG   rG   M  s`    _F3%%&H & 1fu${m+;CLL>SYRZZefneopqq r.   c                sF    V ^8  d   QhR\         R\        \        ,          /# )r#   rS   r&   )r   r   rb   r1   r2   r+   r,   r,   X  s     4 4s 4x'< 4r.   c              #  s  "   \        V \        4      '       d   V x  R# \        V R4      '       d>   \        V 4      '       g-   \	        V \
        4      '       d   V P                   Rj  xL
  R# \        V \        \        34      '       d   V  F  p\        V4       Rj  xL
  K  	  R# \        V 4      pV F  p\        V4       Rj  xL
  K  	  R#  Li L5 L5i)zdRecursively iterate through all subtypes and type args of `v` and yield any typevars that are found.r>   N)r4   r   rE   r   r   r!   r>   
DictValuesr5   rP   r   )rS   Zvarr7   ri   s   &   r+   rP   rP   X  s     !W	$	%	%jmm@RSTVb@c@c####	A
D)	*	*C.s333  {C.s333  	$ 4 4s6   A%C'C(5CC(CCCCCc                s\    V ^8  d   QhR\         \        \        ,          \        3,          /# )r#   r&   )r
   r	   rX   ra   r1   r2   r+   r,   r,   g  s$     Z ZuXc]D%89 Zr.   c                 s     \         P                  ! ^4      p T P
                  pTP                  R4      T P                  TJ 3#   \         d   p\        R4      ThRp?i\         d    Ru # i ; i)z
Used inside a function to check whether it was called globally

Will only work against non-compiled code, therefore used only in pydantic.generics

:returns Tuple[module_name, called_globally]
z2This function must be used inside another functionNrF   )NF)rO   Z	_getframeZ
ValueErrorZRuntimeErrorZAttributeErrorZ	f_globalsrA   Zf_locals)Zprevious_caller_frameZeZframe_globalss      r+   rL   rL   g  su     #a 0
 *33MZ(*?*H*HM*YYY  XOPVWW s#   A A-AA-'A-,A-c          
      s    V ^8  d   QhR\         \        ,          R\        \        \        3,          R\        \        \
        3,          R\        \        \
        3,          RR/# )r#   rV   rU   rT   rR   r&   N)r   r!   r   rX   r   Ztyper1   r2   r+   r,   r,   y  sZ     ; ;%;CH; !d+; #t)$	;
 
;r.   c                s   V P                   P                  4        F  w  rEWA9  d#   VP                  P                  \        Jg   Q hK-  VP                  P                  \        J g   Q VP                  P                  4       hW$,          p\        Wc4      pWun        Wun        VP                  4        WpP                  V&   K  	  R# )zH
Replace DeferredType fields with concrete type hints and prepare them.
N)	rK   rJ   rd   	__class__r   rh   Zouter_type_ZprepareZ__annotations__)rV   rU   rT   rR   r`   ZfieldZfield_type_hintZconcrete_types   &&&&    r+   rQ   rQ   y  s     $..446
;;((<<<{{$$4Kekk6K6KK4-2%oD#)-:%%c* 7r.   c                sV    V ^8  d   Qh/ ^ \         9   d   \        \        ,          ;R&   # )r#   ru   )rc   r   r   r1   r2   r+   r,   r,      s    

h
 . -DI -i
 r.   ro   rm   )rn   i	   )@rc   rO   rs   rr   r    r   r   r   r   r   r   r   r   r	   r
   r   r   r   r   Zweakrefr   r   Ztyping_extensionsr   r   rp   Zpydantic.v1.class_validatorsr   Zpydantic.v1.fieldsr   Zpydantic.v1.mainr   r   Zpydantic.v1.typesr   Zpydantic.v1.typingr   r   r   r   r   Zpydantic.v1.utilsr   r   rq   r   r    rb   r0   rZ   ZGenericTypesCacheZAssignedParametersr@   rN   r!   rh   rG   rH   rv   ru   rP   rL   rQ   r,   )rc   s   @r+   <module>rw      sH   

      " ; > > + 4 ) e e ?w)v~>cCsCx01+tCy01 v+Hd9o,EF*4	?O+KL+* )*  *+ xF9 xFvOdr 		--
 -4Z$;r.   