Sh3ll
OdayForums


Server : LiteSpeed
System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : claqxcrl ( 523)
PHP Version : 8.1.32
Disable Function : NONE
Directory :  /opt/hc_python/lib/python3.12/site-packages/pydantic/v1/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/hc_python/lib/python3.12/site-packages/pydantic/v1/__pycache__/mypy.cpython-312.pyc
�

���gv���j�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@mAZAmBZBmCZCmDZDmZmEZEmFZFmGZGmHZHmIZImJZJddlKmLZLdd
lMmNZNddlOmPZQddlRmSZS	ddl>mTZTdZVdZWeXddZYeY�d�ZZeY�d�Z[eY�d�Z\eY�d�Z]eY�d�Z^de_de
e`dffd�ZaeaeQ�Zbebdk\rdnd Zcd!ZPde_dd"fd#�ZdGd$�d%e5�ZeGd&�d'�Zfd(e4defd)�ZgGd*�d+�ZhGd,�d-�ZiGd.�d/�Zjed0d1d2�Zked3d4d2�Zled5d6d2�Zmed7d8d2�Zned9d:d2�Zoed9d;d2�Zpd<e_d=e1d>eddfd?�Zqd@e_d=e7d>eddfdA�Zrd=e7d>eddfdB�ZsdCe_d=e
e1e7fd>eddfdD�Ztd=e7d>eddfdE�Zud=e1d>eddfdF�Zv				dSd(e2d@e_dGeedHedIeedJeeTdKewdLewddfdM�ZxdNe
ee(fde_fdO�ZydNe
ee(fde_fdP�ZzdQe_deee_effdR�Z{y#eU$r
ddl>mHZTY��ewxYw)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-mypyzpydantic-mypy-metadata���z.main.BaseModelz.env_settings.BaseSettingsz.main.ModelMetaclassz
.fields.Fieldz.dataclasses.dataclass�version�return.c�v�ttt|jd�dj	d���S)N�+r�.)�tuple�map�int�	partition�split�rIs �?/opt/hc_python/lib/python3.12/site-packages/pydantic/v1/mypy.py�parse_mypy_versionrUWs/����S�'�+�+�C�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).
    )�PydanticPluginrSs rT�pluginr\bs
���rVc���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)r[�optionsrJNc���t|�|_|jj�|_t�|�|�y�N)�PydanticPluginConfig�
plugin_config�to_data�_plugin_data�super�__init__)�selfr^�	__class__s  �rTrfzPydanticPlugin.__init__ms4���1�'�:��� �.�.�6�6�8���
����!rV�fullnamez+Optional[Callable[[ClassDefContext], None]]c���|j|�}|rLt|jt�r2t	d�|jj
D��r|jSy)Nc3�@K�|]}t|�tk(���y�wr`)�get_fullname�BASEMODEL_FULLNAME��.0�bases  rT�	<genexpr>z5PydanticPlugin.get_base_class_hook.<locals>.<genexpr>vs����U���<��%�);�;����)�lookup_fully_qualified�
isinstance�noder(�any�mro�$_pydantic_model_class_maker_callback�rgri�syms   rT�get_base_class_hookz"PydanticPlugin.get_base_class_hookrsG���)�)�(�3���:�c�h�h��1��U������U�U��@�@�@�rVc�.�|tk(r|jSyr`)�MODEL_METACLASS_FULLNAME�)_pydantic_model_metaclass_marker_callback�rgris  rT�get_metaclass_hookz!PydanticPlugin.get_metaclass_hookzs���/�/��A�A�A�rVz+Optional[Callable[[FunctionContext], Type]]c�h�|j|�}|r|jtk(r|jSyr`)rsri�FIELD_FULLNAME�_pydantic_field_callbackrys   rT�get_function_hookz PydanticPlugin.get_function_hooks/���)�)�(�3���3�<�<�>�1��0�0�0�rVc�2�|jd�rtSy)Nz	.from_orm)�endswith�from_orm_callbackrs  rT�get_method_hookzPydanticPlugin.get_method_hook�s�����[�)�$�$�rVc�H�|tk(rtdkrtjSy)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_callbackrs  rT�get_class_decorator_hookz'PydanticPlugin.get_class_decorator_hook�s$��
�)�)�.@�6�.I��=�=�=�rV�ctxc��|jS)zjReturn all plugin config data.

        Used by mypy to determine if cache needs to be discarded.
        )rd)rgr�s  rT�report_config_dataz!PydanticPlugin.report_config_data�s��
