관리-도구
편집 파일: private_import.cpython-311.pyc
� �܋f�+ � � � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m Z mZ ddlm Z erddlmZ G d � d e � � Zdd�ZdS )z8Check for imports on private external modules and names.� )�annotations)�Path)� TYPE_CHECKING)�nodes)�BaseChecker�utils)�HIGH)�PyLinterc � � e Zd ZdZddiZd'd�Z ej d� � d(d�� � Z ej d� � d)d �� � Z d*d�Z ed+d�� � Zd,d�Z d-d�Zd.d�Zd/d�Zed0d#�� � Zed1d%�� � Zd&S )2�PrivateImportChecker�import-private-name�C2701)zImported private %s (%s)r z�Used when a private module or object prefixed with _ is imported. PEP8 guidance on Naming Conventions states that public attributes with leading underscores should be considered private.�linterr �return�Nonec �L � t j | |� � i | _ d| _ d S )NF)r �__init__�all_used_type_annotations�populated_annotations)�selfr s �q/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/extensions/private_import.pyr zPrivateImportChecker.__init__! s- � ���T�6�*�*�*� ;=��&�%*��"�"�"� �node�nodes.Importc �J � t j |� � rd S d� |j D � � }| � |� � }| � ||� � }|rNt |� � dk rdnd}d� |� � }| � d|||ft �� � d S d S )Nc � � g | ] }|d ��S �r � )�.0�names r � <listcomp>z5PrivateImportChecker.visit_import.<locals>.<listcomp>, s � �0�0�0�T��a��0�0�0r � �modules�module�, r �r �args� confidence) r �in_type_checking_block�names�_get_private_imports�_get_type_annotation_names�len�join�add_messager )r r r* � private_names�imported_identifier�private_name_strings r �visit_importz!PrivateImportChecker.visit_import( s� � ��'��-�-� ��F�0�0�T�Z�0�0�0���1�1�%�8�8� ��7�7��m�L�L� �� �/2�=�/A�/A�A�/E�/E�)�)�8��"&�)�)�M�":�":�����%��)�+>�?�� � � � � � � � r �nodes.ImportFromc �B � t j |� � rd S | � ||j � � rd S d� |j D � � }| � ||� � }|sd S | � |j g� � }| � ||� � }|r(| � d|d|d ft �� � d S | � |� � }|rNt |� � dk rdnd}d � |� � }| � d|||ft �� � d S d S ) Nc � � g | ] }|d ��S r r )r �ns r r! z9PrivateImportChecker.visit_importfrom.<locals>.<listcomp>A s � �*�*�*�!��1��*�*�*r r r$ r r&