AlkantarClanX12

Your IP : 3.137.175.80


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/pydantic/v1/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/pydantic/v1/__pycache__/mypy.cpython-311.pyc

�

X��eY�����ddlZddlmZddlmZmZmZmZmZm	Z	m
Z
mZm
Z
ddlmZddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-ddl.m/Z/ddl0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7ddl8m9Z9dd	l:m;Z;dd
l<m=Z=ddl>m?Z?m@Z@mAZAmBZBmCZCmDZDmZmEZEmFZFmGZGmHZHmIZIddlJmKZKdd
lLmMZMddlNmOZPddlQmRZR	ddl>mSZSn#eT$r	ddl>mGZSYnwxYwdZUdZVeWdd�ZXeX�d�ZYeX�d�ZZeX�d�Z[eX�d�Z\eX�d�Z]de^de
e_dffd�Z`e`eP��Zaeadkrdnd Zbd!ZOde^dd"fd#�ZcGd$�d%e5��ZdGd&�d'��Zed(e4defd)�ZfGd*�d+��ZgGd,�d-��ZhGd.�d/��Zied0d1d2��Zjed3d4d2��Zked5d6d2��Zled7d8d2��Zmed9d:d2��Zned9d;d2��Zod<e^d=e1d>eddfd?�Zpd@e^d=e7d>eddfdA�Zqd=e7d>eddfdB�ZrdCe^d=e
e1e7fd>eddfdD�Zsd=e7d>eddfdE�Ztd=e1d>eddfdF�Zu				dTd(e2d@e^dHeedIedJeedKeeSdLevdMevddfdN�ZwdOe
ee(fde^fdP�ZxdOe
ee(fde^fdQ�ZydRe^deee^effdS�ZzdS)U�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�TypeVarType�	UnionType�get_proper_type)�
fill_typevars)�get_unique_redefinition_name)�__version__)�is_valid_field)�
TypeVarDef)r>�
pydantic-mypyzpydantic-mypy-metadata���z.main.BaseModelz.env_settings.BaseSettingsz.main.ModelMetaclassz
.fields.Fieldz.dataclasses.dataclass�version�return.c��ttt|�d��d�d������S)N�+r�.)�tuple�map�int�	partition�split�rHs �E/opt/cloudlinux/venv/lib/python3.11/site-packages/pydantic/v1/mypy.py�parse_mypy_versionrTVs;����S�'�+�+�C�0�0��3�9�9�#�>�>�?�?�@�@�@�)ri��builtins�__builtins__�zTypingType[Plugin]c��tS)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).
    )�PydanticPluginrRs rS�pluginr[as
���rUc�"��eZdZdeddf�fd�Zdeddfd�Zdedeee	gdffd�Z
dedd	fd
�Zdedeeege
ffd�Zdedeee	gdffd�Zd
edeeeffd�Zd
e	ddfd�Zd
e	ddfd�Zd
eddfd�Z�xZS)rZ�optionsrINc���t|��|_|j���|_t	���|��dS�N)�PydanticPluginConfig�
plugin_config�to_data�_plugin_data�super�__init__)�selfr]�	__class__s  �rSrezPydanticPlugin.__init__lsH���1�'�:�:��� �.�6�6�8�8���
������!�!�!�!�!rU�fullnamez+Optional[Callable[[ClassDefContext], None]]c��|�|��}|rDt|jt��r*t	d�|jjD����r|jSdS)Nc3�FK�|]}t|��tkV��dSr_)�get_fullname�BASEMODEL_FULLNAME��.0�bases  rS�	<genexpr>z5PydanticPlugin.get_base_class_hook.<locals>.<genexpr>us0����U�U��<��%�%�);�;�U�U�U�U�U�UrU)�lookup_fully_qualified�
isinstance�noder(�any�mro�$_pydantic_model_class_maker_callback�rfrh�syms   rS�get_base_class_hookz"PydanticPlugin.get_base_class_hookqsd���)�)�(�3�3���	A�:�c�h��1�1�	A��U�U����U�U�U�U�U�
A��@�@��trUc�*�|tkr|jSdSr_)�MODEL_METACLASS_FULLNAME�)_pydantic_model_metaclass_marker_callback�rfrhs  rS�get_metaclass_hookz!PydanticPlugin.get_metaclass_hookys���/�/�/��A�A��trUz+Optional[Callable[[FunctionContext], Type]]c�b�|�|��}|r|jtkr|jSdSr_)rqrh�FIELD_FULLNAME�_pydantic_field_callbackrws   rS�get_function_hookz PydanticPlugin.get_function_hook~s7���)�)�(�3�3���	1�3�<�>�1�1��0�0��trUc�>�|�d��rtSdS)Nz	.from_orm)�endswith�from_orm_callbackr}s  rS�get_method_hookzPydanticPlugin.get_method_hook�s#�����[�)�)�	%�$�$��trUc�J�|tkrtdkrtjSdS)z�Mark 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  rS�get_class_decorator_hookz'PydanticPlugin.get_class_decorator_hook�s)��
�)�)�)�.@�6�.I�.I��=�=��trU�ctxc��|jS)zjReturn all plugin config data.

        Used by mypy to determine if cache needs to be discarded.
        )rc)rfr�s  rS�report_config_dataz!PydanticPlugin.report_config_data�s
