
    hE              
          % S SK r S SKrS SKrS SKJrJrJrJrJrJrJ	r	J
r
JrJrJrJrJrJrJr  S SKJrJr  S SKJrJr  S SKJr  S SKJr  S SKJrJr  S SK J!r!  S S	K"J#r#J$r$J%r%J&r&J'r'  S S
K(J)r)J*r*  \ RV                  S:  a  S SKJ,r,  \ RV                  S:  a  S SKJr  \" SSS9r-\r.\\\   \\\S4   4   r/\\.\\   4   r0\ RV                  S:  a  \\/\\   4   r1\\\   \04   r2O\r1\r2\1" 5       r3\2" 5       r4 " S S\5      r5S\S\\\4   S\4S jr6S\\5   S\\S4   SS4S jr70 Rq                  5       Rr                  r:\\   \;S'   S\S\	\.   4S jr<S\\\=   \>4   4S jr?S \\5   S!\\=\4   S"\\=\@4   S#\\\@4   SS4
S$ jrAg)%    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#      )r   GenericModelTGenericModel)bound.)r#   	   c                       \ rS rSr% SrSr\\   \S'   \	(       a  \\
\S4      \S'   S\\   S\\\   \
\\   S4   4   S	\\   4S
 jr\S\\   S\
\\   S4   S	\4S j5       r\S\S	\\\      4S j5       rSrg)r)   @    F__concrete__.__parameters__clsparamsreturnc                   ^  S[         S[        4U 4S jjn[        R                  U" U5      5      nUb  U$ T R                  (       a  [
        T R                  ;  a  [        S5      e[        U[        5      (       d  U4nT [        L a"  [        S U 5       5      (       a  [        S5      e[        T S5      (       d  [        S	T R                   S
35      e[        T U5        [        [!        T R"                  U5      5      n[%        UR'                  5       UR)                  5       5      (       a	  U(       a  T $ T R+                  U5      n[-        T 5      n[/        T 5      R1                  5       nU VV	s0 s H  u  p[3        U	5      [4        Ld  M  X_M     n
nn	U
 Vs0 s H8  oT R6                  ;   d  M  U[9        5       T R6                  U   R:                  4_M:     nn[=        5       u  p[?        [@        [           [C        U4U=(       d    T RD                  T 4[        T RG                  U5      5      -   SUSS.UD65      nU[H        U'   U(       aL  SnUn[J        RL                  URD                     RN                  nXLa  URQ                  UU5      nUS-  nXLa  M  T RR                  Ul)        [        [U        UR)                  5       5       Vs0 s H  nUS_M     sn5      nU(       + Ul        U(       a  UUl        U[        U" U5      '   [W        U5      S:X  a  U[        U" US   5      '   [Y        XX5        U$ s  sn	nf s  snf s  snf )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.

_paramsr3   c                    > [        U 5      n[        U5      S:X  a+  [        US   [        5      (       a  [	        US   5      US   4nTX4$ )N   r      )r   len
isinstancelisttuple)r5   argsr1   s     F/var/www/html/env/lib/python3.13/site-packages/pydantic/v1/generics.py
_cache_key2GenericModel.__class_getitem__.<locals>._cache_keyW   sI    G$D4yA~*T!Wd";";d1gQ0%%    Nz?Cannot parameterize a concrete instantiation of a generic modelc              3   B   #    U  H  n[        U[        5      v   M     g 7fN)r:   r   ).0params     r>   	<genexpr>1GenericModel.__class_getitem__.<locals>.<genexpr>e   s     &Vvez%'A'Avs   zDType parameters should be placed on typing.Generic, not GenericModelr0   zType z< must inherit from typing.Generic before being parameterized)
__module____base__
__config____validators____cls_kwargs___r8   r   )-r   CacheKey_generic_types_cachegetr/   r   	__bases__	TypeErrorr:   r<   r)   anyhasattr__name__check_parameters_countdictzipr0   r    keysvalues__concrete_name__r   r   itemsr   r   
__fields__r   
field_infoget_caller_frame_infor   r   r   rH   __parameterized_bases___assigned_parameterssysmodules__dict__
setdefaultConfigiter_contained_typevarsr9   _prepare_model_fields)r1   r2   r?   cachedtypevars_map
model_name
validators
type_hintskvinstance_type_hintsfieldsmodel_modulecalled_globallycreated_modelobject_by_referencereference_namereference_module_globalsrE   
new_paramss   `                   r>   __class_getitem__GenericModel.__class_getitem__K   s   	& 	& 	& &))*V*<=Ms}} <]^^&%((YF,3&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(=(?%'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   .L3
L3L9.(L9L>c                     U Vs/ s H  n[        U5      PM     nnSR                  U5      nU R                   SU S3$ s  snf )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, [])r   joinrU   )r1   r2   rE   param_namesparams_components        r>   r[   GenericModel.__concrete_name__   sL     <BB6%u-6B99[1,,q!1 2!44 Cs   ?rj   c           
   #     ^ #    S[         [           S[        S[        [         [              4U 4S jjnT R                   H  n[        U[        5      (       d  M  [        USS5      (       d  M.  T [        ;   aX  U[        ;   a  MD  [        T    R                  5        VVs0 s H  u  pEXAR                  XU5      _M     nnnU" X65       Sh  vN   M  U" X15       Sh  vN   M     gs  snnf  N! N7f)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})
```

base_modelmapped_typesr3   c              3      >^#    [        U4S jU R                   5       5      nU R                  U5      nX0L d  UTL a  g Uv   g 7f)Nc              3   .   >#    U  H
  nTU   v   M     g 7frC   r.   )rD   rE   r   s     r>   rF   QGenericModel.__parameterized_bases__.<locals>.build_base_model.<locals>.<genexpr>   s     #_E^EL$7E^s   )r<   r0   ry   )r   r   base_parametersparameterized_baser1   s    `  r>   build_base_model>GenericModel.__parameterized_bases__.<locals>.build_base_model   sF      $#_ZE^E^#__O!+!=!=o!N!/3E3L$$s   A Ar0   N)
r   r)   Parametrizationr	   rQ   
issubclassgetattrra   r\   rP   )r1   rj   r   r   keyvaluer   s   `      r>   r`   $GenericModel.__parameterized_bases__   s     0	%\*	%:I	%d<()	% --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   BC.C$:C.C*	C.C,C.,C.N)rU   rH   __qualname____firstlineno__	__slots__r/   r   bool__annotations__r   r   TypeVarTyper   r(   r   r   ry   classmethodstrr[   r   r	   r`   __static_attributes__r.   rA   r>   r)   r)   @   s    I#(L(4.( !{C'7!899]tM2 ]E$s)USWX[S\^aSaMbBb<c ]hlmphq ]~ 5tCy 5%S	32G 5C 5 5 =F? =FxPTUXPYGZ =F =FrA   type_type_mapr3   c                   ^ T(       d  U $ [        U 5      n[        U 5      nU[        L a!  UtpE[        [        UT5      [	        U5      4   $ U[
        L d  [        R                  S:  a  U[        L a  TR                  X 5      $ U(       a  [	        U4S jU 5       5      n[        X&5      (       a  U $ UbR  [        U [        5      (       a=  [        U[        5      (       d(  [        U SS5      b  [        [        U R                  5      nUc   e[        R                  S:  a  U[         R"                  L a  [%        X65      $ X6   $ U(       d]  ['        U [(        5      (       aH  U R*                  (       d7  U R,                  n[	        U4S jU 5       5      n[        X&5      (       a  U $ X   $ [        U [.        [0        45      (       a)  [1        U4S jU  5       5      n[        X5      (       a  U $ U$ U(       d2  ['        U [2        5      (       a  [        U R4                  T5      U l        U $ TR                  X 5      n[        U[6        5      (       a  [9        U5      $ U$ )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]]

r&   c              3   <   >#    U  H  n[        UT5      v   M     g 7frC   replace_types)rD   argr   s     r>   rF    replace_types.<locals>.<genexpr>  s     "U9C=h#?#?9   N_namer"   c              3   <   >#    U  H  n[        UT5      v   M     g 7frC   r   )rD   tr   s     r>   rF   r   0  s     "Qy!=H#=#=yr   c              3   <   >#    U  H  n[        UT5      v   M     g 7frC   r   )rD   elementr   s     r>   rF   r   8  s     SU']7H==Ur   )r   r   r   r   r<   
ExtLiteralrb   version_infor   rP   r    r:   r   r   typingr   types	UnionTyper%   r!   r)   r/   r0   r
   r;   r   
inner_typer   r   )	r   r   	type_argsorigin_typeannotated_typeannotationsresolved_type_argsresolved_listnew_types	    `       r>   r   r      s    IU#Ki'0$~x@%BTTUUz!s'7'76'AkU\F\||E)) ""U9"UU77 L#5+..{K88w-9
 "&%++6K&&& w&;%//+I%kFF.. -e\BB5K]K]((	""Qy"QQ77L(( %$&&SUSS..L -e[AA()9)98D ||E)H(C  (##rA   r1   
parametersc           
          [        U5      n[        U R                  5      nX#:w  a*  X#:  a  SOSn[        SU SU R                   SU SU 35      eg )NmanyfewzToo z parameters for z	; actual z, expected )r9   r0   rR   rU   )r1   r   actualexpecteddescriptions        r>   rV   rV   M  s`    _F3%%&H & 1fu${m+;CLL>SYRZZefneopqq rA   
DictValuesro   c              #     #    [        U [        5      (       a  U v   g[        U S5      (       a:  [        U 5      (       d*  [	        U [
        5      (       a  U R                   Sh  vN   g[        U [        [        45      (       a  U  H  n[        U5       Sh  vN   M     g[        U 5      nU H  n[        U5       Sh  vN   M     g Ne N3 N7f)zdRecursively iterate through all subtypes and type args of `v` and yield any typevars that are found.r0   N)r:   r   rT   r   r!   r)   r0   r   r;   rg   r   )ro   varr=   r   s       r>   rg   rg   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#3CC
'C>C?
C
CCc                       [         R                  " S5      n U R
                  nUR                  S5      U R                  UL 4$ ! [         a  n[        S5      UeSnAf[         a     gf = f)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]
r7   z2This function must be used inside another functionN)NFrU   )rb   	_getframe
ValueErrorRuntimeErrorAttributeError	f_globalsrP   f_locals)previous_caller_frameeframe_globalss      r>   r_   r_   g  sr     #a 0
 *33MZ(*?*H*HM*YYY  XOPVWW s   A 
A)AA)(A)rt   rq   rp   rj   c                 x   U R                   R                  5        H  u  pEXA;  a!  UR                  R                  [        Ld   eM+  UR                  R                  [        L d   UR                  R                  5       eX$   n[        Xc5      nXul        Xul        UR                  5         XpR                  U'   M     g)zH
Replace DeferredType fields with concrete type hints and prepare them.
N)	r]   r\   r   	__class__r   r   outer_type_preparer   )rt   rq   rp   rj   r   fieldfield_type_hintconcrete_types           r>   rh   rh   y  s     $..446
;;((<<<{{$$4Kekk6K6KK4-2%oD#)-:%%c* 7rA   )Brb   r   r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   weakrefr   r   typing_extensionsr   r   r   pydantic.v1.class_validatorsr   pydantic.v1.fieldsr   pydantic.v1.mainr   r   pydantic.v1.typesr   pydantic.v1.typingr   r   r   r   r   pydantic.v1.utilsr    r!   r   r%   r(   r   rN   r   GenericTypesCacheAssignedParametersrO   ra   r)   r   rV   rZ   r   r   r   rg   r   r   r_   typerh   r.   rA   r>   <module>r      s	   
      " ; > > + 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 OS(9 Oc Odr\ 2 rc3h rTX r 		--
DI -4s 4x'< 4ZuXc]D%89 Z$;%;CH; !d+; #t)$	;
 
;rA   