관리-도구
편집 파일: utils.cpython-311.pyc
� �܋f5 � � � d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl Z ddl mZ ddlm Z mZ ddlmZmZ ddlmZ ddlmZmZmZmZ ddlZddlZdd lmZmZmZ dd lmZ ddl m!Z! ddl"m#Z# dd l$m%Z%m&Z& erddlm'Z' ddl(m)Z) edej* �� � Z+ edd�� � Z,ee,e+gdf Z-ej. ej/ ej0 ej1 fZ2dZ3ddhZ4h d�Z5 e6h d�� � Z7 e6h d�� � Z8dZ9dZ:dZ;dZ<dZ=dZ>d Z?d!Z@d"ZAd#d$d%d&d'd(d)d*�ZBd+� eB�C � � D � � ZD eEeD� � ZF e6d,� � ZGh d-�ZH e6h d.�� � ZI G d/� d0eJ� � ZK G d1� d2eJ� � ZL�d&d7�ZM�d'd9�ZN�d&d:�ZO�d(d<�ZPejQ �R � � Zd=ZS�d&d>�ZT�d)dA�ZU�d*dE�ZV�d+dG�ZW�d,dI�ZX�d-�d.dJ�ZY�d&dK�ZZ�d/dN�Z[�d&dO�Z\�d0dP�Z]�d1dR�Z^�d2dU�Z_�d2dV�Z` G dW� dXeJ� � Za G dY� dZeJ� � Zb�d3d]�Zc�d4d_�Zd�d5da�Ze�d6dc�Zf�d7de�Zg�d8dg�Zh�d9dj�Zi�d:dl�Zj �d;�d<ds�Zk�d=du�Zl�d>dz�Zm�d(d{�Zn�d?d}�Zo�d&d~�Zp�d&d�Zq�d&d��Zr�d@d��Zs�dAd��Zt�dBd��Zu ed���� � �d-�dCd��� � Zv�dDd��Zw�dDd��Zx�d&d��Zy�dEd��ZzeJf�dFd��Z{�dGd��Z|eJf�dHd��Z}eJf�dId��Z~�dJd��ZeJf�dKd��Z��dLd��Z��dMd��Z��d&d��Z��dNd��Z��dNd��Z��dNd��Z��dNd��Z��dNd��Z��dNd��Z��dNd��Z��d)d��Z��d&d��Z��dOd��Z��dP�dQd��Z��dNd��Z��dNd��Z��dRd��Z��dSd��Z��dSd��Z��dTd��Z� ed���� � �d-d�d���dUdĄ� � Z� edŬ�� � �d-�dVdDŽ� � Z� �d-�dWdɄZ��d&dʄZ��dXd̄Z��d(d̈́Z��dYdτZ��d(dЄZ��dZd҄Z��d&dӄZ��d[dԄZ��d&dՄZ��d\dZ� ed���� � �d&dل� � Z��d]dۄZ��d^d܄Z� �d-�d_d݄Z��dLdބZ��d`d�Z��dLd�Z��dad�Z��dbd�Z��dcd�Z��ddd�Z��ded�Z��ded�Z��d&d�Z��d&d�Z��dfd�Z��dfd��Z��d(d��Z��dgd��Z��dgd��Z��dgd��Z��d&d��Z��d&d��Z��dhd��Z��di�d�Z��d&�d�Z��dj�d�Z� e� � �dk�d�� � Z��dl�d�Z��dm�d�Z��d&�d�Z��dn�d�Z��do�d�Zdp�d�ZÐd&�d�ZĐdq�d�ZŐdr�d�ZƐds�d�Zǐdt�d �ZȐdu�d#�Zɐdv�d%�Z�dS (w z7Some functions that may be useful for various checkers.� )�annotationsN)�deque)�Iterable�Iterator)� lru_cache�partial)�Match)� TYPE_CHECKING�Any�Callable�TypeVar)�TooManyLevelsError�nodes�util)�InferenceContext)�AstroidError)� ImportNode)�InferenceResult�SuccessfulInferenceResult)�_lru_cache_wrapper)�BaseChecker�_NodeT)�bound� _CheckerTr �builtins�abc�_py_abc> �abc.abstractmethod�abc.abstractproperty�abc.abstractclassmethod�abc.abstractstaticmethod> � .Protocol�typing.Protocol�typing_extensions.Protocol> �*�&�+�^�|�__iter__� __aiter__�__next__�__getitem__�__class_getitem__�__setitem__�__delitem__�__contains__�keys)�__new__�__init__�__call__�__init_subclass__)$�__del__�__repr__�__str__� __bytes__�__hash__�__bool__�__dir__�__len__�__length_hint__r* �__reversed__�__neg__�__pos__�__abs__� __invert__�__complex__�__int__� __float__� __index__� __trunc__� __floor__�__ceil__� __enter__� __aenter__�__getnewargs_ex__�__getnewargs__�__getstate__� __reduce__�__copy__�__unicode__�__nonzero__� __await__r+ � __anext__� __fspath__�__subclasses__)>� __format__�__lt__�__le__�__eq__�__ne__�__gt__�__ge__�__getattr__�__getattribute__�__delattr__� __delete__�__instancecheck__�__subclasscheck__r- �__missing__r0 r1 �__add__�__sub__�__mul__�__truediv__�__floordiv__� __rfloordiv__�__mod__� __divmod__� __lshift__� __rshift__�__and__�__xor__�__or__�__radd__�__rsub__�__rmul__�__rtruediv__�__rmod__�__rdivmod__�__rpow__�__rlshift__�__rrshift__�__rand__�__rxor__�__ror__�__iadd__�__isub__�__imul__�__itruediv__� __ifloordiv__�__imod__�__ilshift__�__irshift__�__iand__�__ixor__�__ior__�__ipow__�__setstate__� __reduce_ex__�__deepcopy__�__cmp__� __matmul__�__rmatmul__�__imatmul__�__div__)�__setattr__�__get__�__set__r/ �__set_name__)�__exit__� __aexit__)� __round__)�__pow__)Nr � � � )r r� )r� r� c �$ � i | ] \ }}|D ]}||���S � r� )�.0�params�methods�names �f/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/checkers/utils.py� <dictcomp>r� � sE � � � � ������ � � �&�� � � � )&zbuiltins.tuplez builtins.listz builtins.dictzbuiltins.setzbuiltins.frozensetz builtins.typezcollections.dequezcollections.defaultdictzcollections.OrderedDictzcollections.Counterzcollections.ChainMapz_collections_abc.Awaitablez_collections_abc.Coroutinez_collections_abc.AsyncIterablez_collections_abc.AsyncIteratorz_collections_abc.AsyncGeneratorz_collections_abc.Iterablez_collections_abc.Iteratorz_collections_abc.Generatorz_collections_abc.Reversiblez_collections_abc.Containerz_collections_abc.Collectionz_collections_abc.Callablez_collections_abc.Setz_collections_abc.MutableSetz_collections_abc.Mappingz_collections_abc.MutableMappingz_collections_abc.Sequencez _collections_abc.MutableSequencez_collections_abc.ByteStringz_collections_abc.MappingViewz_collections_abc.KeysViewz_collections_abc.ItemsViewz_collections_abc.ValuesViewz!contextlib.AbstractContextManagerz&contextlib.AbstractAsyncContextManagerz re.Patternzre.Match> FNT> �nt._exit�sys.exit�posix._exit�_sitebuiltins.Quitterc � � e Zd ZdS )�NoSuchArgumentErrorN��__name__� __module__�__qualname__r� r� r� r� r� � � � � � � � ��Dr� r� c � � e Zd ZdS )�InferredTypeErrorNr� r� r� r� r� r� � r� r� r� �node�nodes.NodeNG�return�boolc � � t j dt d�� � t d� | � � � D � � � � S )z1Return whether the given node is inside a lambda.z�utils.is_inside_lambda will be removed in favour of calling utils.get_node_first_ancestor_of_type(x, nodes.Lambda) in pylint 3.0r� �� stacklevelc 3 �J K � | ]}t |t j � � V � �d S �N)� isinstancer �Lambda)r� �parents r� � <genexpr>z#is_inside_lambda.<locals>.<genexpr> s. � � � �T�T�F�z�&�%�,�/�/�T�T�T�T�T�Tr� )�warnings�warn�DeprecationWarning�any�node_ancestors�r� s r� �is_inside_lambdar� � sR � ��M� O��� � � � � �T�T�d�>Q�>Q�>S�>S�T�T�T�T�T�Tr� �Iterable[nodes.NodeNG]c # � K � t | t j t j f� � r!| j D ]}t |� � E d{V �� �dS | V � dS )z9Recursively returns all atoms in nested lists and tuples.N)r� r �Tuple�List�elts�get_all_elements)r� �childs r� r� r� sp � � � � �$���e�j�1�2�2� ��Y� /� /�E�'��.�.�.�.�.�.�.�.�.�.� /� /� � � � � � r� c �n � t | dd� � dk r| � � � j dk rdS dS )zDReturn True if the node is referencing the "super" builtin function.r� N�superr TF)�getattr�rootr� r� s r� �is_superr� s8 � ��t�V�T�"�"�g�-�-�$�)�)�+�+�2B�j�2P�2P��t��5r� �nodes.FunctionDefc �| � t | j � � dk o$t | j d t j � � S )z@Return true if the given function node only raises an exception.r� r )�len�bodyr� r �Raiser� s r� �is_errorr� s, � ��t�y�>�>�Q��H�:�d�i��l�E�K�#H�#H�Hr� )�__builtins__c �@ � | o| � � � j dk S )zHReturns True if the given node is an object from the __builtin__ module.r )r� r� r� s r� �is_builtin_objectr� " s � ��2�D�I�I�K�K�$� �2�2r� r� �strc �&