OwlCyberSecurity - MANAGER
Edit File: mypy.cpython-312.pyc
� I��gv� � �j � d dl Z d dlmZ d dlmZmZmZmZmZm Z m Z mZm Z d dlmZ d dlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm 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- d dl.m/Z/ d dl0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7 d dl8m9Z9 d d l:m;Z; d d l<m=Z= d dl>m?Z?m@Z@mAZAmBZBmCZCmDZDmZmEZEmFZFmGZGmHZHmIZImJZJ d dlKmLZL d d lMmNZN d dlOmPZQ d dlRmSZS d dl>mTZT dZVdZWeXdd ZYeY� d�ZZeY� d�Z[eY� d�Z\eY� d�Z]eY� d�Z^de_de e`df fd�Za eaeQ� Zbebdk\ rdnd Zcd!ZPde_dd"fd#�Zd G d$� d%e5� Ze G d&� d'� Zfd(e4defd)�Zg G d*� d+� Zh G d,� d-� Zi G d.� d/� Zj ed0d1d2� Zk ed3d4d2� Zl ed5d6d2� Zm ed7d8d2� Zn ed9d:d2� Zo ed9d;d2� Zpd<e_d=e1d>eddfd?�Zqd@e_d=e7d>eddfdA�Zrd=e7d>eddfdB�ZsdCe_d=e e1e7f d>eddfdD�Ztd=e7d>eddfdE�Zud=e1d>eddfdF�Zv dSd(e2d@e_dGee dHedIee dJeeT dKewdLewddfdM�ZxdNe ee(f de_fdO�ZydNe ee(f de_fdP�ZzdQe_deee_ef fdR�Z{y# eU$ r d dl>mHZT Y ��ew xY w)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 � t t t | j d� d j d� � � S )N�+r �.)�tuple�map�int� partition�split�rI s �?/opt/hc_python/lib/python3.12/site-packages/pydantic/v1/mypy.py�parse_mypy_versionrU W s/ � ���S�'�+�+�C�0��3�9�9�#�>�?�@�@� )r i� �builtins�__builtins__� zTypingType[Plugin]c � � t S )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 � � � e Zd Zdeddf� fd�Zdeddfd�Zdedeee gdf fd�Z dedd fd �Zdedeeege f fd�Zdedeee gdf fd�Zd edeeef fd�Zd e ddfd�Zd e ddfd�Zd eddfd�Z� xZS )r[ �optionsrJ Nc � �� t |� | _ | j j � | _ t �| � |� y �N)�PydanticPluginConfig� plugin_config�to_data�_plugin_data�super�__init__)�selfr^ � __class__s �rT rf zPydanticPlugin.__init__m s4 �� �1�'�:��� �.�.�6�6�8��� ����!rV �fullnamez+Optional[Callable[[ClassDefContext], None]]c �� � | j |� }|rLt |j t � r2t d� |j j D � � r| j S y )Nc 3 �@ K � | ] }t |� t k( �� � y �wr` )�get_fullname�BASEMODEL_FULLNAME��.0�bases rT � <genexpr>z5PydanticPlugin.get_base_class_hook.<locals>.<genexpr>v s � �� �U���<��%�);�;��� �)�lookup_fully_qualified� isinstance�noder( �any�mro�$_pydantic_model_class_maker_callback�rg ri �syms rT �get_base_class_hookz"PydanticPlugin.get_base_class_hookr sG � ��)�)�(�3���:�c�h�h��1��U������U�U��@�@�@�rV c �. � |t k( r| j S y r` )�MODEL_METACLASS_FULLNAME�)_pydantic_model_metaclass_marker_callback�rg ri s rT �get_metaclass_hookz!PydanticPlugin.get_metaclass_hookz s � ��/�/��A�A�A�rV z+Optional[Callable[[FunctionContext], Type]]c �h � | j |� }|r|j t k( r| j S y r` )rs ri �FIELD_FULLNAME�_pydantic_field_callbackry s rT �get_function_hookz PydanticPlugin.get_function_hook s/ � ��)�)�(�3���3�<�<�>�1��0�0�0�rV c �2 � |j d� rt S y )Nz .from_orm)�endswith�from_orm_callbackr s rT �get_method_hookzPydanticPlugin.get_method_hook� s � ����[�)�$�$�rV c �H � |t k( rt dk rt j S y)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 rT �get_class_decorator_hookz'PydanticPlugin.get_class_decorator_hook� s$ � � �)�)�.@�6�.I��=�=�=�rV �ctxc � � | j S )zjReturn all plugin config data. Used by mypy to determine if cache needs to be discarded. )rd )rg r� s rT �report_config_dataz!PydanticPlugin.report_config_data� s � � � � � rV c �P � t || j � }|j � y r` )�PydanticModelTransformerrb � transform)rg r� �transformers rT rx z3PydanticPlugin._pydantic_model_class_maker_callback� s � �.�s�D�4F�4F�G�����rV 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)rb �debug_dataclass_transform�cls�info�declared_metaclass�getattr�typer� )rg r� �info_metaclasss rT r~ z8PydanticPlugin._pydantic_model_metaclass_marker_callback� s^ � � ���7�7�������8�8���N�N�N�~��>�&�&�(B�D�I�;?�N���8� JrV r c � � � |j � |j d dk( sJ d� �|j d dk( sJ d� �|j d }|j d }|r$|r"t |j |j � � S |r+|j d d }|d }t |t � s|S � S |r�|j d d }t |t � r,t dkD r|j d }n|j � d }t |t � rH|j }t |dd � }|r+t d � |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())r i� �argsNc 3 �<