
    h%                        S SK r S SKJr  S SKJrJrJrJrJrJ	r	J
r
JrJr  S SKJ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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/  S SK0J1r1J2r2J3r3J4r4J5r5J6r6J7r7  S SK8J9r9  S S	K:J;r;  S S
K<J=r=  S SK>J?r?J@r@JArAJBrBJCrCJDrDJrJErEJFrFJGrGJHrHJIrIJJrJ  S SKKJLrL  S SKMJNrN  S SKOJPrQ  S SKRJSrS   S SK>JTrT  SrVSrW\XSS rY\Y S3rZ\Y S3r[\Y S3r\\Y S3r]\Y S3r^S\_S\
\`S4   4S jra\a" \Q5      rb\bS:  a  SOS rcS!rPS\_SS"4S# jrd " S$ S%\55      re " S& S'5      rfS(\4S\4S) jrg " S* S+5      rh " S, S-5      ri " S. S/5      rj\" S0S1S25      rk\" S3S4S25      rl\" S5S6S25      rm\" S7S8S25      rn\" S9S:S25      ro\" S9S;S25      rpS<\_S=\1S>\SS4S? jrqS@\_S=\7S>\SS4SA jrrS=\7S>\SS4SB jrsSC\_S=\\1\74   S>\SS4SD jrtS=\7S>\SS4SE jruS=\1S>\SS4SF jrv    SSS(\2S@\_SG\\   SH\SI\\   SJ\\T   SK\wSL\wSS4SM jjrxSN\\\(4   S\_4SO jrySN\\\(4   S\_4SP jrzSQ\_S\\\_\4      4SR jr{g! \U a
    S SK>JHrT   GNuf = f)T    N)ConfigParser)	AnyCallableDictListOptionalSetTupleTypeUnion)	ErrorCode)	ARG_NAMEDARG_NAMED_OPTARG_OPTARG_POS	ARG_STAR2MDEFArgumentAssignmentStmtBlockCallExprClassDefContext	DecoratorEllipsisExprFuncBaseFuncDefJsonDict
MemberExprNameExprPassStmtPlaceholderNodeRefExprStrExpr
SymbolNodeSymbolTableNodeTempNodeTypeInfoTypeVarExprVar)Options)CheckerPluginInterfaceClassDefContextFunctionContextMethodContextPluginReportConfigContextSemanticAnalyzerPluginInterface)dataclasses)set_callable_name)make_wildcard_trigger)AnyTypeCallableTypeInstanceNoneType
Overloaded
ProperTyper   	TypeOfAnyTypeType	TypeVarIdTypeVarType	UnionTypeget_proper_type)fill_typevars)get_unique_redefinition_name)__version__)is_valid_field)
TypeVarDef)r?   pydantic-mypyzpydantic-mypy-metadataz.main.BaseModelz.env_settings.BaseSettingsz.main.ModelMetaclassz.fields.Fieldz.dataclasses.dataclassversionreturn.c                 v    [        [        [        U R                  S5      S   R	                  S5      5      5      $ )N+r   .)tuplemapint	partitionsplitrI   s    B/var/www/html/env/lib/python3.13/site-packages/pydantic/v1/mypy.pyparse_mypy_versionrU   W   s/    S'++C0399#>?@@    )r   i  builtins__builtins__   zTypingType[Plugin]c                     [         $ )z
`version` is the mypy version string

We might want to use this to print a warning if the mypy version being used is
newer, or especially older, than we expect (or need).
)PydanticPluginrS   s    rT   pluginr\   b   s
     rV   c                     ^  \ rS rSrS\SS4U 4S jjrS\SS4S jrS\S\\	\
/S4      4S	 jrS\SS
4S jrS\S\\	\/\4      4S jrS\S\\	\
/S4      4S jrS\S\\\4   4S jrS\
SS4S jrS\
SS4S jrS\SS4S jrSrU =r$ )r[   l   optionsrJ   Nc                    > [        U5      U l        U R                  R                  5       U l        [        TU ]  U5        g N)PydanticPluginConfigplugin_configto_data_plugin_datasuper__init__)selfr_   	__class__s     rT   rg   PydanticPlugin.__init__m   s4    1': ..668!rV   fullnamez+Optional[Callable[[ClassDefContext], None]]c                     U R                  U5      nU(       aV  [        UR                  [        5      (       a7  [	        S UR                  R
                   5       5      (       a  U R                  $ g )Nc              3   F   #    U  H  n[        U5      [        :H  v   M     g 7fra   )get_fullnameBASEMODEL_FULLNAME.0bases     rT   	<genexpr>5PydanticPlugin.get_base_class_hook.<locals>.<genexpr>v   s     U<%);;   !)lookup_fully_qualified
isinstancenoder(   anymro$_pydantic_model_class_maker_callbackrh   rk   syms      rT   get_base_class_hook"PydanticPlugin.get_base_class_hookr   sM    ))(3:chh11UUUU@@@rV   c                 0    U[         :X  a  U R                  $ g ra   )MODEL_METACLASS_FULLNAME)_pydantic_model_metaclass_marker_callbackrh   rk   s     rT   get_metaclass_hook!PydanticPlugin.get_metaclass_hookz   s    //AAArV   z+Optional[Callable[[FunctionContext], Type]]c                 t    U R                  U5      nU(       a   UR                  [        :X  a  U R                  $ g ra   )rv   rk   FIELD_FULLNAME_pydantic_field_callbackr|   s      rT   get_function_hook PydanticPlugin.get_function_hook   s/    ))(33<<>1000rV   c                 <    UR                  S5      (       a  [        $ g )Nz	.from_orm)endswithfrom_orm_callbackr   s     rT   get_method_hookPydanticPlugin.get_method_hook   s    [))$$rV   c                 L    U[         :X  a  [        S:  a  [        R                  $ g)zpMark pydantic.dataclasses as dataclass.

Mypy version 1.1.1 added support for `@dataclass_transform` decorator.
)   r   N)DATACLASS_FULLNAMEMYPY_VERSION_TUPLEr3   dataclass_class_maker_callbackr   s     rT   get_class_decorator_hook'PydanticPlugin.get_class_decorator_hook   s$    
 )).@6.I===rV   ctxc                     U R                   $ )zZReturn all plugin config data.

Used by mypy to determine if cache needs to be discarded.
)re   )rh   r   s     rT   report_config_data!PydanticPlugin.report_config_data   s    
    rV   c                 N    [        XR                  5      nUR                  5         g ra   )PydanticModelTransformerrc   	transform)rh   r   transformers      rT   r{   3PydanticPlugin._pydantic_model_class_maker_callback   s    .s4F4FGrV   c                     U R                   R                  (       a  gUR                  R                  R                  nU(       d   S5       e[        UR                  SS5      (       a  SUR                  l        gg)zReset dataclass_transform_spec attribute of ModelMetaclass.

Let the plugin handle it. This behavior can be disabled
if 'debug_dataclass_transform' is set to True', for testing purposes.
Nz-callback not passed from 'get_metaclass_hook'dataclass_transform_spec)rc   debug_dataclass_transformclsinfodeclared_metaclassgetattrtyper   )rh   r   info_metaclasss      rT   r   8PydanticPlugin._pydantic_model_metaclass_marker_callback   sa     7788NNN~>&&(BDII;?N8 JrV   r   c                   ^	 UR                   m	UR                  S   S:X  d   S5       eUR                  S   S:X  d   S5       eUR                  S   nUR                  S   nU(       a)  U(       a"  [        UR                  UR
                  5        T	$ U(       a1  UR                  S   S   nUS   n[        U[        5      (       d  U$  T	$ U(       a  UR                  S   S   n[        U[        5      (       a-  [        S:  a  UR                  S   nOUR                  5       S   n[        U[        5      (       aS  UR                  n[        USS	5      nU(       a1  [        S
 U 5       5      (       a  [!        U	4S jU 5       5      Ul        U$ T	$ )aH  
Extract the type of the `default` argument from the Field function, and use it as the return type.

In particular:
* Check whether the default and default_factory argument is specified.
* Output an error if both are specified.
* Retrieve the type of the argument which is specified, and use it as return type for the function.
r   defaultz0"default" is no longer first argument in Field()r   default_factoryz9"default_factory" is no longer second argument in Field())r   i  argsNc              3   B   #    U  H  n[        U[        5      v   M     g 7fra   )rw   r?   )rq   args     rT   rs   :PydanticPlugin._pydantic_field_callback.<locals>.<genexpr>   s     H4C:c;774s   c              3   (   >#    U  H  nTv   M	     g 7fra    )rq   _default_any_types     rT   rs   r      s     -M1.>s   )default_return_typecallee_arg_namesr   +error_default_and_default_factory_specifiedapicontext	arg_typesrw   r   r:   r   itemsr7   ret_typer   allrN   )
rh   r   default_argsdefault_factory_argsdefault_typedefault_argdefault_factory_typer   r   r   s
            @rT   r   'PydanticPlugin._pydantic_field_callback   s}    22##A&)3g5gg3##A&*;;x=xx;xx{"xx{07M##==+A.L&q/K k<88## 94  / "#&==#3A#6  .
;;%0+?+E+Ea+H( ,@+E+E+G+J(.==/88 x6H4HHH(--M-M(MrV   )re   rc   )__name__
__module____qualname____firstlineno__r+   rg   strr~   r   r   r-   r   r   r/   r   r   r   r1   r   r   r   r{   r   r.   r   __static_attributes____classcell__)ri   s   @rT   r[   r[   l   s   " "D "
C 4a 3 8HoEVX\E\<]3^ 
# 2_  =/SWBW9X0Y 
 (OK\^bKbBc9d !&9 !d38n !   D  @_ @QU @3 O 3  3  3 rV   r[   c                   v    \ rS rSr% Sr\\S'   \\S'   \\S'   \\S'   \\S'   S\S	S
4S jrS	\	\
\4   4S jrSrg
)rb      )init_forbid_extra
init_typedwarn_required_dynamic_aliaseswarn_untyped_fieldsr   r   r   r   r   r   r_   rJ   Nc                    UR                   c  g [        UR                   5      nUbw  UR                  S0 5      R                  S0 5      nU R                   HD  nUR                  US5      n[	        U[
        5      (       d  [        SU 35      e[        XU5        MF     g [        5       nUR                  UR                   5        U R                   H$  nUR                  [        USS9n[        XU5        M&     g )NtoolrG   Fz/Configuration value must be a boolean for key: )fallback)config_file
parse_tomlget	__slots__rw   bool
ValueErrorsetattrr   read
getbooleanCONFIGFILE_KEY)rh   r_   toml_configconfigkeysettingrc   s          rT   rg   PydanticPluginConfig.__init__   s    & !4!45" __VR044_bIF~~ **S%0!'400$'VWZV[%\]]7+	 & )NMw223~~'22>3QV2W7+ &rV   c                 X    U R                    Vs0 s H  o[        X5      _M     sn$ s  snf ra   )r   r   )rh   r   s     rT   rd   PydanticPluginConfig.to_data  s&    37>>B>CWT''>BBBs   'r   )r   r   r   r   r   r   __annotations__r+   rg   r   r   r   rd   r   r   rV   rT   rb   rb      sR    I #''##, ,D ,&Cc3h CrV   rb   r   c                    U R                   n[        U[        5      (       a  UR                  n[        U[        5      (       a,  [        UR
                  [        5      (       a  UR
                  nOa[        U[        5      (       a  UnOISU SUR                  R                   S3n[        X0R                  U R                  5        U R                  $ UR                   R                  R                  [        5      nUc  U R                  $ UR                  S0 5      R                  S5      nUSLa4  [!        [#        UR                   5      U R                  U R                  5        U R                  $ )z+
Raise an error if orm_mode is not enabled
z
ctx.type: 
 (of type )r   orm_modeT)r   rw   r=   itemr7   r   r8   ri   r   error_unexpected_behaviorr   r   r   metadatar   METADATA_KEYerror_from_ormget_name)r   ctx_type
model_typedetailpydantic_metadatar   s         rT   r   r     s   
 xxH(H%%==(L))j9J9JH.U.U&&
	Hh	'	'
hZz(2D2D2M2M1NaP!&''3;;?&&&"0044\B &&& $$Xr266zBHtx
0#''3;;G"""rV   c                      \ rS rSr% 1 Skr\\   \S'   S\S\	SS4S jr
S(S	 jrS(S
 jrS)S jrSSS\S   4S jrS\S   SSS\SS4S jrS\S   SS4S jrS\S   S\SS4S jrS\S\S   4S jr\S\S\S\S\4S j5       r\S\\   S\4S j5       r\S\S\\\   \4   4S j5       rS\S   S \S!\S"\S\\   4
S# jr S\S   SSS\4S$ jr!\S\S   S%\S\4S& j5       r"S'r#g)*r   i  >   extrafrozenr   allow_mutationalias_generatorallow_population_by_field_nametracked_config_fieldsr   rc   rJ   Nc                     Xl         X l        g ra   _ctxrc   )rh   r   rc   s      rT   rg   !PydanticModelTransformer.__init__)  s    	*rV   c                 2   U R                   nUR                  R                  nU R                  5         U R	                  5       nU R                  U5      n[        S UR                  SS  5       5      nU R                  XCU5        U R                  U5        U R                  XCR                  SL =(       d    UR                  SL S9  U Vs0 s H  ofR                  UR                  5       _M     snUR                  5       S.UR                   ["        '   gs  snf )ap  
Configures the BaseModel subclass according to the plugin settings.

In particular:
* determines the model config and fields,
* adds a fields-aware signature for the initializer and construct methods
* freezes the class if allow_mutation = False or frozen = True
* stores the fields, config, and if the class is settings in the mypy metadata for access by subclasses
c              3   F   #    U  H  n[        U5      [        :H  v   M     g 7fra   )rn   BASESETTINGS_FULLNAMErp   s     rT   rs   5PydanticModelTransformer.transform.<locals>.<genexpr>=  s     `R_$,t,0EER_ru   NFT)r   )fieldsr   )r   r   r   adjust_validator_signaturescollect_configcollect_fieldsry   rz   add_initializeradd_construct_method
set_frozenr   r   name	serializeset_values_dictr   r   )rh   r   r   r   r  is_settingsfields          rT   r   "PydanticModelTransformer.transform-  s     iiww||((*$$&$$V,`RVRZRZ[^\^R_``V[9!!&)'<'<'E'^Z^I^_BHI&zz5??#44&I,,.'
l#Is   
$Dc                    U R                   R                  R                  R                  R	                  5        H  u  p[        UR                  [        5      (       d  M&  UR                  R                  S   n[        U[        5      (       d  MV  [        UR                  [        5      (       d  Mw  UR                  R                  [         S3:X  d  M  SUR                  R                  l        M     g)a3  When we decorate a function `f` with `pydantic.validator(...), mypy sees
`f` as a regular method taking a `self` instance, even though pydantic
internally wraps `f` with `classmethod` if necessary.

Teach mypy this by marking any function whose outermost decorator is a
`validator()` call as a classmethod.
r   z.class_validators.validatorTN)r   r   r   namesr   rw   rx   r   original_decoratorsr   calleer    rk   
_NAMESPACEfuncis_class)rh   r  r}   	first_decs       rT   r  4PydanticModelTransformer.adjust_validator_signaturesF  s     ++11779ID#((I..HH88;	y(33"9#3#3X>>!((11
|C^5__-1CHHMM* :rV   ModelConfigDatac                 r   U R                   nUR                  n[        5       nUR                  R                   H  n[        U[        5      (       d  M  UR                  S:X  d  M,  UR                  R                   H:  n[        U[        5      (       d  M  UR                  U R                  U5      5        M<     UR                  (       d  M  UR                  (       a  M  U R                  R                  (       d  M  [        UR                   U5        M     UR"                  R$                  SS  H  n[&        UR(                  ;  a  M  UR                   R+                  [-        [/        U5      5      5        UR(                  [&           S   R1                  5        H  u  pxUR3                  Xx5        M     M     U$ )zj
Collects the values of the config attributes that are used by the plugin, accounting for parent classes.
Configr   Nr   )r   r   r  defsbodyrw   r   r  r   updateget_config_updatehas_alias_generatorr   rc   r   error_required_dynamic_aliasesr   r   rz   r   r   add_plugin_dependencyr5   rn   r   
setdefault)	rh   r   r   r   stmtsubstmtr   r  values	            rT   r  'PydanticModelTransformer.collect_configX  sA    iigg "HHMMDdH--yyH$#yy~~G%g~>> MM$"8"8"AB  .
 ..."AAA**HHH2377DA " HHLL$D4==0 GG))*?T@R*ST#}}\:8DJJL!!$.  M % rV   model_configPydanticModelFieldc                   ^ U R                   nU R                   R                  n/ n[        5       nUR                  R                   GH  n[        U[        5      (       d  M  UR                  S   n[        U[        5      (       a  [        UR                  5      (       d  M[  UR                  (       d1  U R                  R                  (       a  [        UR                  U5        UR                   R"                  R%                  UR                  5      nUc  M  UR&                  n	[        U	[(        5      (       a  M  [        U	[*        5      (       d  GM  U	R,                  (       a  GM   U R/                  X6U5      n
U R1                  U5      u  pU(       aB  UR2                  (       d1  U R                  R4                  (       a  [7        UR                  U5        UR9                  [;        UR                  U
UUUR<                  UR>                  S95        URA                  UR                  5        GM     URC                  5       nUR                   RD                  SS  H  n[F        URH                  ;  a  M  / nUR                  RK                  [M        [O        U5      5      5        URH                  [F           S   RQ                  5        Hv  u  mnTU;  a:  [:        RS                  UU5      nURA                  T5        UR9                  U5        MF  U4S jU 5       u  nURU                  U5        UR9                  U5        Mx     X-   nM     U$ )zB
Collects the fields for the model, accounting for parent classes
r   Nr  is_requiredaliashas_dynamic_aliaslinecolumnr   r  c              3   J   >#    U  H  oR                   T:X  d  M  Uv   M     g 7fra   )r  )rq   ar  s     rT   rs   :PydanticModelTransformer.collect_fields.<locals>.<genexpr>  s     H:a4:s   #	#)+r   r   setr  r  rw   r   lvaluesr    rE   r  
new_syntaxrc   r   error_untyped_fieldsr   r   r  r   rx   r"   r*   is_classvarget_is_requiredget_alias_infor   r   r"  appendr*  r0  r1  addcopyrz   r   r   r#  r5   rn   r   deserializeremove)rh   r)  r   r   r  known_fieldsr%  lhsr}   rx   r-  r.  r/  
all_fieldsr   superclass_fieldsdatar  r  s                     @rT   r  'PydanticModelTransformer.collect_fieldsw  s~   
 iiiimmuHHMMDdN33,,q/Cc8,,N3884L4L??t'9'9'M'M$SWWd3
 ((..$$SXX.C{ 88D$00 dC((  ..s#>K'+':':4'@$E!$CC&&DD.sww=MM" +&7;;	 SXX&k "l [[]
HHLL$D4==0 "GG))*?T@R*ST"mmL9(CIIK
d|+.::4FE $$T*%,,U3H:HHU%%e,%,,U3 L +7J# %$ rV   r  r   r  c                    U R                   nU R                  R                  nUR                  SLnU=(       d-    [	        UR
                  =(       a    UR                  (       + 5      nU R                  XXvS9nU R                  X5      (       dC  [        S5      n	UR                  [        U	[        [        R                  5      S[        5      5        SUR                  R                   R"                  ;  a  [%        USU['        5       5        gg)z
Adds a fields-aware `__init__` method to the class.

The added `__init__` will be annotated with types vs. all `Any` depending on the plugin settings.
Ttypedforce_all_optional	use_aliaskwargsNrg   )r   rc   r   r   r   r!  get_field_argumentsshould_init_forbid_extrar*   r<  r   r6   r<   explicitr   r   r   r  
add_methodr9   )
rh   r  r   r  r   rI  rK  rJ  init_argumentsvars
             rT   r  (PydanticModelTransformer.add_initializer  s     ii""--99E	( 
D&&Tv/T/T+T-
 114F 2 
 ,,V<<h-C!!(3	8J8J0KTS\"]^SWW\\///sJ
C 0rV   c           
         U R                   nUR                  R                  [         S3UR                  R                  [         S35      /5      n[	        U[        5       /5      n[        [        SU5      US[        5      nU R                  USSSS9nU/U-   nUR                  R                  [         S35      nS	nUR                  R                  S
-   U-   n	[        S:  a  [        UU	[        S:  a!  [        SUR                  R                  S-   S9O
[        S5      / U[        [         R"                  5      5      n
[%        UU	/ U[        [         R"                  5      5      nO['        XS/ U5      n
[%        X/ U5      n[)        [*        U5      UR                  R,                  R.                  U'   [1        U
[        5      (       a  U
nO[        U
5      n[3        USUUUU
SS9  g)z
Adds a fully typed `construct` classmethod to the class.

Similar to the fields-aware __init__ method, but always uses the field names (not aliases),
and does not treat settings fields as optional.
z.setz.str_fields_setNTFrH  z.object_PydanticBaseModelrM   )r      )r      r  z
.construct)	namespace	construct)return_type	self_typetvar_defis_classmethod)r   r   
named_typeBUILTINS_NAMEr@   r9   r   r*   r   rM  r   rk   r   r?   r>   r6   r<   from_omitted_genericsr)   rF   r&   r   r   r  rw   rP  )rh   r  r   set_stroptional_set_strfields_set_argumentconstruct_argumentsobj_typeself_tvar_nametvar_fullnametvdself_tvar_exprr\  s                rT   r	  -PydanticModelTransformer.add_construct_method  s    ii''$$d%;cgg>P>PTaSbbfQg>h=ij$gxz%:;&s=:J'KM]_celm"66vT^cot6u236II77%%w&?@-((3.?' *W4 bCGG,<,<|,KL"2	778C )	778N ^BHMC(HUN-<T>-R>* c;''I#C(I!	
rV   r   c                    U R                   nUR                  R                  nU GHC  nUR                  R	                  UR
                  5      nUb  UR                  n[        U[        5      (       a  X'l	        MU  [        U[        5      (       a7  UR                  R                  (       d  UR                  R                  5         M   [        U5      nSU SUR"                   S3n	[%        XR                  UR                  5        M  UR'                  USS9nXGl        X'l	        [)        U5      S-   [+        U5      -   Ul        [/        [0        U5      UR                  [+        U5      '   GMF     g! [         a    [!        U5      n Nf = f)z
Marks all fields as properties so that attempts to set them trigger mypy errors.

This is the same approach used by the attrs and dataclasses plugins.
Nzsym_node.node: r   r   F)rK  rM   )r   r   r   r  r   r  rx   rw   r*   is_propertyr"   r   final_iterationdeferr   	TypeErrorreprri   r   to_varrn   r   	_fullnamer&   r   )
rh   r  r   r   r   r  sym_noderR  var_strr   s
             rT   r
  #PydanticModelTransformer.set_frozen  s%    iiww||Ezz~~ejj1H#mmc3''&,O_55cgg>U>UGGMMO,"%c(  /wiz#--PQRF-fggswwGll45l9"( ,T 2S 88C= H,;D#,F

8C=)/  % ,"&s),s   E..FFr&  c                    UR                   S   n[        U[        5      (       a  UR                  U R                  ;   d  gUR                  S:X  a  [        UR
                  [        5      (       a  UR
                  R                  S:H  nOe[        UR
                  [        5      (       a  UR
                  R                  S:H  nO,[        UR                  U R                  R                  U5        g[        US9$ UR                  S:X  aF  Sn[        UR
                  [        5      (       a  UR
                  R                  S:X  a  S	n[        US
9$ [        UR
                  [        5      (       aH  UR
                  R                  S;   a.  [        S0 UR                  UR
                  R                  S:H  0D6$ [        UR                  U R                  R                  U5        g)z
Determines the config update due to a single statement in the Config class definition.

Warns if a tracked config attribute is set to a value the plugin doesn't know how to interpret (e.g., an int)
r   Nr   forbid)forbid_extrar   Tzbuiltins.NoneF)r!  )builtins.Truezbuiltins.Falserz  r   )r6  rw   r    r  r   rvaluer$   r'  r   error_invalid_config_valuer   r   r  rk   )rh   r&  rB  ry  r!  s        rT   r   *PydanticModelTransformer.get_config_update<  s[    ooa 3))chh$:T:T.T88w'..'22&~~33x?GNNJ77&~~22h>*388TYY]]GL"==88(("&'..(338O8OSb8b&+#"7JKKgnnh//GNN4K4KOr4r"\chh0G0G?0Z%[\\"388TYY]]GDrV   r   r%  rB  c                    UR                   n[        U[        5      (       aF  [        U R                  UR
                     R                  5      n[        R                  U5      (       + $ [        U[        5      (       a  [        UR                  [        5      (       a  UR                  R                  [        :X  a  [        UR                  UR                   5       H*  u  pVUb  US:X  a  UR"                  [$        L s  $ US:X  d  M*    g   [        U R                  UR
                     R                  5      n[        R                  U5      (       + $ [        U[$        5      $ )zW
Returns a boolean indicating whether the field defined in `stmt` is a required field.
r   r   F)r{  rw   r'   rA   r   r  r   r   type_has_implicit_defaultr   r  r#   rk   r   zipr   	arg_namesri   r   )r   r%  rB  expr
value_typer   r  s          rT   r:  (PydanticModelTransformer.get_is_requiredX  s    
 {{dH%%(#(();)@)@AJ/II*UUUdH%%*T[['*J*Jt{{OcOcguOu !DNN;	<49#4==L88,,  < )#(();)@)@AJ/II*UUU$--rV   type_c                     [        U [        5      (       a  g[        U [        5      (       a"  [        S U R                   5       5      (       a  gg)z
Returns True if the passed type will be given an implicit default value.

In pydantic v1, this is the case for Optional types and Any (with default value None).
Tc              3   p   #    U  H,  n[        U[        5      =(       d    [        U[        5      v   M.     g 7fra   )rw   r9   r6   )rq   r   s     rT   rs   EPydanticModelTransformer.type_has_implicit_default.<locals>.<genexpr>|  s*      0
P[JtX&C*T7*CCP[s   46F)rw   r6   r@   ry   r   )r  s    rT   r  2PydanticModelTransformer.type_has_implicit_defaultr  sH     eW%%eY''C 0
PUP[P[0
 -
 -
 rV   c                    U R                   n[        U[        5      (       a  g[        U[        5      (       a=  [        UR                  [
        5      (       a  UR                  R                  [        :X  d  g[        UR                  5       HA  u  p#US:w  a  M  UR                  U   n[        U[        5      (       a  UR                  S4s  $   g   g)a   
Returns a pair (alias, has_dynamic_alias), extracted from the declaration of the field defined in `stmt`.

`has_dynamic_alias` is True if and only if an alias is provided, but not as a string literal.
If `has_dynamic_alias` is True, `alias` will be None.
)NFr.  F)NT)r{  rw   r'   r   r  r#   rk   r   	enumerater  r   r$   r'  )r%  r  iarg_namer   s        rT   r;  'PydanticModelTransformer.get_alias_info  s     {{dH%% tX&&:dkk7+K+KPTP[P[PdPdhvPv $T^^4KA7"))A,C#w''yy%''! 5 rV   rI  rJ  rK  c           
          U R                   R                  R                  nU Vs/ s H-  nU(       a  UR                  (       a  M  UR	                  XRX4S9PM/     nnU$ s  snf )z
Helper function used during the construction of the `__init__` and `construct` method signatures.

Returns a list of mypy Argument instances for use in the generated signatures.
)rI  force_optionalrK  )r   r   r   r/  to_argument)rh   r  rI  rJ  rK  r   r  	argumentss           rT   rM  ,PydanticModelTransformer.get_field_arguments  se     yy}}!!  
%"9"9 iEd@Rh 	 

 
s   AAc                     UR                   (       d+  U R                  U[        UR                  5      5      (       a  gUR                  (       a  gU R
                  R                  $ )a(  
Indicates whether the generated `__init__` should get a `**kwargs` at the end of its signature

We disallow arbitrary kwargs if the extra config setting is "forbid", or if the plugin config says to,
*unless* a required dynamic alias is present (since then we can't determine a valid signature).
FT)r   is_dynamic_alias_presentr   r!  ry  rc   r   )rh   r  r   s      rT   rN  1PydanticModelTransformer.should_init_forbid_extra  sL     44,,VT&:T:T5UVV!!333rV   r!  c                 z    U  H  nUR                   (       d  M    g   U(       a  U  H  nUR                  b  M    g   g)z
Returns whether any fields on the model have a "dynamic alias", i.e., an alias that cannot be
determined during static analysis.
TF)r/  r.  )r  r!  r  s      rT   r  1PydanticModelTransformer.is_dynamic_alias_present  s>     E&&&  ;;&   rV   r   )rJ   N)rJ   r  )$r   r   r   r   r   r	   r   r   r-   rb   rg   r   r  r  r   r  r   r  r	  r
  r   r   r   staticmethodr   r    r:  r;   r  r
   r;  r   rM  rN  r  r   r   rV   rT   r   r     s   '3s8 +O +<P +UY +
22$>R+< RFZA[ RhDd+?&@ DJ[ Djn Dsw D,8
40D+E 8
$ 8
tG&:!; GT Gd GB HEV<W 8 .X .^ .( .t . .2 *)= $    ^ hsmT6I0J  8/09=SWdh	h 4t4H/I 4Sd 4im 4 .B)C Z^ cg  rV   r   c                       \ rS rSrS\S\S\\   S\S\S\4S jrS	\	S
\S\
4S jrS	\	S\S\S
\S\4
S jrS\4S jr\S	\	S\SS 4S j5       rSrg)r*  i  r  r-  r.  r/  r0  r1  c                 L    Xl         X l        X0l        X@l        XPl        X`l        g ra   r,  )rh   r  r-  r.  r/  r0  r1  s          rT   rg   PydanticModelField.__init__  s$     	&
!2	rV   r   rK  rJ   c                     U R                   nU(       a  U R                  b  U R                  n[        X1U R                      R                  5      $ ra   )r  r.  r*   r   )rh   r   rK  r  s       rT   rr  PydanticModelField.to_var  s9    yy/::D4dii--..rV   rI  r  c                 $   U(       a2  XR                      R                  b  XR                      R                  nO[        [        R                  5      n[        U R                  X5      US U(       d  U R                  (       d  [        S9$ [        S9$ )N)variabletype_annotationinitializerkind)
r  r   r6   r<   rO  r   rr  r-  r   r   )rh   r   rI  r  rK  r  s         rT   r  PydanticModelField.to_argument  st    T))_))5"99o22O%i&8&89O[[1+"08H8H	
 	
 OX	
 	
rV   c                     U R                   $ ra   )__dict__)rh   s    rT   r  PydanticModelField.serialize  s    }}rV   rE  c                     U " S0 UD6$ )Nr   r   )r   r   rE  s      rT   r?  PydanticModelField.deserialize  s    {T{rV   )r.  r1  r/  r-  r0  r  N)r   r   r   r   r   r   r   rP   rg   r(   r*   rr  r   r  r   r  classmethodr?  r   r   rV   rT   r*  r*    s    &*3;C=UYadnq/8 / / /

 

 

t 

X\ 

ai 

8  x x <P  rV   r*  c                       \ rS rSr      SS\\   S\\   S\\   S\\   S\\   S\\   4S	 jjrS
\\\	4   4S jr
S\S    S
S4S jrS\S\	S
S4S jrSrg)r  i  Nry  r   r   r   r   r!  c                 L    Xl         X l        X0l        X@l        XPl        X`l        g ra   )ry  r   r   r   r   r!  )rh   ry  r   r   r   r   r!  s          rT   rg   ModelConfigData.__init__  s&     ), .L+#6 rV   rJ   c                 v    U R                   R                  5        VVs0 s H  u  pUc  M
  X_M     snn$ s  snnf ra   )r  r   )rh   kvs      rT   r  ModelConfigData.set_values_dict  s1    !%!4!4!6H!6!!6HHHs   	55r   c                 r    Uc  g UR                  5       R                  5        H  u  p#[        XU5        M     g ra   )r  r   r   )rh   r   r  r  s       rT   r  ModelConfigData.update  s2    >**,224DADQ 5rV   r   r'  c                 6    [        X5      c  [        XU5        g g ra   )r   r   )rh   r   r'  s      rT   r$  ModelConfigData.setdefault  s    4%Du% &rV   )r   r   ry  r   r!  r   )NNNNNN)r   r   r   r   r   r   rg   r   r   r   r  r  r$  r   r   rV   rT   r  r    s     (,)-!%#'9=.27tn7 !7 	7
 4.7 )17 &d^7 Ic3h I X&78  T  &c &# &$ &rV   r  zpydantic-ormzInvalid from_orm callPydanticzpydantic-configzInvalid config valuezpydantic-aliaszDynamic alias disallowedzpydantic-unexpectedzUnexpected behaviorzpydantic-fieldzUntyped field disallowedzInvalid Field defaults
model_namer   r   c                 6    UR                  SU  S3U[        S9  g )N"z" does not have orm_mode=Truecode)fail	ERROR_ORM)r  r   r   s      rT   r   r     s    HHq9:G)HTrV   r  c                 6    UR                  SU  S3U[        S9  g )NzInvalid value for "Config.r  r  )r  ERROR_CONFIG)r  r   r   s      rT   r|  r|    s    HH)$q17HNrV   c                 .    U R                  SU[        S9  g )Nz#Required dynamic aliases disallowedr  )r  ERROR_ALIASr   r   s     rT   r"  r"  "  s    HH2G+HNrV   r   c                 N    SnSU  S3nUSU S3-  nUR                  XB[        S9  g )Nz6https://github.com/pydantic/pydantic/issues/new/choosez7The pydantic mypy plugin ran into unexpected behavior: 
z&Please consider reporting this bug at z so we can try to fix it!r  )r  ERROR_UNEXPECTED)r   r   r   linkfull_messages        rT   r   r   &  s?     DDLVHTVWL<TFB[\\LHH\)9H:rV   c                 .    U R                  SU[        S9  g )NzUntyped fields disallowedr  )r  ERROR_UNTYPEDr  s     rT   r8  r8  0  s    HH('HFrV   c                 .    U R                  SU[        S9  g )Nz>Field default and default_factory cannot be specified togetherr  )r  ERROR_FIELD_DEFAULTSr  s     rT   r   r   4  s    HHMw]qHrrV   r   r[  r\  r]  r^  is_newc                    U R                   R                  nXR                  ;   ax  UR                  U   n	U	R                  (       aX  [	        U	R
                  [        5      (       a9  U R                   R                  R                  R                  U	R
                  5        U=(       d    [        U5      nU(       d  U(       a1  [        [        S5      [        R                  " U5      S[        5      /n
O0U=(       d    [        U5      n[        [        S5      US[        5      /n
X-   n/ / / pnU Hu  nUR                   (       d   S5       eUR#                  UR                   5        UR#                  [%        UR&                  5      5        UR#                  UR(                  5        Mw     U R*                  R-                  [.         S35      n[1        XXU5      nU(       a  U/Ul        [        X[5        [7        5       /5      5      nUUl        [9        UU5      Ul        UUl        [?        U5      S-   U-   Ul         URB                  Ul!        XR                  ;   a1  [E        XR                  5      nUR                  U   UR                  U'   U(       au  SUl#        [        UUR:                  5      nUUl        UR@                  Ul         SUl$        [K        U[M        S5      /U5      nURB                  Ul!        [O        [P        U5      n	O[O        [P        U5      n	SU	l        XR                  U'   URR                  R                  R                  R#                  U5        g)	zq
Adds a new method to a class.

This can be dropped if/when https://github.com/python/mypy/issues/7301 is merged
_clsN__pydantic_self__z"All arguments must be fully typed.z	.functionrM   Tr  )*r   r   r  plugin_generatedrw   rx   r   r  r  r@  rB   r   r*   r=   make_normalizedr   r  r<  r   r  r  r   r_  r`  r7   	variablesr   r!   r4   r   r  rn   rs  r0  rC   is_decoratedr^  r   r    r&   r   defn)r   r  r   r[  r\  r]  r^  r  r   r}   firstr   r  	arg_kindsr   function_type	signaturer  r_namer  decs                        rT   rP  rP  8  s     77<<D zzjjJsxx$A$AGGLL$$SXX.0]40I#f+x'?'?	'JDRYZ[ 4t!4	#12ItWMN<D&("b)I""H$HH",,-#,,/0"	  GG&&-	'BCMY9=YI'j	4uhj\23DDI!)T2DI"DM!$'#-4DN		DI zz-dJJ?!ZZ-