��
� � rUc�X�t||j��}|���dSr_)�PydanticModelTransformerra�	transform)rfr��transformers   rSrvz3PydanticPlugin._pydantic_model_class_maker_callback�s,��.�s�D�4F�G�G���������rUc��|jjrdS|jjj}|s
Jd���t|jdd��rd|j_dSdS)z�Reset 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)ra�debug_dataclass_transform�cls�info�declared_metaclass�getattr�typer�)rfr��info_metaclasss   rSr|z8PydanticPlugin._pydantic_model_metaclass_marker_callback�sn����7�	��F����8���N�N�N�N�N�N��>�&�(B�D�I�I�	@�;?�N��8�8�8�	@�	@rUrc���	�|j�	|jddks
Jd���|jddks
Jd���|jd}|jd}|r|rt|j|j���	S|r3|jdd}|d}t|t��s|Sn�|r�|jdd}t|t��r3tdkr|jd}n|���d}t|t��rU|j
}t|dd	��}|r9td
�|D����r t!�	fd�|D����|_|S�	S)ax
        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())ri��argsNc3�@K�|]}t|t��V��dSr_)rrr>)rn�args  rSrpz:PydanticPlugin._pydantic_field_callback.<locals>.<genexpr>�s,����H�H�C�:�c�;�7�7�H�H�H�H�H�HrUc3��K�|]}�V��dSr_�)rn�_�default_any_types  �rSrpz:PydanticPlugin._pydantic_field_callback.<locals>.<genexpr>�s$�����-M�-M�1�.>�-M�-M�-M�-M�-M�-MrU)�default_return_type�callee_arg_namesr��+error_default_and_default_factory_specified�api�context�	arg_typesrrrr:r��itemsr7�ret_typer��allrM)
rfr��default_args�default_factory_args�default_type�default_arg�default_factory_typer�r�r�s
         @rSr�z'PydanticPlugin._pydantic_field_callback�s�����2���#�A�&�)�3�3�3�5g�3�3�3��#�A�&�*;�;�;�;�=x�;�;�;��x��{��"�x��{���	$�0�	$�7�����M�M�M�#�#��	 ��=��+�A�.�L�&�q�/�K��k�<�8�8�
$�#�#�
$�"�	 �#&�=��#3�A�#6� ��.�
�;�;�
K�%��0�0�+?�+E�a�+H�(�(�,@�+E�+E�+G�+G��+J�(��.��=�=�	
 �/�8���x���6�6���N��H�H�4�H�H�H�H�H�N�(-�-M�-M�-M�-M��-M�-M�-M�(M�(M��
����rU)�__name__�
__module__�__qualname__r+re�strryrrr-r~r�r/rr�r�r1rrr�rvr|r.r��
__classcell__)rgs@rSrZrZks��������"��"�D�"�"�"�"�"�"�
�C��4a������3��8�H�o�EV�X\�E\�<]�3^�����
�#��2_����������=�/�SW�BW�9X�0Y�����
����(�O�K\�^b�Kb�Bc�9d�����!�&9�!�d�3��8�n�!�!�!�!� �� �D� � � � �@�_�@�QU�@�@�@�@�3 �O�3 ��3 �3 �3 �3 �3 �3 �3 �3 rUrZc�r�eZdZUdZeed<eed<eed<eed<eed<dedd	fd
�Zdee	e
ffd�Zd	S)r`)�init_forbid_extra�
init_typed�warn_required_dynamic_aliases�warn_untyped_fieldsr�r�r�r�r�r�r]rINc��|j�dSt|j��}|��|�di���di��}|jD]P}|�|d��}t	|t
��st
d|�����t|||���QdSt��}|�	|j��|jD]0}|�
t|d���}t|||���1dS)N�toolrFFz/Configuration value must be a boolean for key: )�fallback)�config_file�
parse_toml�get�	__slots__rr�bool�
ValueError�setattrr�read�
getboolean�CONFIGFILE_KEY)rfr]�toml_config�config�key�settingras       rSrezPydanticPluginConfig.__init__�s$����&��F� ��!4�5�5���"� �_�_�V�R�0�0�4�4�_�b�I�I�F��~�
,�
,�� �*�*�S�%�0�0��!�'�4�0�0�^�$�%\�WZ�%\�%\�]�]�]���c�7�+�+�+�+�	
,�
,�)�N�N�M����w�2�3�3�3��~�
,�
,��'�2�2�>�3�QV�2�W�W����c�7�+�+�+�+�
,�
,rUc�*���fd��jD��S)Nc�2��i|]}|t�|����Sr�)r�)rnr�rfs  �rS�
<dictcomp>z0PydanticPluginConfig.to_data.<locals>.<dictcomp>s%���B�B�B�C��W�T�3�'�'�B�B�BrU)r��rfs`rSrbzPydanticPluginConfig.to_datas���B�B�B�B�4�>�B�B�B�BrU)r�r�r�r�r��__annotations__r+rerr�rrbr�rUrSr`r`�s���������I���������#'�'�'�'�����#�#�#�#�,��,�D�,�,�,�,�&C��c�3�h��C�C�C�C�C�CrUr`r�c�l�|j}t|t��r|j}t|t��r"t|jt��r|j}nMt|t��r|}n5d|�d|jj�d�}t||j
|j��|jS|jj
�t��}|�|jS|�di���d��}|dur-t!t#|j��|j
|j��|jS)z3
    Raise an error if orm_mode is not enabled
    z
