Your IP : 216.73.216.213
B
:F�Vv � @ s� d Z ddlmZ ddlZddlZddlZddlmZmZ ddlm Z
dddd d
gZddd�Zddd�Z
d
d � Zdd� Zdd� Zddd
�ZdS )z,
API for the command-line I{pyflakes} tool.
� )�with_statementN)�checker�__version__)�reporter�check� checkPath�checkRecursive�iterSourceCode�mainc C sh |dkrt �� }yt| |dtj�}W � n� tk
�r t�� d }|jd }|j |j
|j }}}tj
r�|dkr�| �� } t| �|kr�| |d }tjdkr�t|t�r�y|�d�}W n tk
r� d}Y nX |d8 }|dkr�|�|d� n|�|||||� dS tk
�r" |�|d� dS X t�||�}
|
jjdd � d
� x|
jD ]}|�|� �qJW t|
j�S )a�
Check the Python source given by C{codeString} for flakes.
@param codeString: The Python source to check.
@type codeString: C{str}
@param filename: The name of the file the source came from, used to report
errors.
@type filename: C{str}
@param reporter: A L{Reporter} instance, where errors and warnings will be
reported.
@return: The number of warnings emitted.
@rtype: C{int}
N�exec� r )� �asciizproblem decoding sourcec S s | j S )N)�lineno)�m� r �=/opt/alt/python37/lib/python3.7/site-packages/pyflakes/api.py�<lambda>F � zcheck.<locals>.<lambda>)�key)�modReporter�_makeDefaultReporter�compile�_astZ
PyCF_ONLY_AST�SyntaxError�sys�exc_info�argsr �offset�textr ZPYPY�
splitlines�len�version_info�
isinstance�bytes�decode�UnicodeDecodeError�unexpectedErrorZsyntaxError� ExceptionZChecker�messages�sortZflake)Z
codeString�filenamer Ztree�value�msgr r r �lines�wZwarningr r r r s>