관리-도구
편집 파일: scoped_nodes.cpython-311.pyc
� �܋f � � � d Z ddlmZ ddlZddlZddlZddlZddlZddlm Z m Z ddlmZ ddl mZmZmZmZmZ ddlmZ ddlmZ dd lmZ dd lmZmZmZmZmZ ddlmZm Z m!Z!m"Z" ddl#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z, dd l-m.Z. ddl/m0Z0m1Z1m2Z2 ddl3m4Z4 ddl5m6Z6m7Z7m8Z8m9Z9m:Z: ddl;m<Z<m=Z= ddl>m?Z? ddl@mAZA ddlBmCZCmDZDmEZE ejF dk r ddlmGZG ddl mHZH nddlImHZH ddlJmKZG erddlmLZL dZM eNddh� � ZO ejP d� � ZQ eNh d�� � ZR ed� � ZSd � ZTdCd%�ZUd&� ZVd'� ZW G d(� d)e=� � ZX G d*� d+e<� � ZY G d,� d-e<� � ZZ G d.� d/e<� � Z[ G d0� d1e<� � Z\d2� Z] G d3� d4e9j^ e=� � Z_ G d5� d6e9j` e9ja e_� � Zb G d7� d8eb� � ZcdDdEd<�ZddDdFd>�ZedDd?�Zfd@� Zg G dA� dBe9j^ e=e9ja � � ZhdS )Gz� This module contains the classes for "scoped" node, i.e. which are opening a new local scope in the language definition : Module, ClassDef, FunctionDef (and Lambda, GeneratorExp, DictComp and SetComp to some extent). � )�annotationsN)� Generator�Iterator)� lru_cache)� TYPE_CHECKING�ClassVar�NoReturn�TypeVar�overload��bases)� decorators)�util)�IS_PYPY�PY38� PY38_PLUS� PY39_PLUS�PYPY_7_3_11_PLUS)�CallContext�InferenceContext�bind_context_to_node�copy_context) �AstroidBuildingError�AstroidTypeError�AttributeInferenceError�DuplicateBasesError�InconsistentMroError�InferenceError�MroError�StatementMissing�TooManyLevelsError)�lookup)� ClassModel� FunctionModel�ModuleModel)�AstroidManager)� Arguments�Const�NodeNG�_base_nodes�node_classes)�ComprehensionScope�LocalsDictNodeNG)�builtin_lookup)�Position)� InferBinaryOp�InferenceResult�SuccessfulInferenceResult)� � )�cached_property)�Literal)�cachedproperty)�nodes)�__iter__�__getitem__� Exception� BaseException�objects> �classmethod�staticmethod�builtins.classmethod�builtins.staticmethod�_Tc �� � g } d� | D � � } | s|S | D ]!}|d }| D ]}||dd� v rd} n� n�"|st d| ||�� � �|� |� � | D ]}|d |k r|d= ��s)z�Merges MROs in *sequences* to a single MRO using the C3 algorithm. Adapted from http://www.python.org/download/releases/2.3/mro/. Tc � � g | ]}|�|��S � rE )�.0�ss �x/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py� <listcomp>z_c3_merge.<locals>.<listcomp>R s � �/�/�/�1�Q�/�Q�/�/�/� r � NzTCannot create a consistent method resolution order for MROs {mros} of class {cls!r}.��message�mros�cls�context)r �append)� sequencesrO rP �result�s1� candidate�s2�seqs rH � _c3_mergerX J s� � � �F��/�/� �/�/�/� �� ��M�� � �B��1��I�� � ����1�2�2��&�&� $�I��E� '� �� � � � '�4����� � � � � � �i� � � �� � �C��1�v��"�"���F��7rJ rR �list[list[ClassDef]]�return�Nonec �V � | dd� }| d }t |� � D ]!\ }}|� � � dk r|} n�"dS t |� � D ]'\ }}||k r�t d� |D � � � � r n�(dS |� |� � |� |� � dS )a� A class can inherit from typing.Generic directly, as base, and as base of bases. The merged MRO must however only contain the last entry. To prepare for _c3_merge, remove some typing.Generic entries from sequences if multiple are present. This method will check if Generic is in inferred_bases and also part of bases_mro. If true, remove it from inferred_bases as well as its entry the bases_mro. Format sequences: [[self]] + bases_mro + [inferred_bases] rK ����typing.GenericNc 3 �F K � | ]}|� � � d k V � �dS )r^ N��qname�rF �bases rH � <genexpr>z+clean_typing_generic_mro.<locals>.<genexpr>� s0 � � � �@�@�D�t�z�z�|�|�/�/�@�@�@�@�@�@rJ )� enumeratera �any�pop)rR � bases_mro�inferred_bases�irc �position_in_inferred_basesrW s rH �clean_typing_generic_mrorl p s� � � �!�B�$��I��r�]�N��^�,�,� � ���4��:�:�<�<�+�+�+�)*�&��E� ,� �� �I�&�&� � ���3��*�*�*���@�@�C�@�@�@�@�@� ��E� � �� ���1�2�2�2� �M�M�,�-�-�-�-�-rJ c # �@ �K � | D ]�}d� |D � � }t t t t |� � � � � � �|r-|d �%�|d dk rt d| ||�� � ��fd�t t ||� � � � D � � V � ��d S )Nc �V � g | ]&}|j r|j |� � � fnd ��'S �N)�name�linenora �rF �nodes rH rI z(clean_duplicates_mro.<locals>.<listcomp>� s@ � � � � �CG�4�9�>�T�[�$�*�*�,�,�'�'�$� � � rJ r z,Duplicates found in MROs {mros} for {cls!r}.rL c �<