6 dii nnx67;
 99dC(dD)CJJtIINNt$rV   xc                 L    U R                   n[        U5      (       a  U" 5       $ U$ z[
Used for compatibility with mypy 0.740; can be dropped once support for 0.740 is dropped.
)rk   callabler  fns     rT   rn   rn     s"     
B||tIrV   c                 L    U R                   n[        U5      (       a  U" 5       $ U$ r  )r  r  r  s     rT   r   r     s"     
B||tIrV   r   c                 X   U R                  S5      (       d  g Sn[        R                  S:  a  SS KnO SS Kn[        X5       nUR                  U5      sS S S 5        $ ! [
         a0    Sn SS Kn N9! [
         a    SS KnUR                  S5          g f = ff = f! , (       d  f       g = f)Nz.tomlrb)   rX  r   rzJNo TOML parser installed, cannot read configuration from `pyproject.toml`.)r   sysversion_infotomllibtomliImportErrortomlwarningswarnopenload)r   	read_modetoml_r  rfs        rT   r   r     s    ((I
7"	! 
k	%zz"~ 
&	%  		I$ jk			 
&	%s5   A BB+A11BBBB
B))NNFF)|r  configparserr   typingr   r   r   r   r   r	   r
   r   
TypingTyper   mypy.errorcodesr   
mypy.nodesr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   mypy.optionsr+   mypy.pluginr,   r-   r.   r/   r0   r1   r2   mypy.pluginsr3   mypy.semanalr4   mypy.server.triggerr5   
mypy.typesr6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   mypy.typevarsrB   	mypy.utilrC   mypy.versionrD   mypy_versionpydantic.v1.utilsrE   rF   r  r   r   r   r  ro   r  r   r   r   r   rP   rU   r   r`  r\   r[   rb   r   r   r*  r  r  r  r  r  r  r  r   r|  r"  r   r8  r   r   rP  rn   r   r   r   rV   rT   <module>r     s   
 % ] ] ] %       > !   % * 5    ( 2 4 ,5%
 !'cr]
"|?3 %,&@A (\)=> <}-"|#9: A Ac3h A (5 0H<
. C 0 r V r j"C "CJ#= #T #2l l^" "J& &> n&=zJ	*,BJO(*DjQ24I:V *,F
S !13KZX Us U)? U' UVZ UOS O/N OY` Oei OO(G ORY O^b O;;24SST;_f;	;G= G GTX Gs5K sV] sbf s !%%) P%	P%
P% x.P% 	P%
 ~P% z"P% P% P% 
P%fE(J./ C h
*+  C HT#s(^$< m  5445s   H2 2II