
    &hm                       S r SSKJr  SSKrSSKrSSKJr  SSKJr  SSK	J
r
  SSKJrJrJr  SSKJr  SS	KJrJrJrJr  SS
KJr  SSKJr  SSKJr  SSK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(  SSK)J*r*J+r+  SSK,J-r-  SSK.J/r/  SSK0J1r1J2r2  \(       a   SSK3J4r4  SSK5J6r6  SSK7J8r8  SSK9J:r:J;r;  SSK<J=r=   " S S\/5      r>S2S  jr?\
S3S! j5       r@          S4S" jrAS5S6S# jjrB      S7S$ jrC      S8S% jrDS9S& jrE1 S'krF1 S(krGSS).         S:S* jjrH          S;S+ jrISSS,.         S<S- jjrJ          S=S. jrKS>S/ jrLS>S0 jrM    S?S1 jrNg)@zmPrivate logic related to fields (the `Field()` function and `FieldInfo` class), and arguments to `Annotated`.    )annotationsN)Mapping)copy)cache)	Parameterismethoddescriptor	signature)Pattern)TYPE_CHECKINGAnyCallableTypeVar)PydanticUndefined)TypeIs)AnnotationSource)PydanticDeprecatedSince211)PydanticUserError   )AliasGenerator   )	_generics_typing_extra)ConfigWrapper)extract_docstrings_from_cls)import_cached_base_modelimport_cached_field_info)
NsResolver)Representation)can_be_positionalget_first_not_noneBaseMetadata)	FieldInfo)	BaseModel)PydanticDataclassStandardDataclass)DecoratorInfosc                      \ rS rSrSrSrSrg)PydanticMetadata'   z0Base class for annotation markers like `Strict`. N)__name__
__module____qualname____firstlineno____doc__	__slots____static_attributes__r+       J/root/34ku/venv/lib/python3.13/site-packages/pydantic/_internal/_fields.pyr)   r)   '   s
    :Ir3   r)   c                 "    [        5       " U 5      $ )zCreate a new `_PydanticGeneralMetadata` class with the given metadata.

Args:
    **metadata: The metadata to add.

Returns:
    The new `_PydanticGeneralMetadata` class.
)_general_metadata_cls)metadatas    r4   pydantic_general_metadatar8   -   s     !"8,,r3   c                 2    SSK Jn    " S S[        U 5      nU$ )zCDo it this way to avoid importing `annotated_types` at import time.r   r!   c                  "    \ rS rSrSrSS jrSrg)7_general_metadata_cls.<locals>._PydanticGeneralMetadata>   z,Pydantic general metadata like `max_digits`.c                    Xl         g N__dict__)selfr7   s     r4   __init__@_general_metadata_cls.<locals>._PydanticGeneralMetadata.__init__A   s    $Mr3   r?   N)r7   r   )r,   r-   r.   r/   r0   rB   r2   r+   r3   r4   _PydanticGeneralMetadatar;   >   s
    :	%r3   rD   )annotated_typesr"   r)   )r"   rD   s     r4   r6   r6   9   s     -%#3\ % $#r3   c                J   [        5       nU  GH  nSn[        U[        5      (       a  UR                  U5      S LnO&[        U[        5      (       a  UR                  U5      nU(       d  M^  U HV  n[        Xq5      (       d  M  [        Xt5      (       a  U[        US0 5      ;   a  M8  [        SU< S[        Xq5       SU< S35      e   / nU  H  n	[        U	[        5      (       a:  U	R                  U5      (       d"  UR                  SU	R                  < S35        MP  MR  UR                  U	5      (       a  Mj  UR                  S	U	 S	35        M     S