ctx.type: �
 (of type �)Nr��orm_modeT)r�rrr=�itemr7r�r8rgr��error_unexpected_behaviorr�r�r��metadatar��METADATA_KEY�error_from_orm�get_name)r��ctx_type�
model_type�detail�pydantic_metadatar�s      rSr�r�s)��
�x�H��(�H�%�%�!��=���(�L�)�)�'�j��9J�H�.U�.U�'��&�
�
�	�H�h�	'�	'�'��
�
�P�h�P�P�(�2D�2M�P�P�P��!�&�#�'�3�;�?�?�?��&�&�"��0�4�4�\�B�B��� ��&�&� �$�$�X�r�2�2�6�6�z�B�B�H��t����x�
��0�0�#�'�3�;�G�G�G��"�"rUc��eZdZUhd�Zeeed<dededdfd�Z	d&d�Z
d&d	�Zd'd�Zdd
de
d
fd�Zde
d
dd
deddfd�Zde
d
ddfd�Zde
d
deddfd�Zdeded
fd�Zededededefd���Zedeedefd���Zededeeeeffd���Zde
d
ded ed!ede
ef
d"�Zde
d
dd
defd#�Z ede
d
d$edefd%���Z!dS)(r�>�extra�frozenr��allow_mutation�alias_generator�allow_population_by_field_name�tracked_config_fieldsr�rarINc�"�||_||_dSr_)�_ctxra)rfr�ras   rSrez!PydanticModelTransformer.__init__(s����	�*����rUc���|j}|jj}|���|���}|�|��}t
d�|jdd�D����}|�|||��|�	|��|�
||jdup|jdu���d�|D��|�
��d�|jt<dS)	a�
        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
        c3�FK�|]}t|��tkV��dSr_)rk�BASESETTINGS_FULLNAMErms  rSrpz5PydanticModelTransformer.transform.<locals>.<genexpr><s0����`�`�$�,�t�,�,�0E�E�`�`�`�`�`�`rUN���FT)r�c�B�i|]}|j|�����Sr�)�name�	serialize)rn�fields  rSr�z6PydanticModelTransformer.transform.<locals>.<dictcomp>As&��I�I�I��u�z�5�?�?�#4�#4�I�I�IrU)�fieldsr�)r�r�r��adjust_validator_signatures�collect_config�collect_fieldsrtru�add_initializer�add_construct_method�
set_frozenr�r��set_values_dictr�r�)rfr�r�r�r��is_settingss      rSr�z"PydanticModelTransformer.transform,s���i���w�|���(�(�*�*�*��$�$�&�&���$�$�V�,�,���`�`�RV�RZ�[^�\^�[^�R_�`�`�`�`�`�����V�V�[�9�9�9��!�!�&�)�)�)�����v�'<��'E�'^���Z^�I^��_�_�_�I�I�&�I�I�I��,�,�.�.�'
�'
��
�l�#�#�#rUc�j�|jjjj���D]�\}}t|jt��rj|jjd}t|t��rCt|j
t��r)|j
jt�d�krd|jj_��dS)a[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.
        rz.class_validators.validatorTN)r�r�r��namesr�rrrsr�original_decoratorsr�calleer rh�
_NAMESPACE�func�is_class)rfr�rx�	first_decs    rSr�z4PydanticModelTransformer.adjust_validator_signaturesEs������+�1�7�7�9�9�	2�	2�I�D�#��#�(�I�.�.�
2��H�8��;�	��y�(�3�3�2�"�9�#3�X�>�>�2�"�(�1�
�5_�5_�5_�_�_�-1�C�H�M�*��	2�	2rU�ModelConfigDatac���|j}|j}t��}|jjD]�}t|t��s�|jdkr||jjD]@}t|t��s�|�	|�
|�����A|jr(|js!|j
jrt|j|����|jjdd�D]�}t&|jvr�|j�t-t/|������|jt&d���D]\}}|�||�����|S)zz
        Collects the values of the config attributes that are used by the plugin, accounting for parent classes.
        �Configr�Nr�)r�r�r�defs�bodyrrrr�r�update�get_config_update�has_alias_generatorr�rar��error_required_dynamic_aliasesr�r�rur�r��add_plugin_dependencyr5rkr��
setdefault)	rfr�r�r��stmt�substmtr�r��values	         rSr�z'PydanticModelTransformer.collect_configWs����i���g�� �"�"���H�M�
	B�
	B�D��d�H�-�-�
���y�H�$�$�#�y�~�C�C�G�%�g�~�>�>�!� ��M�M�$�"8�"8��"A�"A�B�B�B�B��.�B�"�A�B��*�H�B�
3�3�7�D�A�A�A���H�L����$�	/�	/�D��4�=�0�0��
�G�)�)�*?��T�@R�@R�*S�*S�T�T�T�#�}�\�:�8�D�J�J�L�L�
/�
/���e��!�!�$��.�.�.�.�
/��
rU�model_config�PydanticModelFieldc����|j}|jj}g}t��}|jjD�]�}t|t��s�|jd}t|t��rt|j
��s�P|js!|jj
rt|j|��|jj�|j
��}|���|j}	t|	t(��r��t|	t*��s��|	jr��|�|||��}
|�|��\}}|r(|js!|jjrt7|j|��|�t;|j
|
|||j|j�����|� |j
�����|�!��}
|jj"dd�D�]}tF|j$vr�g}|j�%tMtO|������|j$tFd�(��D]�\�}�|vrFt:�)||��}|� ���|�|���O�fd�|
D��\}|
�*|��|�|����||
z}
��|
S)zR
        Collects the fields for the model, accounting for parent classes
        rN�r��is_required�alias�has_dynamic_alias�line�columnr�r�c3�2�K�|]}|j�k�
|V��dSr_)r�)rn�ar�s  �rSrpz:PydanticModelTransformer.collect_fields.<locals>.<genexpr>�s)�����H�H�a���4��������H�HrU)+r�r��setrr	rrr�lvaluesr rDr��
new_syntaxrar��error_untyped_fieldsr�r�r�r�rsr"r*�is_classvar�get_is_required�get_alias_infor�r�r
�appendrrr�add�copyrur�r�rr5rkr��deserialize�remove)rfrr�r�r��known_fieldsr�lhsrxrsrrr�
all_fieldsr��superclass_fields�datar�r�s                  @rSr�z'PydanticModelTransformer.collect_fieldsvs���
�i���i�m�����u�u���H�M�5	'�5	'�D��d�N�3�3�
���,�q�/�C��c�8�,�,�
�N�3�8�4L�4L�
���?�
4�t�'9�'M�
4�$�S�W�d�3�3�3�
�(�.�$�$�S�X�.�.�C��{���8�D��$��0�0�
���d�C�(�(�
����
���.�.�s�D�#�>�>�K�'+�':�':�4�'@�'@�$�E�$�!�
>�$�C�
>��&�D�
>�
/�s�w��=�=�=��M�M�"��� +��&7����;�
���	
�	
�	
�
���S�X�&�&�&�&��[�[�]�]�
��H�L����$�	8�	8�D��4�=�0�0�� "���G�)�)�*?��T�@R�@R�*S�*S�T�T�T�"�m�L�9�(�C�I�I�K�K�
4�
4�
��d��|�+�+�.�:�:�4��F�F�E� �$�$�T�*�*�*�%�,�,�U�3�3�3�3�H�H�H�H�:�H�H�H�H�U��%�%�e�,�,�,�%�,�,�U�3�3�3�3�*�Z�7�J�J��rUr�r�r�c���|j}|jj}|jdu}|pt	|jo|j��}|�||||���}|�||��sPtd��}	|�	t|	ttj
��dt����d|jjjvr t%|d|t'����dSdS)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�kwargsNre)r�rar�r�r�r�get_field_arguments�should_init_forbid_extrar*r%rr6r<�explicitrr�r�r��
add_methodr9)
rfr�r�r�r�r1r3r2�init_arguments�vars
          rSr�z(PydanticModelTransformer.add_initializer�s����i���"�-���9��E�	�(�
�D��&�T�v�/T�+T�-
�-
���1�1��%�4F�R[�2�
�
���,�,�V�V�<�<�	_��h�-�-�C��!�!�(�3��	�8J�0K�0K�T�S\�"]�"]�^�^�^��S�W�\�/�/�/��s�J���
�
�C�C�C�C�C�0�/rUc
��|j}|j�t�d�|j�t�d���g��}t	|t��g��}t
td|��|dt��}|�	|ddd���}|g|z}|j�t�d���}d	}|j
jd
z|z}	tdkrVt||	dg|ttj����}
t#||	g|ttj����}n%t%||	dg|��}
t#||	g|��}t't(|��|j
jj|<t/|
t��r|
}nt|
��}t1|d
||||
d���dS)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_setNTFr0z.object�_PydanticBaseModelrL)r��r��	construct)�return_type�	self_type�tvar_def�is_classmethod)r�r��
named_type�
BUILTINS_NAMEr?r9rr*rr5r�rhr�r>r6r<�from_omitted_genericsr)rEr&rr�r�rrr8)
rfr�r��set_str�optional_set_str�fields_set_argument�construct_arguments�obj_type�self_tvar_name�
tvar_fullname�tvd�self_tvar_exprrAs
             rSr�z-PydanticModelTransformer.add_construct_method�s����i���'�$�$�
�%;�%;�%;�c�g�>P�>P�Ta�Qg�Qg�Qg�>h�>h�=i�j�j��$�g�x�z�z�%:�;�;��&�s�=�:J�'K�'K�M]�_c�el�m�m��"�6�6�v�T�^c�ot�6�u�u��2�3�6I�I���7�%�%��&?�&?�&?�@�@��-����(�3�.��?�
���'�'��������	�7�8�8�
��C�)������	�7�8�8���N�N��^�]�B��H�M�M�C�(����H�U�U�N�-<�T�>�-R�-R�����>�*��c�;�'�'�	)��I�I�#�C�(�(�I�����!����	
�	
�	
�	
�	
�	
rUr�c���|j}|jj}|D�]S}|j�|j��}|��|j}t|t��r||_	�Ht|t��r&|jjs|j�
����	t|��}n#t$rt!|��}YnwxYwd|�d|j�d�}	t%|	|j|j����|�|d���}||_||_	t)|��dzt+|��z|_t/t0|��|jt+|��<��UdS)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.
        Nzsym_node.node: r�r�F)r3rL)r�r�r�r�r�r�rsrrr*�is_propertyr"r��final_iteration�deferr��	TypeError�reprrgr��to_varrkr��	_fullnamer&r)
rfr�r�r�r�r��sym_noder:�var_strr�s
          rSr�z#PydanticModelTransformer.set_frozenss���i���w�|���	G�	G�E��z�~�~�e�j�1�1�H��#��m���c�3�'�'�
H�&,�C�O�O���_�5�5�H�c�g�>U�H��G�M�M�O�O�O�O�,�"%�c�(�(����$�,�,�,�"&�s�)�)����,����S�w�R�R�#�-�R�R�R�F�-�f�c�g�s�w�G�G�G�G��l�l�4�5�l�9�9�����"(��� ,�T� 2� 2�S� 8�8�C�=�=� H��
�,;�D�#�,F�,F��
�8�C�=�=�)�)�/	G�	Gs�B*�*C�Crc���|jd}t|t��r|j|jvsdS|jdkr�t|jt��r|jjdk}nMt|jt��r|jjdk}n"t|j|j
j|��dSt|���S|jdkr>d}t|jt��r|jj
dkrd	}t|�
��St|jt��r/|jj
dvr!td
i|j|jj
dki��St|j|j
j|��dS)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)
        rNr��forbid)�forbid_extrar�Tz
builtins.NoneF)r)�
builtins.Truezbuiltins.Falser]r�)rrrr r�r��rvaluer$rr�error_invalid_config_valuer�r�rrh)rfrr+r\rs     rSrz*PydanticModelTransformer.get_config_update7sr���o�a� ���3��)�)�	�c�h�$�:T�.T�.T��4��8�w����'�.�'�2�2�
�&�~�3�x�?����G�N�J�7�7�
�&�~�2�h�>���*�3�8�T�Y�]�G�L�L�L��t�"��=�=�=�=��8�(�(�(�"&���'�.�(�3�3�
,���8O�Sb�8b�8b�&+�#�"�7J�K�K�K�K��g�n�h�/�/�	]�G�N�4K�Or�4r�4r�"�\�\�c�h���0G�?�0Z�%[�\�\�\�"�3�8�T�Y�]�G�D�D�D��trUr�rr+c�j�|j}t|t��r?t|j|jj��}t�|��St|t��r�t|j
t��r�|j
jtkr�t|j|j��D]&\}}|�|dkr|jt$ucS|dkrdS�'t|j|jj��}t�|��St|t$��S)zg
        Returns a boolean indicating whether the field defined in `stmt` is a required field.
        Nr�r�F)r^rrr'r@r�r�r�r��type_has_implicit_defaultrrr#rhr��zipr��	arg_namesrgr)r�rr+�expr�
value_typer�r�s       rSr#z(PydanticModelTransformer.get_is_requiredSs$��
�{���d�H�%�%�	V�(���#�(�);�)@�A�A�J�/�I�I�*�U�U�U�U��d�H�%�%�	V�*�T�[�'�*J�*J�	V�t�{�Oc�gu�Ou�Ou�!���D�N�;�;�
!�
!�	��T��<�4�9�#4�#4��=�L�8�8�8�8��,�,�,� �5�5�-�)���#�(�);�)@�A�A�J�/�I�I�*�U�U�U�U��$��-�-�-rU�type_c��t|t��rdSt|t��r td�|jD����rdSdS)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).
        Tc3�jK�|].}t|t��pt|t��V��/dSr_)rrr9r6)rnr�s  rSrpzEPydanticModelTransformer.type_has_implicit_default.<locals>.<genexpr>wsL����0