� � � rVc�P�t||j�}|j�yr`)�PydanticModelTransformerrb�	transform)rgr��transformers   rTrxz3PydanticPlugin._pydantic_model_class_maker_callback�s ��.�s�D�4F�4F�G�����rVc���|jjry|jjj}|sJd��t|jdd�rd|j_yy)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)rb�debug_dataclass_transform�cls�info�declared_metaclass�getattr�typer�)rgr��info_metaclasss   rTr~z8PydanticPlugin._pydantic_model_metaclass_marker_callback�s^�����7�7�������8�8���N�N�N�~��>�&�&�(B�D�I�;?�N���8�JrVrc��	�|j�	|jddk(sJd��|jddk(sJd��|jd}|jd}|r$|r"t|j|j
��	S|r+|jdd}|d}t|t�s|S�	S|r�|jdd}t|t�r,tdkDr|jd}n|j�d}t|t�rH|j}t|dd	�}|r+td
�|D��rt!�	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����y�wr`)rtr?)ro�args  rTrqz:PydanticPlugin._pydantic_field_callback.<locals>.<genexpr>�s����H�4�C�:�c�;�7�4�s�c3�"�K�|]}����y�wr`�)ro�_�default_any_types  �rTrqz:PydanticPlugin._pydantic_field_callback.<locals>.<genexpr>�s�����-M��1�.>��s�)�default_return_type�callee_arg_namesr��+error_default_and_default_factory_specified�api�context�	arg_typesrtrr:r��itemsr7�ret_typer��allrN)
rgr��default_args�default_factory_args�default_type�default_arg�default_factory_typer�r�r�s
         @rTr�z'PydanticPlugin._pydantic_field_callback�sl����2�2���#�#�A�&�)�3�g�5g�g�3��#�#�A�&�*;�;�x�=x�x�;��x�x��{��"�x�x��{���0�7�������M�#�#���=�=��+�A�.�L�&�q�/�K��k�<�8�#�#�2 ��/"�#&�=�=��#3�A�#6� ��.�
�;�%��0�+?�+E�+E�a�+H�(�,@�+E�+E�+G��+J�(��.��=�/�8�8���x���6����H�4�H�H�(-�-M��-M�(M��
����rV)�__name__�
__module__�__qualname__r+rf�strr{rrr-r�r�r/rr�r�r1rrr�rxr~r.r��
__classcell__)rhs@rTr[r[ls���"��"�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 rVr[c�j�eZdZUdZeed<eed<eed<eed<eed<dedd	fd
�Zdee	e
ffd�Zy	)ra)�init_forbid_extra�
init_typed�warn_required_dynamic_aliases�warn_untyped_fieldsr�r�r�r�r�r�r^rJNc���|j�yt|j�}|�q|jdi�jdi�}|jD]?}|j|d�}t	|t
�st
d|����t|||��Ayt�}|j|j�|jD]'}|jt|d��}t|||��)y)N�toolrGFz/Configuration value must be a boolean for key: )�fallback)�config_file�
parse_toml�get�	__slots__rt�bool�
ValueError�setattrr�read�
getboolean�CONFIGFILE_KEY)rgr^�toml_config�config�key�settingrbs       rTrfzPydanticPluginConfig.__init__�s������&�� ��!4�!4�5���"� �_�_�V�R�0�4�4�_�b�I�F��~�~�� �*�*�S�%�0��!�'�4�0�$�'V�WZ�V[�%\�]�]���c�7�+�	&�)�N�M����w�2�2�3��~�~��'�2�2�>�3�QV�2�W����c�7�+�&rVc�V�|jD�cic]}|t||���c}Scc}wr`)r�r�)rgr�s  rTrczPydanticPluginConfig.to_datas*��37�>�>�B�>�C��W�T�3�'�'�>�B�B��Bs�&)r�r�r�r�r��__annotations__r+rfrr�rrcr�rVrTrara�sR���I�����#'�'���#�#�,��,�D�,�&C��c�3�h��CrVrar�c��|j}t|t�r|j}t|t�r't|j
t�r
|j
}n]t|t�r|}nJd|�d|jj�d�}t||j|j�|jS|jjjt�}|�|jS|jdi�jd�}|dur4t!t#|j�|j|j�|jS)z3
    Raise an error if orm_mode is not enabled
    z
