관리-도구
편집 파일: mypy.cpython-311.pyc
� ���e!� � �� � d Z ddlmZ ddlZddlmZ ddlmZmZm Z ddl mZ ddlm Z mZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm 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-m.Z. dd l/m0Z0 dd l1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8 ddl9m:Z: ddl;m<Z< dd l=m>Z> ddl?m@Z@ ddlAmBZB ddlCmDZD ddlEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZP ddlQmRZR ddlSmTZT ddlUmVZW ddlXmYZY ddlZm[Z[ ddlEm\Z\ n# e]$ r ddlEmNZ\ Y nw xY wdZ^dZ_dZ`dZadZbdZcdZdd Zeh d!�Zf e[eW� � Zgegd"k rd#nd$Zhd%ZVdfd*�Zi G d+� d,e6� � Zj G d-� d.� � Zkdgd2�Zl G d3� d4� � Zm G d5� d6� � Zn G d7� d8� � Zo ed9d:d;� � Zp ed<d=d;� � Zq ed>d?d;� � Zr ed@dAd;� � Zs edBdCd;� � Zt edBdDd;� � ZudhdK�ZvdidN�ZwdjdO�ZxdkdR�ZydjdS�ZzdldT�Z{ dmdndb�Z|dode�Z}dS )pz^This module includes classes and functions designed specifically for use with the mypy plugin.� )�annotationsN)�ConfigParser)�Any�Callable�Iterator)� ErrorCode)�expand_type�expand_type_by_instance)� ARG_NAMED� ARG_NAMED_OPT�ARG_OPT�ARG_POS� ARG_STAR2�MDEF�Argument�AssignmentStmt�Block�CallExpr�ClassDef�Context� Decorator�DictExpr�EllipsisExpr� Expression�FuncDef�IfStmt�JsonDict� MemberExpr�NameExpr�PassStmt�PlaceholderNode�RefExpr� Statement�StrExpr�SymbolTableNode�TempNode� TypeAlias�TypeInfo�Var)�Options)�CheckerPluginInterface�ClassDefContext�FunctionContext� MethodContext�Plugin�ReportConfigContext�SemanticAnalyzerPluginInterface)�dataclasses)�deserialize_and_fixup_type)�set_callable_name)�make_wildcard_trigger)�state)�map_type_from_supertype)�AnyType�CallableType�Instance�NoneType� Overloaded�Type� TypeOfAny�TypeType�TypeVarType� UnionType�get_proper_type)� fill_typevars)�get_unique_redefinition_name)�__version__)�_fields)�parse_mypy_version)� TypeVarDef)r@ � pydantic-mypyzpydantic-mypy-metadatazpydantic.main.BaseModelz#pydantic_settings.main.BaseSettingsz5pydantic._internal._model_construction.ModelMetaclasszpydantic.fields.Fieldzpydantic.dataclasses.dataclass�.pydantic.functional_validators.model_validator> �*pydantic.functional_serializers.serializer�.pydantic.deprecated.class_validators.validator�.pydantic.functional_validators.field_validator�0pydantic.functional_serializers.model_serializer�3pydantic.deprecated.class_validators.root_validatorrJ )r i� �builtins�__builtins__� �version�str�return�type[Plugin]c � � t S )a! `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). Args: version: The mypy version string. Return: The Pydantic mypy plugin type. )�PydanticPlugin)rS s �B/opt/cloudlinux/venv/lib/python3.11/site-packages/pydantic/mypy.py�pluginrZ q s � � �� c �l � � e Zd ZdZd� fd�Zdd �Zdd�Zd d�Zd!d�Zdd�Z d"d�Z d#d�Zd$d�Zd%d�Z � xZS )&rX zThe Pydantic mypy plugin.�optionsr* rU �Nonec � �� t |� � | _ | j � � � | _ t � � � |� � d S �N)�PydanticPluginConfig� plugin_config�to_data�_plugin_data�super�__init__)�selfr] � __class__s �rY rf zPydanticPlugin.__init__� sH �� �1�'�:�:��� �.�6�6�8�8��� ������!�!�!�!�!r[ �fullnamerT �(Callable[[ClassDefContext], bool] | Nonec � � | � |� � }|rDt |j t � � r*t d� |j j D � � � � r| j S dS )zUpdate Pydantic model class.c 3 �6 K � | ]}|j t k V � �d S r` )ri �BASEMODEL_FULLNAME��.0�bases rY � <genexpr>z5PydanticPlugin.get_base_class_hook.<locals>.<genexpr>� s* � � � �P�P�4�4�=�$6�6�P�P�P�P�P�Pr[ N)�lookup_fully_qualified� isinstance�noder( �any�mro�$_pydantic_model_class_maker_callback�rg ri �syms rY �get_base_class_hookz"PydanticPlugin.get_base_class_hook� sd � ��)�)�(�3�3��� A�:�c�h��1�1� A��P�P�3�8�<�P�P�P�P�P� A��@�@��tr[ �(Callable[[ClassDefContext], None] | Nonec �* � |t k r| j S dS )z,Update Pydantic `ModelMetaclass` definition.N)�MODEL_METACLASS_FULLNAME�)_pydantic_model_metaclass_marker_callback�rg ri s rY �get_metaclass_hookz!PydanticPlugin.get_metaclass_hook� s � ��/�/�/��A�A��tr[ �(Callable[[FunctionContext], Type] | Nonec �b � | � |� � }|r|j t k r| j S dS )z/Adjust the return type of the `Field` function.N)rr ri �FIELD_FULLNAME�_pydantic_field_callbackrx s rY �get_function_hookz PydanticPlugin.get_function_hook� s7 � ��)�)�(�3�3��� 1�3�<�>�1�1��0�0��tr[ �&Callable[[MethodContext], Type] | Nonec �>