%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/wmt/common/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/wmt/common/__pycache__/report.cpython-37.pyc

B

��wa��@s�ddlZddlmZmZddlmZddlmZddlm	Z	ddl
mZmZeGdd�d��Z
eGd	d
�d
��ZeGdd�d��Zd
d�Zdd�Zdd�ZdS)�N)�	dataclass�asdict)�func)�literal_column)�cfg)�ScrapeResult�
session_scopec@s>eZdZUeed<eed<eed<eed<eed<dd�ZdS)	�
SummaryReport�	count_all�count_successful�count_failed�count_undone�average_timecGs |j|j|j|jt|jd�gS)Ni�)r
rrr
�intr)�self�args�r�B/opt/alt/python37/lib/python3.7/site-packages/wmt/common/report.py�to_templates
zSummaryReport.to_templateN)�__name__�
__module__�__qualname__r�__annotations__�floatrrrrrr	s
r	c@s.eZdZUeed<eed<eed<dd�ZdS)�ErrorReport�code�count_errors�urlcCs0t|j�}|dkr&d|j�d|�d�}||jgS)N�htmlz	<a href="z">z</a>)�
url_to_domainrr)r�alternativerrrrr#s

zErrorReport.to_templateN)rrr�strrrrrrrrrs
rc@s&eZdZUeed<eed<dd�ZdS)�DurationReportrrcCs8t|j�}|dkr&d|j�d|�d�}|t|jd�gS)Nrz	<a href="z">z</a>i�)rrrr)rr rrrrr0s

zDurationReport.to_templateN)rrrr!rrrrrrrr"+s
r"cCsd}t�|d|�S)Nzhttp(s)?://�)�re�sub)r�patternrrrr9src	Cs�t|���}|�tjtjt���d���tj	|ktj	|ktjdktj
dk��tjtj���}|�t�
|jj�t�|jj�|jj��|jj���}|�tjt�tj��d�t����tj	|ktj	|ktjdk��tj��td������}|�t��tj	|ktj	|ktj
dk���}WdQRXdd�|D�}dd�|D�}d	d�|D�}d
d�|D�}	tdd�|D��}
td
d�|D��}dd�|D�}|�s�dnttdt|�t|���}
t|
|||
|||
d�}|||	d�S)N�	err_count��TrFcSs&g|]\}}}t�|�s|||f�qSr)r�is_domain_ignored)�.0rr�countrrr�
<listcomp>hsz#generate_report.<locals>.<listcomp>cSs&g|]\}}}t�|�s|||f�qSr)rr))r*rr+rrrrr,kscSs g|]\}}}t|||d��qS))rrr)r)r*rrrrrrr,nscSs*g|]"\}}}t|tt|d��d��qS)i�)rr)r"r�round)r*rr�_rrrr,qscss|]\}}}|VqdS)Nr)r*rr.Z
success_countrrr�	<genexpr>tsz"generate_report.<locals>.<genexpr>css|]\}}}|VqdS)Nr)r*r.Zerrors_countrrrrr/uscSsg|]}|d�qS)�r)r*�itemrrrr,wsri�)r
rrr
r)�summary_report�error_report�duration_report)rZqueryrZ
response_codeZwebsiterr+Zlabel�filterZcreate_dateZis_finishedZgroup_by�subqueryZgroup_concat�c�sumr'�allZavgZresponse_time_msZorder_byrZdescrr-�lenr	)ZengineZ
start_dateZend_dateZsessionr6Zerror_statsZ
success_statsZcount_unsuccessfulr3r4Zsuccessful_requests_countZerror_requests_countZaveragesZ
average_countr2rrr�generate_report>sV


&r;cCs0t|d�dd�|dD�dd�|dD�d�S)Nr2cSsg|]}t|��qSr)r)r*r1rrrr,�szreport_dict.<locals>.<listcomp>r3cSsg|]}t|��qSr)r)r*r1rrrr,�sr4)r2r3r4)r)Zreportrrr�report_dict�s
r<)r$ZdataclassesrrZ
sqlalchemyrZsqlalchemy.sql.expressionrZ
wmt.commonrZwmt.dbrrr	rr"rr;r<rrrr�<module>sG

Zerion Mini Shell 1.0