�0
�HL�J�t�X�&�&�C�*�T�7�*C�*C�0
�0
�0
�0
�0
�0
rUF)rrr6r?rtr�)rfs rSraz2PydanticModelTransformer.type_has_implicit_defaultmsi���e�W�%�%�	��4��e�Y�'�'�	�C�0
�0
�PU�P[�0
�0
�0
�-
�-
�	��4��urUc�n�|j}t|t��rdSt|t��r/t|jt
��r|jjtksdSt|j	��D];\}}|dkr�|j
|}t|t��r|jdfcSdSdS)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.
        )NFrF)NT)
r^rrr'rrr#rhr��	enumeratercr�r$r)rrd�i�arg_namer�s     rSr$z'PydanticModelTransformer.get_alias_info~s����{���d�H�%�%�	��;�
�t�X�&�&�	�+5�d�k�7�+K�+K�	�PT�P[�Pd�hv�Pv�Pv��;�$�T�^�4�4�	"�	"�K�A�x��7�"�"���)�A�,�C��#�w�'�'�
"��y�%�'�'�'�'�!�z�z��{rUr1r2r3c�R�����|jjj�����fd�|D��}|S)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.
        c�T��g|]$}�r|j�|����������%S))r1�force_optionalr3)r�to_argument)rnr�r2r�r1r3s  ����rS�
<listcomp>z@PydanticModelTransformer.get_field_arguments.<locals>.<listcomp>�sU���
�
�
���
�#(�"9�
����d�%�@R�^g��h�h�
�
�
rU)r�r�r�)rfr�r1r2r3�	argumentsr�s  ``` @rSr5z,PydanticModelTransformer.get_field_arguments�sS�������y�}�!��
�
�
�
�
�
�
��
�
�
�	�
�rUc��|js*|�|t|j����rdS|jrdS|jjS)aH
        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r\rar�)rfr�r�s   rSr6z1PydanticModelTransformer.should_init_forbid_extra�sS���4�	��,�,�V�T�&�:T�5U�5U�V�V�
��u���	��4��!�3�3rUrc�F�|D]}|jrdS�
|r|D]}|j�dS�
dS)z�
        Returns whether any fields on the model have a "dynamic alias", i.e., an alias that cannot be
        determined during static analysis.
        TNF)rr)r�rr�s   rSrtz1PydanticModelTransformer.is_dynamic_alias_present�sZ���	�	�E��&�
��t�t�
��	 ��
 �
 ���;�&��4�4�'��urU)rIN)rIr)"r�r�r�r�r	r�r�r-r`rer�r�r�rr�r�r�r�r�rrr�staticmethodrr r#r;rar
