mypy.cpython-312.pyc•60.4 kB
�
�MMg.� � � � 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.m/Z/ dd l0m1Z1 dd
l2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8 ddl9m:Z: ddl;m<Z< dd
l=m>Z> ddl?m@Z@ ddlAmBZB ddlCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZM ddlNmOZO ddlPmQZQ ddlRmSZT ddlUmVZV ddlWmXZX dZYdZZdZ[dZ\dZ]dZ^dZ_dZ`dZah d�Zb eXeT� Zcd Zdd!ZSdEd"�Ze G d#� d$e6� Zf G d%� d&� ZgdFd'�Zh G d(� d)� Zi G d*� d+� Zj G d,� d-� Zk G d.� d/� Zl ed0d1d2� Zm ed3d4d2� Zn ed5d6d2� Zo ed7d8d2� Zp ed9d:d2� Zq ed9d;d2� Zr ed9d<d2� ZsdGd=�ZtdHd>�ZudId?�Zv dJd@�ZwdIdA�ZxdKdB�Zy dL dMdC�ZzdNdD�Z{y)Oz^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� INVARIANT�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�
MethodContext�Plugin�ReportConfigContext�SemanticAnalyzerPluginInterface)�deserialize_and_fixup_type)�set_callable_name)�make_wildcard_trigger)�state)�map_type_from_supertype)
�AnyType�CallableType�Instance�NoneType�Type� TypeOfAny�TypeType�TypeVarType� UnionType�get_proper_type)�
fill_typevars)�get_unique_redefinition_name)�__version__)�_fields)�parse_mypy_version�
pydantic-mypyzpydantic-mypy-metadatazpydantic.main.BaseModelz#pydantic_settings.main.BaseSettingszpydantic.root_model.RootModelz5pydantic._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_validatorrG �builtins� 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)�versions �YC:\Users\noahv\Documents\GitHub\clickup-operator\.venv\Lib\site-packages\pydantic/mypy.py�pluginrS j s
� � �� c �T � � e Zd ZdZd � fd�Zd
d�Zd
d�Zdd�Zdd�Zd
d�Z d
d�Z
� xZS )rP zThe Pydantic mypy plugin.c � �� t |� | _ | j j � | _ t �| � |� y �N)�PydanticPluginConfig�
plugin_config�to_data�_plugin_data�super�__init__)�self�options� __class__s �rR r] zPydanticPlugin.__init__| s4 �� �1�'�:��� �.�.�6�6�8���
����!rT c �� � | j |� }|rLt |j t � r2t d� |j j
D � � r| j S y)zUpdate Pydantic model class.c 3 �B K � | ] }|j t k( �� � y �wrW ��fullname�BASEMODEL_FULLNAME��.0�bases rR � <genexpr>z5PydanticPlugin.get_base_class_hook.<locals>.<genexpr>� s � �� �P�<�4�4�=�=�$6�6�<�� �N)�lookup_fully_qualified�
isinstance�noder) �any�mro�$_pydantic_model_class_maker_callback)r^ rd �syms rR �get_base_class_hookz"PydanticPlugin.get_base_class_hook� sG � ��)�)�(�3���:�c�h�h��1��P�3�8�8�<�<�P�P��@�@�@�rT c �. � |t k( r| j S y)z,Update Pydantic `ModelMetaclass` definition.N)�MODEL_METACLASS_FULLNAME�)_pydantic_model_metaclass_marker_callback�r^ rd s rR �get_metaclass_hookz!PydanticPlugin.get_metaclass_hook� s � ��/�/��A�A�A�rT c �2 � |j d� rt S y)z-Adjust return type of `from_orm` method call.z .from_ormN)�endswith�from_attributes_callbackrv s rR �get_method_hookzPydanticPlugin.get_method_hook� s � ����[�)�+�+�rT c � � | j S )zjReturn all plugin config data.
Used by mypy to determine if cache needs to be discarded.
)r[ )r^ �ctxs rR �report_config_dataz!PydanticPlugin.report_config_data� s � �
� � � rT c � � t |j |j |j | j � }|j � y rW )�PydanticModelTransformer�cls�reason�apirY � transform)r^ r} �transformers rR rp z3PydanticPlugin._pydantic_model_class_maker_callback� s0 � �.�s�w�w��
�
�C�G�G�T�M_�M_�`�����rT c �� � | j j ry|j j j }|sJ d� �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)rY �debug_dataclass_transformr� �info�declared_metaclass�getattr�typer� )r^ r} �info_metaclasss rR ru z8PydanticPlugin._pydantic_model_metaclass_marker_callback� s^ � � ���7�7�������8�8���N�N�N�~��>�&�&�(B�D�I�;?�N���8� JrT �r_ r+ �return�None)rd �strr� z(Callable[[ClassDefContext], None] | None)rd r� r� z&Callable[[MethodContext], Type] | None)r} r0 r� �dict[str, Any])r} r- r� r� )�__name__�
__module__�__qualname__�__doc__r] rr rw r{ r~ rp ru �
__classcell__)r` s @rR rP rP y s* �� �#�"�
���!� �@rT rP c �N � e Zd ZU dZdZded<