ctx.type: �
 (of type �)r��orm_modeT)r�rtr=�itemr7r�r8rhr��error_unexpected_behaviorr�r�r��metadatar��METADATA_KEY�error_from_orm�get_name)r��ctx_type�
model_type�detail�pydantic_metadatar�s      rTr�r�s��
�x�x�H��(�H�%��=�=���(�L�)�j��9J�9J�H�.U��&�&�
�	�H�h�	'��
��h�Z�z�(�2D�2D�2M�2M�1N�a�P��!�&�#�'�'�3�;�;�?��&�&�&�"���0�0�4�4�\�B��� ��&�&�&� �$�$�X�r�2�6�6�z�B�H��t���x�
���0�#�'�'�3�;�;�G��"�"�"rVc��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!y)(r�>�extra�frozenr��allow_mutation�alias_generator�allow_population_by_field_name�tracked_config_fieldsr�rbrJNc� �||_||_yr`)�_ctxrb)rgr�rbs   rTrfz!PydanticModelTransformer.__init__)s����	�*��rVc�.�|j}|jj}|j�|j	�}|j|�}t
d�|jddD��}|j|||�|j|�|j||jduxs|jdu��|D�cic]}|j|j���c}|j�d�|j t"<ycc}w)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�@K�|]}t|�tk(���y�wr`)rl�BASESETTINGS_FULLNAMErns  rTrqz5PydanticModelTransformer.transform.<locals>.<genexpr>=s����`�R_�$�,�t�,�0E�E�R_�rrN���FT)r�)�fieldsr�)r�r�r��adjust_validator_signatures�collect_config�collect_fieldsrvrw�add_initializer�add_construct_method�
set_frozenr�r��name�	serialize�set_values_dictr�r�)rgr�r�r�r��is_settings�fields       rTr�z"PydanticModelTransformer.transform-s����i�i���w�w�|�|���(�(�*��$�$�&���$�$�V�,���`�RV�RZ�RZ�[^�\^�R_�`�`�����V�V�[�9��!�!�&�)�����v�'<�'<��'E�'^����Z^�I^��_�BH�I�&��u�z�z�5�?�?�#4�4�&�I��,�,�.�'
��
�
�l�#��Is�
"Dc��|jjjjj	�D]�\}}t|jt�s�!|jjd}t|t�s�Kt|jt�s�f|jjt�d�k(s��d|jj_��y)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�rtrur�original_decoratorsr�calleer ri�
_NAMESPACE�func�is_class)rgr�rz�	first_decs    rTr�z4PydanticModelTransformer.adjust_validator_signaturesFs��������+�+�1�1�7�7�9�I�D�#��#�(�(�I�.��H�H�8�8��;�	��y�(�3�"�9�#3�#3�X�>�!�(�(�1�1�
�|�C^�5_�_�-1�C�H�H�M�M�*�:rV�ModelConfigDatac� �|j}|j}t�}|jjD]�}t|t�s�|jdk(s�$|jjD]3}t|t�s�|j|j|���5|js�}|jr��|jjs��t|j |���|j"j$ddD]�}t&|j(vr�|j j+t-t/|���|j(t&dj1�D]\}}|j3||����|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�bodyrtrr�r�update�get_config_update�has_alias_generatorr�rbr��error_required_dynamic_aliasesr�r�rwr�r��add_plugin_dependencyr5rlr��
setdefault)	rgr�r�r��stmt�substmtr�r��values	         rTr�z'PydanticModelTransformer.collect_configXs6���i�i���g�g�� �"���H�H�M�M�D��d�H�-���y�y�H�$�#�y�y�~�~�G�%�g�~�>� ��M�M�$�"8�"8��"A�B� .�
�.�.�"�A�A��*�*�H�H�2�3�7�7�D�A�"��H�H�L�L���$�D��4�=�=�0��
�G�G�)�)�*?��T�@R�*S�T�#�}�}�\�:�8�D�J�J�L���e��!�!�$��.� M�
%��
rV�model_config�PydanticModelFieldc���|j}|jj}g}t�}|jjD�]�}t|t�s�|jd}t|t�rt|j�s�J|js,|jjrt|j|�|j j"j%|j�}|���|j&}	t|	t(�r��t|	t*�s��|	j,r��|j/|||�}
|j1|�\}}|r8|j2s,|jj4rt7|j|�|j9t;|j|
|||j<|j>���|jA|j����|jC�}
|j jDddD]�}tF|jHvr�g}|jjKtMtO|���|jHtFdjQ�D]q\�}�|vr9t:jS||�}|jA��|j9|��C�fd�|
D�\}|
jU|�|j9|��s||
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�B�K�|]}|j�k(s�|���y�wr`)r�)ro�ar�s  �rTrqz:PydanticModelTransformer.collect_fields.<locals>.<genexpr>�s�����H�:�a����4���:�s��)+r�r��setrrrtr�lvaluesr rEr��
new_syntaxrbr��error_untyped_fieldsr�r�r�r�rur"r*�is_classvar�get_is_required�get_alias_infor�r�r�appendrrr�add�copyrwr�r�rr5rlr��deserialize�remove)rgrr�r�r��known_fieldsr�lhsrzrurrr�
all_fieldsr��superclass_fields�datar�r�s                  @rTr�z'PydanticModelTransformer.collect_fieldswsv���
�i�i���i�i�m�m�����u���H�H�M�M�D��d�N�3���,�,�q�/�C��c�8�,�N�3�8�8�4L���?�?�t�'9�'9�'M�'M�$�S�W�W�d�3�
�(�(�.�.�$�$�S�X�X�.�C��{���8�8�D��$��0���d�C�(�������.�.�s�D�#�>�K�'+�':�':�4�'@�$�E�$�!�$�C�C��&�&�D�D�.�s�w�w��=��M�M�"���� +��&7�����;�;�
�	
�
���S�X�X�&�k"�l�[�[�]�
��H�H�L�L���$�D��4�=�=�0�� "���G�G�)�)�*?��T�@R�*S�T�"�m�m�L�9�(�C�I�I�K�
��d��|�+�.�:�:�4��F�E� �$�$�T�*�%�,�,�U�3�H�:�H�H�U��%�%�e�,�%�,�,�U�3�L�+�Z�7�J�#%�$�rVr�r�r�c��|j}|jj}|jdu}|xs$t	|j
xr
|j�}|j
||||��}|j||�sCtd�}	|jt|	ttj�dt��d|jj j"vrt%|d|t'��yy)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�kwargsNrf)r�rbr�r�r�r
�get_field_arguments�should_init_forbid_extrar*r#rr6r<�explicitrr�r�r��
add_methodr9)
rgr�r�r�r�r/r1r0�init_arguments�vars
          rTr�z(PydanticModelTransformer.add_initializer�s����i�i���"�"�-�-���9�9��E�	�(�
�D��&�&�T�v�/T�/T�+T�-
���1�1��%�4F�R[�2�
���,�,�V�V�<��h�-�C��!�!�(�3��	�8J�8J�0K�T�S\�"]�^��S�W�W�\�\�/�/�/��s�J���
�C�0rVc
�x�|j}|jjt�d�|jjt�d��g�}t	|t�g�}t
td|�|dt�}|j|ddd��}|g|z}|jjt�d��}d	}|jjd
z|z}	tdk\rWt||	td�g|tt j"��}
t%||	g|tt j"��}nt'||	dg|�}
t%||	g|�}t)t*|�|jj,j.|<t1|
t�r|
}nt|
�}t3|d
||||
d��y)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_setNTFr.z.object�_PydanticBaseModelrM)r��r��	construct)�return_type�	self_type�tvar_def�is_classmethod)r�r��
named_type�
BUILTINS_NAMEr@r9rr*rr3r�rir�r?r>r6r<�from_omitted_genericsr)rFr&rr�r�rtr6)
rgr�r��set_str�optional_set_str�fields_set_argument�construct_arguments�obj_type�self_tvar_name�
tvar_fullname�tvd�self_tvar_exprr?s
             rTr�z-PydanticModelTransformer.add_construct_method�s����i�i���'�'�$�$�
��d�%;�c�g�g�>P�>P�Ta�Sb�bf�Qg�>h�=i�j��$�g�x�z�%:�;��&�s�=�:J�'K�M]�_c�el�m��"�6�6�v�T�^c�ot�6�u��2�3�6I�I���7�7�%�%���w�&?�@��-�����(�(�3�.��?�
���'�����"�
����	�7�7�8�
�C�)������	�7�7�8��N��^�]�B��H�M�C�(����H�U�N�-<�T�>�-R��������>�*��c�;�'��I�#�C�(�I�����!����	
rVr�c���|j}|jj}|D�]6}|jj	|j
�}|��|j}t|t�r||_	�Ot|t�r1|jjs|jj���	t|�}d|�d|j"�d�}	t%|	|j|j���|j'|d��}||_||_	t)|�dzt+|�z|_t/t0|�|jt+|�<��9y#t$rt!|�}Y��wxYw)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)r1rM)r�r�r�r�r�r�rurtr*�is_propertyr"r��final_iteration�deferr��	TypeError�reprrhr��to_varrlr��	_fullnamer&r)
rgr�r�r�r�r��sym_noder8�var_strr�s
          rTr�z#PydanticModelTransformer.set_frozens'���i�i���w�w�|�|���E��z�z�~�~�e�j�j�1�H��#��m�m���c�3�'�&,�C�O���_�5�c�g�g�>U�>U��G�G�M�M�O�,�"%�c�(�� /�w�i�z�#�-�-��PQ�R�F�-�f�c�g�g�s�w�w�G��l�l�4�5�l�9�����"(��� ,�T� 2�S� 8�8�C�=� H��
�,;�D�#�,F��
�
�8�C�=�)�/��%�,�"&�s�)��,�s�6E � E7�6E7rc��|jd}t|t�r|j|jvsy|jdk(r�t|j
t�r|j
jdk(}n`t|j
t�r|j
jdk(}n,t|j|jj|�yt|��S|jdk(rCd}t|j
t�r|j
jdk(rd	}t|�
�St|j
t�rF|j
jdvr.td
i|j|j
jdk(i��St|j|jj|�y)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�)rrtr r�r��rvaluer$rr�error_invalid_config_valuer�r�rri)rgrr)rZr
s     rTr	z*PydanticModelTransformer.get_config_update8sL���o�o�a� ���3��)�c�h�h�$�:T�:T�.T���8�8�w���'�.�.�'�2�&�~�~�3�3�x�?���G�N�N�J�7�&�~�~�2�2�h�>��*�3�8�8�T�Y�Y�]�]�G�L��"��=�=��8�8�(�(�"&���'�.�.�(�3����8O�8O�Sb�8b�&+�#�"�7J�K�K��g�n�n�h�/�G�N�N�4K�4K�Or�4r�"�\�c�h�h����0G�0G�?�0Z�%[�\�\�"�3�8�8�T�Y�Y�]�]�G�D�rVr�rr)c��|j}t|t�rBt|j|j
j�}tj|�St|t�r�t|jt�r�|jjtk(r�t|j|j �D]'\}}|�|dk(r|j"t$ucS|dk(s�'yt|j|j
j�}tj|�St|t$�S)zg
        Returns a boolean indicating whether the field defined in `stmt` is a required field.
        r�r�F)r\rtr'rAr�r�r�r��type_has_implicit_defaultrr�r#rir��zipr��	arg_namesrhr)r�rr)�expr�
value_typer�r�s       rTr!z(PydanticModelTransformer.get_is_requiredTs���
�{�{���d�H�%�(����#�(�(�);�)@�)@�A�J�/�I�I�*�U�U�U��d�H�%�*�T�[�[�'�*J�t�{�{�Oc�Oc�gu�Ou�!����D�N�N�;�	��T��<�4�9�#4��=�=�L�8�8��,�,� �<�)����#�(�(�);�)@�)@�A�J�/�I�I�*�U�U�U��$��-�-rV�type_c��t|t�ryt|t�rtd�|jD��ryy)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�`K�|]&}t|t�xst|t����(y�wr`)rtr9r6)ror�s  rTrqzEPydanticModelTransformer.type_has_implicit_default.<locals>.<genexpr>xs+����0
�P[��J�t�X�&�C�*�T�7�*C�C�P[�s�,.F)rtr6r@rvr�)rds rTr_z2PydanticModelTransformer.type_has_implicit_defaultns=���e�W�%���e�Y�'�C�0
�PU�P[�P[�0
�-
��rVc�t�|j}t|t�ryt|t�r7t|jt
�r|jjtk(syt|j�D];\}}|dk7r�|j|}t|t�r|jdfcSyy)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\rtr'rr�r#rir��	enumeraterar�r$r)rrb�i�arg_namer�s     rTr"z'PydanticModelTransformer.get_alias_infos����{�{���d�H�%��
�t�X�&�:�d�k�k�7�+K�PT�P[�P[�Pd�Pd�hv�Pv��$�T�^�^�4�K�A�x��7�"���)�)�A�,�C��#�w�'��y�y�%�'�'�!�5�rVr/r0r1c	��|jjj}|D�cgc]%}|r|js|j	||||����'}}|Scc}w)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.
        )r/�force_optionalr1)r�r�r�r�to_argument)rgr�r/r0r1r�r��	argumentss        rTr3z,PydanticModelTransformer.get_field_arguments�sg���y�y�}�}�!�!�� �
����%�"9�"9�
���d�%�@R�^g��h��	�
�
���
s�*Ac��|js&|j|t|j��ry|jry|j
jS)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
rZrbr�)rgr�r�s   rTr4z1PydanticModelTransformer.should_init_forbid_extra�sI���4�4��,�,�V�T�&�:T�:T�5U�V�������!�!�3�3�3rVr
c�\�|D]}|js�y|r|D]}|j��yy)z�
        Returns whether any fields on the model have a "dynamic alias", i.e., an alias that cannot be
        determined during static analysis.
        TF)rr)r�r
r�s   rTrpz1PydanticModelTransformer.is_dynamic_alias_present�s;���E��&�&�������;�;�&�� �rV)rJN)rJr)"r�r�r�r�r	r�r�r-rarfr�r�r�rr�r�r�r�r�rrr	�staticmethodrr r!r;r_r
r"rr3r4rpr�rVrTr�r�s���'��3�s�8��+�O�+�<P�+�UY�+�
�22�$�>R�+<�R��FZ�A[�R�hD�d�+?�&@�D�J[�D�jn�D�sw�D�,4
�4�0D�+E�4
�$�4
�lG��&:�!;�G�T�G�d�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����.B�)C��Z^��cg���rVr�c��eZdZdededeedededefd�Zded	ed
e	fd�Z
deded
ed	ed
ef
d�Zd
e
fd�Zedede
d
dfd��Zy)rr�rrrrrc�X�||_||_||_||_||_||_yr`r)rgr�rrrrrs       rTrfzPydanticModelField.__init__�s0����	�&�����
�!2�����	���rVr�r1rJc��|j}|r|j�|j}t|||jj�Sr`)r�rr*r�)rgr�r1r�s    rTrTzPydanticModelField.to_var�s;���y�y������/��:�:�D��4��d�i�i��-�-�.�.rVr/rlc��|r3||jj�||jj}nttj�}t|j
||�|d|s|jst��St��S)N)�variable�type_annotation�initializer�kind)
r�r�r6r<r5rrTrrr)rgr�r/rlr1rxs      rTrmzPydanticModelField.to_argument�sz���T�$�)�)�_�)�)�5�"�4�9�9�o�2�2�O�%�i�&8�&8�9�O���[�[��y�1�+��"0��8H�8H��	
�	
�OX�	
�	
rVc��|jSr`)�__dict__)rgs rTr�zPydanticModelField.serialize�s���}�}�rVr,c��|di|��S)Nr�r�)r�r�r,s   rTr&zPydanticModelField.deserialize�s���{�T�{�rVN)r�r�r�r�r�rrPrfr(r*rTrrmrr��classmethodr&r�rVrTrr�s������&*��3;�C�=��UY��ad��nq��/�8�/��/��/�

��

��

�t�

�X\�

�ai�

��8����x��x��<P���rVrc��eZdZ						ddeedeedeedeedeedeefd�Zd	eeeffd
�Z	dedd	dfd�Z
d
eded	dfd�Zy)rNrZr�r�r�r�r
c�X�||_||_||_||_||_||_yr`)rZr�r�r�r�r
)rgrZr�r�r�r�r
s       rTrfzModelConfigData.__init__�s2��)���,������ ��
�.L��+�#6�� rVrJc�p�|jj�D��cic]\}}|��	||��
c}}Scc}}wr`)r|r�)rg�k�vs   rTr�zModelConfigData.set_values_dicts5��!%���!4�!4�!6�H�!6���A�!�-��1��!6�H�H��Hs�
2�2r�c�p�|�y|j�j�D]\}}t|||��yr`)r�r�r�)rgr�r�r�s    rTrzModelConfigData.updates6���>���*�*�,�2�2�4�D�A�q��D�!�Q��5rVr�rc�8�t||��t|||�yyr`)r�r�)rgr�rs   rTr
zModelConfigData.setdefault	s ���4���%��D�#�u�%�&rV)NNNNNN)r�r�r�rr�rfrr�rr�rr
r�rVrTrr�s���(,�)-�!%�#'�9=�.2�7��t�n�7�!���7����	7�
�4�.�7�)1���
7�&�d�^�7� I��c�3�h��I� �X�&7�8� �T� �&�c�&�#�&�$�&rVrzpydantic-ormzInvalid from_orm call�Pydanticzpydantic-configzInvalid config valuezpydantic-aliaszDynamic alias disallowedzpydantic-unexpectedzUnexpected behaviorzpydantic-fieldzUntyped field disallowedzInvalid Field defaults�
model_namer�r�c�<�|jd|�d�|t��y)N�"z" does not have orm_mode=True��code)�fail�	ERROR_ORM)r�r�r�s   rTr�r�s���H�H�q���9�
:�G�)�H�TrVr�c�<�|jd|�d�|t��y)NzInvalid value for "Config.r�r�)r��ERROR_CONFIG)r�r�r�s   rTr]r]s���H�H�)�$��q�
1�7��H�NrVc�4�|jd|t��y)Nz#Required dynamic aliases disallowedr�)r��ERROR_ALIAS�r�r�s  rTrrs���H�H�
2�G�+�H�NrVr�c�V�d}d|�d�}|d|�d�z
}|j||t��y)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     rTr�r�"sA��D�D�L�V�H�TV�W�L��<�T�F�B[�\�\�L��H�H�\�7�)9�H�:rVc�4�|jd|t��y)NzUntyped fields disallowedr�)r��
ERROR_UNTYPEDr�s  rTrr,s���H�H�
(�'�
�H�FrVc�4�|jd|t��y)Nz>Field default and default_factory cannot be specified togetherr�)r��ERROR_FIELD_DEFAULTSr�s  rTr�r�0s���H�H�
M�w�]q�H�rrVr�r>r?r@rA�is_newc�Z�|jj}||jvrn|j|}	|	jrSt	|	j
t�r9|jjjj|	j
�|xst|�}|s|r0ttd�tj|�dt�g}
n+|xst|�}ttd�|dt�g}
|
|z}ggg}
}}|D]o}|j sJd��|j#|j �|j#t%|j&��|
j#|j(��q|j*j-t.�d��}t1||
|||�}|r|g|_t
||t5t7�g��}||_t9||�|_||_t?|�dz|z|_ |jB|_!||jvr2tE||j�}|j||j|<|rud|_#t||j:�}||_|j@|_ d|_$tK|tMd�g|�}|jB|_!tOtP|�}	ntOtP|�}	d|	_|	|j|<|jRjjj#|�y)	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	.functionrMTr~)*r�r�r��plugin_generatedrtrurrrr'rBrr*r=�make_normalizedrrxr#r�rwrzr�rBrCr7�	variablesrr!r4r�rrlrUrrC�is_decoratedrArr r&r�defn)r�r�r�r>r?r@rAr�r�rz�firstr�ra�	arg_kindsr��
function_type�	signaturer�r_namer��decs                     rTr6r64s��� �7�7�<�<�D��t�z�z���j�j�������J�s�x�x��$A��G�G�L�L���$�$�S�X�X�.��0�]�4�0�I����#�f�+�x�'?�'?�	�'J�D�RY�Z�[���4��t�!4�	��#�1�2�I�t�W�M�N���4�<�D�&(�"�b�)�y�I����"�"�H�$H�H�"�����,�,�-�����#�,�,�/�0�������"�	��G�G�&�&�-��	�'B�C�M��Y�	�9�k�=�Y�I��'�j�	���4��u�h�j�\�2�3�D��D�I�!�)�T�2�D�I�"�D�M�!�$�'�#�-��4�D�N��	�	�D�I��t�z�z��-�d�D�J�J�?��!�Z�Z��-��
�
�6��� �����d�i�i� ������n�n��������x�
�6�7��;��
�9�9����d�C�(���d�D�)���C���D�J�J�t���I�I�N�N�����t�$rV�xc�B�|j}t|�r|�S|S�zc
    Used for compatibility with mypy 0.740; can be dropped once support for 0.740 is dropped.
    )ri�callable�r��fns  rTrlrl�s ��
���B���|��t��
�IrVc�B�|j}t|�r|�S|Sr�)r�r�r�s  rTr�r��s ��
���B���|��t��
�IrVr�c�B�|jd�syd}tjdk\rddl}n	ddl}t||�5}|j|�cddd�S#t
$r0d}	ddl}n%#t
$rddl}|jd�YYywxYwY�_wxYw#1swYyxYw)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     rTr�r��s�������(���I�
���7�"��	�!�
�k�9�	%���z�z�"�~�
&�	%���		��I�
�$���
���
�
�j�k��	
��%�			��
&�	%�s@�A�B�B�%A*�)B�*B�B�B�B�B�B)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@rA�
mypy.typevarsrB�	mypy.utilrC�mypy.versionrD�mypy_version�pydantic.v1.utilsrErFr�r�r�r�r�rmr�r}r�r�r�rPrUr�rCr\r[rar�r�rrr�r�r�r�r�r�r�r]rr�rr�r�r6rlr�r�r�rVrT�<module>r�s���
�%�]�]�]�%���������>!����%�*�5�����(�2�4�,�5�%�
!��'��
�c�r�]�
�"�|�?�3��%�,�&@�A��(�\�)=�>���<�}�-��"�|�#9�:��A��A��c�3�h��A�(��5��0�H�<�
�.�
����C��0��r �V�r �j"C�"C�J#�=�#�T�#�2h�h�V
"�"�J&�&�>
�n�&=�z�J�	��*�,B�J�O���(�*D�j�Q���2�4I�:�V���*�,F�
�S�
� �!1�3K�Z�X��U�s�U�)?�U�'�U�VZ�U�O�S�O�/N�O�Y`�O�ei�O�O�(G�O�RY�O�^b�O�;��;��2�4S�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��H�T�#�s�(�^�$<���e�5�4�4�5�s�H#�#H2�1H2

ZeroDay Forums Mini