Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/prospector/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/prospector/__pycache__/run.cpython-37.opt-1.pyc

B

a�\��@s�ddlmZddlZddlZddlmZddlmZmZm	Z	ddl
mZddl
m
Z
ddlmZddlmZdd	lmZdd
lmZmZddlmZdZGd
d�de�Zdd�Zdd�Zedkr�e�e��dS)�)�absolute_importN)�datetime)�blender�
postfilter�tools)�
configuration)�ProspectorConfig)�FatalProspectorException)�find_python)�
FORMATTERS)�Location�Message)�capture_output)�
Prospector�mainc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)rcCs||_d|_|j|_dS)N)�config�summary�messages)�selfr�r�?/opt/alt/python37/lib/python3.7/site-packages/prospector/run.py�__init__szProspector.__init__cCsdx2|D]*}|jjr"|�|jj�q|�|jj�qW|jjrFt�|�}|jdd�}t	�
||jj|�S)NF)�abspath)rZabsolute_pathsZto_absolute_path�workdirZto_relative_pathZblendingrZblendZiter_module_pathsrZfilter_messages)r�found_filesr�messageZ	filepathsrrr�process_messagess

zProspector.process_messagescCs�dt��i}|�|j���t|jj|jj|jj|jj	�}g}�x�|j�
|�D�]r}x*tj�
�D]\}}||jkr`|}Pq`Wd}y�t|jjd���}||�|�7}|jj�rt|jj	dddd�}	|��r�d||��f}
|�t|d|	|
d��|���rd||��f}
|�t|d|	|
d��WdQRXWqNtk
�rf}ztj�|j�t�d�Wdd}~XYqNtk
�r�|jj�r��n8t|jj	dddd�}	d	|f}
t|d
|	|
d�}|�|�YqNXqNW|� ||�}t!|�|d<t��|d<|d|d}
|
j"|
j#|
j$d
ddd}d||d<g}x2|jj%�
�D]"\}}|dk	�r:|�||f��q:Wt!|�dk�r�d�&dd�|D��|d<||_'|j(||_(dS)N�startedZUnknown)Zhidezstderr from %s:
%sz
hidden-output)rzstdout from %s:
%s�z,Tool %s failed to run (exception was raised)ZfailureZ
message_countZ	completed�ig��.Az%0.2fZ
time_takenrz, cSsg|]}d|�qS)z%s: %sr)�.0�inforrr�
<listcomp>ssz&Prospector.execute.<locals>.<listcomp>�external_config))rZnow�updaterZget_summary_informationr
Zignores�pathsZexplicit_file_moderZ	get_toolsrZTOOLS�items�	__class__rZdirect_tool_stdout�runZinclude_tool_stdoutrZget_hidden_stderr�appendr
Zget_hidden_stdoutr	�sys�stderr�writer�exit�	ExceptionZdie_on_tool_errorr�lenZmicrosecondsZsecondsZdays�
configured_by�joinrr)rrrrZtool�name�clsZtoolnameZcaptureZloc�msg�fatalrZdeltaZ
total_secondsr#r0rrr�execute)sf


$
"
zProspector.executecCs|jS)N)r)rrrr�get_summaryxszProspector.get_summarycCs|jS)N)r)rrrr�get_messages{szProspector.get_messagescCs�|j��}xx|D]p}|\}}||jd<t||j|j|jj�}|sP|�|tj�x.|D]&}t	|d��}|�||�WdQRXqVWqWdS)N�	formatterzw+)
rZget_output_reportrrr�profile�write_tor*�stdout�open)rZoutput_reportsZreportZ
output_formatZoutput_filesr9Zoutput_file�targetrrr�print_messages~s



zProspector.print_messagescCs4|�|j|jj|jj|jjd��|�d�dS)N)rrr:�
)r,ZrenderrZ
messages_onlyZsummary_onlyZshow_profile)rr9r>rrrr;�s
zProspector.write_toN)
�__name__�
__module__�__qualname__rrr6r7r8r?r;rrrrrsO
rcCs$t��}tjddd�}|�|jd�S)z�
    This is a helper method to return an argparse parser, to
    be used with the Sphinx argparse plugin for documentation.
    �
prospectorN)�progZdescription)�cfgZ
build_managerZbuild_command_line_sourceZbuild_parserZsettings)Zmanager�sourcerrr�
get_parser�srHcCs�t�}|j}t|�dkrJtdd�|D��sJtj�d�t���t�	d�t
|�}|��|��|�
�rndSt|���dkr�dSdS)N�cSsg|]}tj�|��qSr)�os�path�isfile)r rKrrrr"�szmain.<locals>.<listcomp>zA
In multi-path mode, all inputs must be files, not directories.

rr)rr%r/�allr*r+r,rHZprint_usager-rr6r?Zexit_with_zero_on_successr8)rr%rDrrrr�s

r�__main__) Z
__future__rZos.pathrJr*rrDrrrZprospector.configrrFrZprospector.exceptionsr	Zprospector.finderr
Zprospector.formattersrZprospector.messagerr
Zprospector.tools.utilsr�__all__�objectrrHrrAr-rrrr�<module>s"