Your IP : 216.73.216.213
B
a�\| � @ s~ d Z ddlZddlZddlZddlmZ ddlmZ e�dej �Z
e�dej �Ze�d�Zdd � Z
d
diZdd
� Zdd� 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)�encoding)�defaultdictzflake8[:=]\s*noqaz#\s+noqaz/^Suppressed \'([a-z0-9-]+)\' \(from line \d+\)$c C sN d}t � }x:t| �D ].\}}t�|�r*d}t�|�r|�|d � qW ||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_contentsZignore_whole_file�ignore_lines�line_number�line� r �G/opt/alt/python37/lib/python3.7/site-packages/prospector/suppression.py�get_noqa_suppressions"