SR                  U5       [        U5      S:X  a  SOS 3n
[        R                  " SU< SU< SU< SU
 S3	[         SS9  GM     g )NF__pydantic_fields__Field z conflicts with member z of protected namespace .zre.compile()'(z, r   z,)z in z$ conflicts with protected namespace zX.

You may be able to solve this by setting the 'protected_namespaces' configuration to    
stacklevel)r   
isinstancer
   matchstr
startswithhasattr
issubclassgetattr
ValueErrorappendpatternjoinlenwarningswarnUserWarning)protected_namespacesann_namebasescls_namer$   protected_namespacens_violationbvalid_namespacespnvalid_namespaces_strs              r4   _check_protected_namespacesri   G   s    )*I3)733.44X>dJL+S11#../BCL<1''&q44WQPegiEj9j($XL0GPQH\G]67J6MQP   /1 .B!"g..!xx11,33k"**q4QR  2  (22266,33at1I> / *+4995E+F*GPSTdPeijPjpsGt'u$XLXL8\]p\s tl mA  lB  BCD 	7  4r3   c                    [        XS9nUR                  5        H$  u  pEUR                  b  M  XC;   d  M  X4   Ul        M&     g )Nuse_inspect)r   itemsdescription)clsfieldsrl   fields_docsr`   
field_infos         r4   _update_fields_from_docstringsrs   r   s;    -cKK &!!)h.E%0%:J" !/r3   c                    UR                   c?  U " X5      n[        U[        5      (       d  [        SU  SUR                   35      eX2l         g g )Nzfield_title_generator  must return str, not )titlerP   rR   	TypeError	__class__)title_generator
field_namerr   rv   s       r4   *_apply_field_title_generator_to_field_infor{   y   sU    
 
7%%%4_4EE[\a\k\k[lmnn   r3   c                   UR                   b8  UR                   S::  d(  UR                  b  UR                  b  UR                  Gc   Su  p4n[	        U [
        5      (       a  U R                  U5      u  p4nOH[        U 5      (       a8  U " U5      n[	        U[        5      (       d  [        SU  SUR                   35      eUR                   b  UR                   S::  a  SUl         UR                   S:X  a&  [        XS5      Ul        [        XC5      Ul        X2l        UR                  c  X2l        UR                  c  [        XS5      Ul        UR                  c  [        XC5      Ul        ggg)ab  Apply an alias generator to aliases on a `FieldInfo` instance if appropriate.

Args:
    alias_generator: A callable that takes a string and returns a string, or an `AliasGenerator` instance.
    field_name: The name of the field from which to generate the alias.
    field_info: The `FieldInfo` instance to which the alias generator is (maybe) applied.
Nr   )NNNzalias_generator ru   )alias_priorityaliasvalidation_aliasserialization_aliasrP   r   generate_aliasescallablerR   rw   rx   r    )alias_generatorrz   rr   r~   r   r   s         r4   $_apply_alias_generator_to_field_infor      s]    	!!)$$)#&&.))17G4!4o~66;J;[;[\f;g8E%8o&&#J/EeS))"2?2CCYZ_ZiZiYj kll
 $$,
0I0IQ0N()J% $$)-?@S-[J**<=M*UJ'$ #$))1-?@S-[J*&&.*<=M*UJ' /9 2r3   c                    UR                   =(       d    U R                   nUb  [        X1U5        U R                  b  [        U R                  X5        gg)aX  Update the `FieldInfo` instance from the configuration set on the model it belongs to.

This will apply the title and alias generators from the configuration.

Args:
    config_wrapper: The configuration from the model.
    field_name: The field name the `FieldInfo` instance is attached to.
    field_info: The `FieldInfo` instance to update.
N)field_title_generatorr{   r   r   )config_wrapperrz   rr   r   s       r4   update_field_from_configr      sN     '<<d@d@d(23HV`a%%1,^-K-KZd 2r3   >   r   dictjson_iter_calculate_keys_copy_and_set_values>
   schemafrom_ormvalidate	construct	parse_obj	parse_raw
_get_value
parse_fileschema_jsonupdate_forward_refs)typevars_mapc               h	  ^^ [        5       n[        5       mU R                  n0 n[        U5       H*  n[	        USS5      =n(       d  M  UR                  U5        M,     [        R                  " XS9n	[        R                  " U 5      n
0 n[        5       nU	R                  5        GH  u  nu  pUS:X  a  M  [        UR                  UUU R                  S9  [        R                  " U5      (       a  UR                  U5        M_  [	        X[         5      mT[         LaU  [#        UU4S j[$         5       5      (       d0  ['        TS5      (       a%  [#        UU4S j[(         5       5      (       a  [         m[+        U5      (       d  M  U R,                  (       a  US	:w  a  [/        S
U< S35      e[	        U S0 5      R1                  S5      nU H  n[2        R4                  " U5      (       a  [2        R6                  " U5      OS Vs1 s H  nUR8                  iM     nn['        X}5      (       d  Mb  UUL a  Mi  UU;   a  Mq  X;  a  Mx  [:        R<                  " SU SU R>                   SUR>                   S3[@        SS9  M     T[         L aN  X;   d  X;  a5  URC                  U[D        RF                  S9nU(       d  SUl$        UUl%        GO[M        Xm   5      nGO[O        TU5      (       aL  [Q        TRR                  5      (       a2  TRR                  RU                  SU 5      nUTl)        UTRV                  S'   URY                  UT[D        RF                  S9nTUl-        U(       d  SUl$        UUl%        O`SUR\                  ;   aP  UR_                  5       (       d;  [:        R<                  " SU< SU< SU< S3[`        SS9  UR                  U5        GM(   [c        X5        U Rf                  S   nUURh                  ;   a  [k        SU< S U R                  < S!35      eUX'   URH                  (       d  GM  [m        XU5        GM     U(       a;  URo                  5        H'  nURH                  (       d  M  URq                  U5        M)     URr                  (       a  [u        X5        X4$ s  snf ! [d         a     Nf = f)"a  Collect the fields and class variables names of a nascent Pydantic model.

The fields collection process is *lenient*, meaning it won't error if string annotations
fail to evaluate. If this happens, the original annotation (and assigned value, if any)
is stored on the created `FieldInfo` instance.

The `rebuild_model_fields()` should be called at a later point (e.g. when rebuilding the model),
and will make use of these stored attributes.

Args:
    cls: BaseModel or dataclass.
    config_wrapper: The config wrapper instance.
    ns_resolver: Namespace resolver to use when getting model annotations.
    typevars_map: A dictionary mapping type variables to their concrete types.

Returns:
    A two-tuple containing model fields and class variables names.

Raises:
    NameError:
        - If there is a conflict between a field name and protected namespaces.
        - If there is a field other than `root` in `RootModel`.
        - If a field shadows an attribute in the parent model.
rG   N)ns_resolvermodel_config)r_   r`   ra   rb   c              3  B   >#    U  H  n[        TUS 5      TL v   M     g 7fr>   )rV   .0	depr_name
BaseModel_assigned_values     r4   	<genexpr>'collect_model_fields.<locals>.<genexpr>  s!     qXp9
It4FXps   __func__c              3  l   >#    U  H)  n[        [        TUS 5      SS 5      TR                  L v   M+     g 7f)Nr   )rV   r   r   s     r4   r   r   #  s6      %B	 GJ	4@*dSWeWnWnn%Bs   14rootzUnexpected field with name z4; only 'root' is allowed as a field of a `RootModel`__pydantic_generic_metadata__originr+   zField name "z" in "z"" shadows an attribute in parent ""   rN   _sourceFdefaultfinalzAnnotation z= is marked as final and has a default value. Pydantic treats zz as a class variable, but it will be considered as a normal field in V3 to be aligned with dataclasses. If you still want zV to be considered as a class variable, annotate it as: `ClassVar[<type>] = <default>.`)categoryrO   __pydantic_decorators__rH   z
 of class zf overrides symbol of same name in a parent class. This override with a computed_field is incompatible.);r   r   	__bases__reversedrV   updater   get_model_type_hintssafe_get_annotationssetrm   ri   r_   r,   is_classvar_annotationaddr   any_deprecated_method_namesrT   _deprecated_classmethod_namesis_valid_field_name__pydantic_root_model__	NameErrorgetdataclassesis_dataclassrp   namer\   r]   r.   r^   from_annotationr   CLASS	_complete_original_annotationr   rP   r   r   __get___attributes_setfrom_annotated_attribute_original_assignment_qualifiersis_requiredr   delattrAttributeErrorr@   computed_fieldsrw   r   valuesapply_typevars_mapuse_attribute_docstringsrs   )ro   r   r   r   
FieldInfo_ra   parent_fields_lookupbasemodel_fields
type_hintsr   rp   
class_varsr`   ann_type	evaluatedgeneric_originfielddataclass_fieldsrr   r   
decoratorsr   r   s                         @@r4   collect_model_fieldsr      s   > *+J)+JMME13"4)>EE<E ''5   33CQJ  44S9K#%F5J+5+;+;+=''8~% #!/!D!D\\		
 //99NN8$ 0AB!22qXpqqq 
33 %B   /N"8,,&&8v+=-h\9mn  !&ErJNNxXDEPE]E]^bEcEc););D)Aik)k )ku

)k    t&&>)// ."8*F33C3C2D E))*!- 	% 2 ..&(*N (77JZJ`J`7a
 +0J( 7?J3 ""6"@A
 .*55:L^McMc:d:d )0088sC)0&<C..y9#<<X~_o_u_u<vJ /=J+',
$2:
/J222:;Q;Q;S;S!(-jksjv w""*  .DE 8  x(
& &)\\2K%L
z111Js||.> ?G G  &$^zJU ,>X ]]_E((6 % ..&s3M \ " s    RR$$
R10R1c                  [        5       n0 nUR                  U 5         U R                  R                  5        H  u  pgUR                  (       a  XuU'   M  UR
                  n[        R                  " UR                  /UR                  Q76 n	[        R                  " X5      n	UR                  =n
[        L a  UR                  U	[        R                   S9nOUR#                  X[        R                   S9nUR
                  b  UR
                  OUUl        [%        XU5        XU'   M     SSS5        U$ ! , (       d  f       U$ = f)a  Rebuild the (already present) model fields by trying to reevaluate annotations.

This function should be called whenever a model with incomplete fields is encountered.

Raises:
    NameError: If one of the annotations failed to evaluate.

Note:
    This function *doesn't* mutate the model fields in place, as it can be called during
    schema generation, where you don't want to mutate other model's fields.
r   N)r   pushrG   rm   r   rn   r   	eval_typer   types_namespacer   replace_typesr   r   r   r   r   r   r   )ro   r   r   r   r   rebuilt_fieldsf_namerr   existing_descannassign	new_fields               r4   rebuild_model_fieldsr     s)   $ *+J+-N			#	"%"9"9"?"?"AF##)3v& * 6 6#--33 00  --c@(===FBSS * : :3HXH^H^ : _I * C CCYiYoYo C pIAJAVAVAb	(=(=hu	%(K)2v&% #B 
* + 
	* s   D
D22
E)r   r   c          
        [        5       n0 nU=(       d
    [        5       nU R                  n[        U R                  5       GH:  n[
        R                  " U5      (       d  M!  UR                  U5         UR                  5        GH  u  p[        R                  " U5      n
X;  a  M#  UR                  u  p[        R                  " U	R                  X5      u  p[        R                  " U5      (       a  Mq  U	R                  (       d<  U	R                   [
        R"                  L a  U	R$                  [
        R"                  L a  M  ['        U	R                   U5      (       a  U	R                   R(                  (       a*  U	R                   R                  SL a  [+        SU S3SS9eGM  UR-                  XR                   [.        R0                  S9nU	R                   Ul        O$UR-                  X[.        R0                  S9nXl        U(       d  SUl        Xl        XU'   [9        XU5        UR                   [:        Ld  GM  ['        [=        XU5      U5      (       d  GM  [?        XUR                   5        GM     SSS5        GM=     U(       a(  URA                  5        H  nURC                  U5        M     URD                  (       a  [G        U U[I        U S5      (       + S	9  U$ ! , (       d  f       GM  = f)
aX  Collect the fields of a dataclass.

Args:
    cls: dataclass.
    config_wrapper: The config wrapper instance.
    ns_resolver: Namespace resolver to use when getting dataclass annotations.
        Defaults to an empty instance.
    typevars_map: A dictionary mapping type variables to their concrete types.

Returns:
    The dataclass fields.
FzDataclass field zD has init=False and init_var=True, but these are mutually exclusive.zclashing-init-and-init-var)coder   N__is_pydantic_dataclass__rk   )%r   r   __dataclass_fields__r   __mro__r   r   r   rm   r   r   r   try_eval_typetyper   initr   MISSINGdefault_factoryrP   init_varr   r   r   	DATACLASSr   r   r   r   r   rV   setattrr   r   r   rs   rT   )ro   r   r   r   r   rp   r   r   r`   dataclass_field	base_annsglobalnslocalnsr   r   rr   r   s                    r4   collect_dataclass_fieldsr     s   & *+J#%F-K//
 %''--d#-=-C-C-E))>>tD	, $/$?$?!&3&A&A/BVBVX`&j# 77AA (,,'//;3F3FF'77;;N;NN o55zBB&..77*22775@"3"28*  =A  !B%A#  !!+!D!D "9"9CSC]C] "E "J 7F6M6MJ3!+!D!D ;K;U;U "E "J 7F3 +0J(6>3#-x (:N%%->>:C:6
D D C:+=+=>m .F $#	 &z ]]_E $$\2	 % ..& $C)DEE	
 MS $#s   3GK:KK
K,	c               6   [        5       n0 nUR                  U 5         U R                  R                  5        H  u  pgUR                  (       a  XuU'   M  UR
                  n[        R                  " UR                  /UR                  Q76 n	[        R                  " X5      n	UR                  U	UR                  [        R                  S9n
U
R
                  b  U
R
                  OUU
l        [!        XU
5        XU'   M     SSS5        U$ ! , (       d  f       U$ = f)a  Rebuild the (already present) dataclass fields by trying to reevaluate annotations.

This function should be called whenever a dataclass with incomplete fields is encountered.

Raises:
    NameError: If one of the annotations failed to evaluate.

Note:
    This function *doesn't* mutate the dataclass fields in place, as it can be called during
    schema generation, where you don't want to mutate other dataclass's fields.
r   N)r   r   rG   rm   r   rn   r   r   r   r   r   r   r   r   r   r   r   )ro   r   r   r   r   r   r   rr   r   r   r   s              r4   rebuild_dataclass_fieldsr   9  s   $ *+J+-N			#	"%"9"9"?"?"AF##)3v& * 6 6#--33 00  --c@&??33,66 @ 	 BKAVAVAb	(=(=hu	%(K)2v&' #B 
, - 
	, s   C!D		
Dc                .    U R                  S5      (       + $ )N_rS   r   s    r4   r   r   g  s    s###r3   c                ^    U R                  S5      =(       a    U R                  S5      (       + $ )Nr  __r  r  s    r4   is_valid_privateattr_namer  k  s"    ??3=(=$==r3   c                    [        U 5      n[        UR                  R                  5       5      n[        U5      S:H  =(       a4    [        US   5      =(       a    US   R                  [        R                  L $ ! [        [        4 a     gf = f)zMWhether the provided default factory callable has a validated data parameter.Fr   r   )r	   rW   rw   list
parametersr   r[   r   r   r   empty)r   sigr	  s      r4   takes_validated_data_argumentr  o  s    ( cnn++-.Jz?aq$5jm$DqTUI^I^bkbqbqIqq 	"  s   A9 9BB)r7   r   returnr"   )r  ztype[BaseMetadata])
r_   ztuple[str | Pattern[str], ...]r`   rR   ra   ztuple[type[Any], ...]rb   rR   r  None)F)ro   z	type[Any]rp   dict[str, FieldInfo]rl   boolr  r  )ry   zCallable[[str, FieldInfo], str]rz   rR   rr   r#   )r   z%Callable[[str], str] | AliasGeneratorrz   rR   rr   r#   )r   r   rz   rR   rr   r#   r  r  )
ro   type[BaseModel]r   r   r   NsResolver | Noner   zMapping[TypeVar, Any] | Noner  z%tuple[dict[str, FieldInfo], set[str]])
ro   r  r   r   r   r   r   Mapping[TypeVar, Any]r  r  )
ro   ztype[StandardDataclass]r   r   r   r  r   zdict[Any, Any] | Noner  r  )
ro   ztype[PydanticDataclass]r   r   r   r   r   r  r  r  )r   rR   r  r  )r   z3Callable[[], Any] | Callable[[dict[str, Any]], Any]r  z'TypeIs[Callable[[dict[str, Any]], Any]])Or0   
__future__r   _annotationsr   r\   collections.abcr   r   	functoolsr   inspectr   r   r	   rer
   typingr   r   r   r   pydantic_corer   typing_extensionsr   typing_inspection.introspectionr   pydanticr   pydantic.errorsr   aliasesr    r   r   _configr   _docs_extractionr   _import_utilsr   r   _namespace_utilsr   _reprr   _utilsr   r    rE   r"   rp   r#   mainr$   _dataclassesr%   r&   _decoratorsr'   r)   r8   r6   ri   rs   r{   r   r   r   r   r   r   r   r   r   r  r  r+   r3   r4   <module>r+     s)   s 2   #   < <  8 8 + $ < / - $ & " 9 M ( ! 9," B+~ 	- 
$ 
$(8(( !( 	(
 
(V;
!4
!
! 
!/V:/VHK/VYb/Vde" h ! & 26D	D!D #D
 /D +DN*	* "* 	*
 (* *b &**.i	 i "i #	i
 (i iX+	 + "+ 	+
 (+ +\$>rHr,rr3   