r$rr5r6rtr�rUrSr�r�s��������'�'�'��3�s�8����+�O�+�<P�+�UY�+�+�+�+�
�
�
�
�22�2�2�2�$����>R�+<�R��FZ�A[�R�R�R�R�hD�d�+?�&@�D�J[�D�jn�D�sw�D�D�D�D�,4
�4�0D�+E�4
�$�4
�4
�4
�4
�lG��&:�!;�G�T�G�d�G�G�G�G�B���H�EV�<W�����8�.�X�.�^�.�(�.�t�.�.�.��\�.�2���*�)=��$�����\�� ��^���h�s�m�T�6I�0J�����\��8��/�0��9=��SW��dh��	
�h������ 4�t�4H�/I�4�Sd�4�im�4�4�4�4����.B�)C��Z^��cg�����\���rUr�c��eZdZdededeedededefd�Zded	ed
e	fd�Z
deded
ed	ed
ef
d�Zd
e
fd�Zedede
d
dfd���ZdS)rr�rrrrrc�Z�||_||_||_||_||_||_dSr_r)rfr�rrrrrs       rSrezPydanticModelField.__init__�s4����	�&�����
�!2�����	�����rUr�r3rIc�p�|j}|r|j�|j}t|||jj��Sr_)r�rr*r�)rfr�r3r�s    rSrVzPydanticModelField.to_var�s8���y���	���/��:�D��4��d�i��-�.�.�.rUr1roc��|r%||jj�||jj}nttj��}t|�||��|d|s|jstnt���S)N)�variable�type_annotation�initializer�kind)
r�r�r6r<r7rrVrrr)rfr�r1ror3r|s      rSrpzPydanticModelField.to_argument�sz���	:�T�$�)�_�)�5�"�4�9�o�2�O�O�%�i�&8�9�9�O���[�[��y�1�1�+��"0�W��8H�W���i�	
�
�
�	
rUc��|jSr_)�__dict__r�s rSr�zPydanticModelField.serialize�s
���}�rUr.c��|di|��S)Nr�r�)r�r�r.s   rSr(zPydanticModelField.deserialize�s���s�{�{�T�{�{�rUN)r�r�r�r�r�rrOrer(r*rVrrprr��classmethodr(r�rUrSrr�s���������&*��3;�C�=��UY��ad��nq�����/�8�/��/��/�/�/�/�

��

��

�t�

�X\�

�ai�

�

�

�

��8�������x��x��<P�����[���rUrc���eZdZ						ddeedeedeedeedeedeefd�Zd	eeeffd
�Z	dedd	dfd�Z
d
eded	dfd�ZdS)rNr\r�r�r�r�rc�Z�||_||_||_||_||_||_dSr_)r\r�r�r�r�r)rfr\r�r�r�r�rs       rSrezModelConfigData.__init__�s8��)���,������ ��
�.L��+�#6�� � � rUrIc�H�d�|j���D��S)Nc��i|]
\}}|�||��Sr_r�)rn�k�vs   rSr�z3ModelConfigData.set_values_dict.<locals>.<dictcomp>s��H�H�H���A�!�-��1�-�-�-rU)r�r�r�s rSr�zModelConfigData.set_values_dict�s$��H�H���!4�!4�!6�!6�H�H�H�HrUr�c��|�dS|������D]\}}t|||���dSr_)r�r�r�)rfr�r�r�s    rSr
zModelConfigData.updatesV���>��F��*�*�,�,�2�2�4�4�	 �	 �D�A�q��D�!�Q�����	 �	 rUr�rc�L�t||���t|||��dSdSr_)r�r�)rfr�rs   rSrzModelConfigData.setdefaults2���4����%��D�#�u�%�%�%�%�%�&�%rU)NNNNNN)r�r�r�rr�rerr�rr�r
rr�rUrSrr�s������(,�)-�!%�#'�9=�.2�7�7��t�n�7�!���7����	7�
�4�.�7�)1���
7�&�d�^�7�7�7�7� I��c�3�h��I�I�I�I� �X�&7�8� �T� � � � �&�c�&�#�&�$�&�&�&�&�&�&rUrzpydantic-ormzInvalid from_orm call�Pydanticzpydantic-configzInvalid config valuezpydantic-aliaszDynamic alias disallowedzpydantic-unexpectedzUnexpected behaviorzpydantic-fieldzUntyped field disallowedzInvalid Field defaults�
model_namer�r�c�H�|�d|�d�|t���dS)N�"z" does not have orm_mode=True��code)�fail�	ERROR_ORM)r�r�r�s   rSr�r�s,���H�H�
:��
:�
:�
:�G�)�H�T�T�T�T�TrUr�c�H�|�d|�d�|t���dS)NzInvalid value for "Config.r�r�)r��ERROR_CONFIG)r�r�r�s   rSr_r_s,���H�H�
1�$�
1�
1�
1�7��H�N�N�N�N�NrUc�@�|�d|t���dS)Nz#Required dynamic aliases disallowedr�)r��ERROR_ALIAS�r�r�s  rSr
r
s!���H�H�
2�G�+�H�N�N�N�N�NrUr�c�b�d}d|�d�}|d|�d�z
}|�||t���dS)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     rSr�r�!sO��D�D�W�V�W�W�W�L��\�T�\�\�\�\�L��H�H�\�7�)9�H�:�:�:�:�:rUc�@�|�d|t���dS)NzUntyped fields disallowedr�)r��
ERROR_UNTYPEDr�s  rSr!r!+s!���H�H�
(�'�
�H�F�F�F�F�FrUc�@�|�d|t���dS)Nz>Field default and default_factory cannot be specified togetherr�)r��ERROR_FIELD_DEFAULTSr�s  rSr�r�/s"���H�H�
M�w�]q�H�r�r�r�r�rrUFr�r@rArBrC�is_newc�.�|jj}||jvrW|j|}	|	jrCt	|	jt��r)|jjj�	|	j��|pt|��}|s|r8ttd��tj|��dt��g}
n6|pt|��}ttd��|dt��g}
|
|z}ggg}
}}|D]n}|js
Jd���|�|j��|�t%|j����|
�|j���o|j�t.�d���}t1||
|||��}|r|g|_t
||t5t7��g����}||_t9||��|_||_t?|��dz|z|_ |j!|_!||jvr*tE||j��}|j||j|<|rwd|_#t||j��}||_|j |_ d|_$tK|tMd��g|��}|j!|_!tOtP|��}	ntOtP|��}	d|	_|	|j|<|j)jj�|��dS)	z}
    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	.functionrLTr�)*r�r�r��plugin_generatedrrrsrrr	r)rArr*r=�make_normalizedrr|r%r�r{r~r�rDrEr7�	variablesrr!r4r�rrkrWrrB�is_decoratedrCrr r&r�defn)r�r�r�r@rArBrCr�r�rx�firstr�rc�	arg_kindsr��
function_type�	signaturer�r_namer��decs                     rSr8r83s��� �7�<�D��t�z����j������	/�J�s�x��$A�$A�	/��G�L��$�$�S�X�.�.�.��0�]�4�0�0�I��O��O��#�f�+�+�x�'?�	�'J�'J�D�RY�Z�Z�[����4��t�!4�!4�	��#�1�2�2�I�t�W�M�M�N���4�<�D�&(�"�b�)�y�I��#�#���"�H�H�$H�H�H�H�����,�-�-�-�����#�,�/�/�0�0�0������"�"�"�"��G�&�&�-�'B�'B�'B�C�C�M��Y�	�9�k�=�Y�Y�I��)�'�j�	���4��u�h�j�j�\�2�2�3�3�D��D�I�!�)�T�2�2�D�I�"�D�M�!�$�'�'�#�-��4�D�N��	�D�I��t�z���-�d�D�J�?�?��!�Z��-��
�6���*� �����d�i� � ������n��������x�
�6�6�7��;�;��
�9����d�C�(�(����d�D�)�)���C���D�J�t���I�N����t�$�$�$�$�$rU�xc�F�|j}t|��r
|��S|S�zc
    Used for compatibility with mypy 0.740; can be dropped once support for 0.740 is dropped.
    )rh�callable�r��fns  rSrkrk�s)��
��B���|�|���r�t�t��
�IrUc�F�|j}t|��r
|��S|Sr�)r�r�r�s  rSr�r��s)��
��B���|�|���r�t�t��
�IrUr�c�n�|�d��sdSd}tjdkrddl}nI	ddl}nC#t
$r6d}	ddl}n+#t
$rddl}|�d��YYdSwxYwYnwxYwt||��5}|�
|��cddd��S#1swxYwYdS)Nz.toml�rb)��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     rSr�r��sO������(�(���t��I�
��7�"�"������	�!�!�!�!�!���		�		�		��I�
�$�$�$�$�$���
�
�
������
�
�j�k�k�k��t�t�t�	
����%�$�			����
�k�9�	%�	%����z�z�"�~�~���������������������sE�5�A5�A�A5�#A/�*A5�.A/�/A5�4A5�B*�*B.�1B.)NNFF){r��configparserr�typingrrrrrr	r
r�
TypingTyper�mypy.errorcodesr
�
mypy.nodesrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*�mypy.optionsr+�mypy.pluginr,r-r.r/r0r1r2�mypy.pluginsr3�mypy.semanalr4�mypy.server.triggerr5�
mypy.typesr6r7r8r9r:r;r<r=r>r?r@�
mypy.typevarsrA�	mypy.utilrB�mypy.versionrC�mypy_version�pydantic.utilsrDrEr�r�r�r�rrlr�r{r�r�r�rOrTr�rEr[rZr`r�r�rrr�r�r�r�r�r�r�r_r
r�r!r�r�r8rkr�r�r�rUrS�<module>r�sV��
�
�
�
�%�%�%�%�%�%�]�]�]�]�]�]�]�]�]�]�]�]�]�]�]�]�]�]�]�]�]�]�%�%�%�%�%�%���������������������������������������������������������������>!� � � � � �������������������%�$�$�$�$�$�*�*�*�*�*�*�5�5�5�5�5�5�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�(�'�'�'�'�'�2�2�2�2�2�2�4�4�4�4�4�4�)�)�)�)�)�)�5�%�%�%�%�%�%�%���5�5�5�4�4�4�4�4�4�4�4�5����!��'��
�c�r�c�]�
�"�3�3�3��%�A�A�A��(�>�>�>���-�-�-��"�:�:�:��A��A��c�3�h��A�A�A�A�(�'��5�5��0�H�<�<�
�
�.�
����C��0�����r �r �r �r �r �V�r �r �r �j"C�"C�"C�"C�"C�"C�"C�"C�J#�=�#�T�#�#�#�#�2h�h�h�h�h�h�h�h�V
"�"�"�"�"�"�"�"�J&�&�&�&�&�&�&�&�>
�I�n�&=�z�J�J�	��y�*�,B�J�O�O���i�(�*D�j�Q�Q���9�2�4I�:�V�V���	�*�,F�
�S�S�
� �y�!1�3K�Z�X�X��U�s�U�)?�U�'�U�VZ�U�U�U�U�O�S�O�/N�O�Y`�O�ei�O�O�O�O�O�(G�O�RY�O�^b�O�O�O�O�;��;��2�4S�S�T�;�_f�;�	�;�;�;�;�G�=�G��G�TX�G�G�G�G�s�5K�s�V]�s�bf�s�s�s�s�!%�%)� ��P%�P%�	�P%�

�P%��x�.�P%��	P%�
��~�P%��z�"�
P%��P%�
�P%�
�P%�P%�P%�P%�f�E�(�J�.�/��C�������h�
�*�+��������C��H�T�#�s�(�^�$<������s�C�C�C