관리-도구
편집 파일: suppression.cpython-311.pyc
� �܋fs � � � d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m Z ddlmZ ddl mZ ej d ej � � Z ej d ej � � Z ej d� � Zd� Zd diZdee fd�Zdee fd�ZdS )aI Each tool has its own method of ignoring errors and warnings. For example, pylint requires a comment of the form # pylint disable=<error codes> PEP8 will not warn on lines with # noqa Additionally, flake8 follows that convention for pyflakes errors, but pyflakes itself does not. Finally, an entire file is ignored by flake8 if this line is found in the file: # flake8\: noqa (the \ is needed to stop prospector ignoring this file :)) This module's job is to attempt to collect all of these methods into a single coherent list of error suppression locations. � N)�defaultdict)�Path)�List)�encoding)�FatalProspectorException)�Messagezflake8[:=]\s*noqaz#\s+noqaz/^Suppressed \'([a-z0-9-]+)\' \(from line \d+\)$c �� � d}t � � }t | � � D ]S\ }}t � |� � rd}t � |� � r|� |dz � � �T||fS )z� Finds all pep8/flake8 suppression messages :param file_contents: A list of file lines :return: A pair - the first is whether to ignore the whole file, the second is a set of (0-indexed) line numbers to ignore. FT� )�set� enumerate�_FLAKE8_IGNORE_FILE�search�_PEP8_IGNORE_LINE�add)� file_contents�ignore_whole_file�ignore_lines�line_number�lines �g/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/prospector/suppression.py�get_noqa_suppressionsr % s� � � ���5�5�L�&�}�5�5� .� .���T��%�%�d�+�+� %� $���#�#�D�)�)� .����[�1�_�-�-�-���l�*�*� z unused-import))�pyflakes�FL0001)�frosted�E101�messagesc �� � t � � }t d� � � }| D ]�}|j dk r�|j dk r�t � |j � � }|st d|j � �� � �|� d� � }||j j }||j j � |� � ��|j dk r|� |j j � � ��||fS )Nc �* � t t � � S �N)r �list� r r �<lambda>z-_parse_pylint_informational.<locals>.<lambda>D s � ��D�0A�0A� r �pylintzsuppressed-messagez)Could not parsed suppressed message from r zfile-ignored)r r �source�code�_PYLINT_SUPPRESSED_MESSAGE�match�messager �group�location�pathr �appendr )r �ignore_files�ignore_messagesr) r( �suppressed_code� line_dicts r �_parse_pylint_informationalr2 B s� � ��5�5�L�'�(A�(A�B�B�O�� 8� 8���>�X�%�%��|�3�3�3� 3�8�8���I�I��� r�2�3p�_f�_n�3p�3p�q�q�q�"'�+�+�a�.�.��+�G�,<�,A�B� ��'�*�/�0�7�7��H�H�H�H����/�/�� � ��!1�!6�7�7�7����(�(r � filepathsc �" � t � � }t t � � }t d� � � }| D ]�} t j |� � � d� � }nE# t j $ r3}t j |j � d|j � �t � � Y d}~�hd}~ww xY wt |� � \ }} |r|� |� � ||xx | z cc<