o
    T*eZ‡  ã                   @   s\   d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	m
Z
mZmZ G dd„ deƒZdS )	zSummary reportingé    N)Úenv)ÚReporter)ÚNumbers)Ú	NotPythonÚCoverageExceptionÚoutput_encodingÚStopEverythingc                       s*   e Zd ZdZ‡ fdd„Zddd„Z‡  ZS )ÚSummaryReporterz*A reporter for writing the summary report.c                    s"   t t| ƒ ||¡ |j ¡ | _d S ©N)Úsuperr	   Ú__init__ÚdataÚhas_arcsÚbranches)ÚselfÚcoverageÚconfig©Ú	__class__© úB/var/www/html/env/lib/python3.10/site-packages/coverage/summary.pyr      s   zSummaryReporter.__init__Nc              	      s.  ˆ du rt j‰ ‡ fdd„}g }d}tƒ }d}|  |¡D ]j}z.| j |¡}	|	j}
||
7 }| jjrC|
j	dk}|
j
dk}|rC|rC|d7 }W q| ||	f¡ W q tyS   ‚  ty…   | jj }|rut  ¡ dd… \}}t|tƒru| ¡ sud}|rƒ||| ¡ |j|f ƒ Y qw td	d
„ |D ƒdg ƒ}d| }d}|d d }|d }| jr­|d7 }|d7 }t ¡ }|d|d df 7 }|d|d f 7 }| jjrÐ|d7 }|d7 }dt|ƒ }tddddd�}| jrê| tddd�¡ ||ƒ ||ƒ g }|D ]�\}}	zU|	j}
| ¡ |
j|
j	f}| j�r||
j|
j
f7 }||
jf7 }| jj�r=|	 ¡ }| j�r8|	  ¡ }|�r8|�r4|d7 }||7 }||f7 }|| }||
j!f7 }| ||f¡ W qö t�y†   | jj }|�rut  ¡ dd… \}}|tu �ru| ¡ �sud}|�r„||| ¡ |j|f ƒ Y qöw t"| jddƒ�r°| #| jj$ %¡ ¡‰ˆdu �r¦t&d  '| jj$¡ƒ‚|j$‡fd!d"„d#� |D ]	}||d ƒ �q²|j(dk�rî||ƒ d$|j|j	f}| j�rÙ||j|j
f7 }||jf7 }| jj�rè|d%7 }||| ƒ |j(�sù|�sùt&d&ƒ‚| jj�r|�r||||dk�rd'nd(f ƒ |j�o|j!S ))zÙWrites a report summarizing coverage statistics per module.

        `outfile` is a file object to write the summary to. It must be opened
        for native strings (bytes on Python 2, Unicode on Python 3).

        Nc                    s.   t jr	|  tƒ ¡} ˆ  |  ¡ ¡ ˆ  d¡ dS )z-Write a line to the output, adding a newline.Ú
N)r   ÚPY2Úencoder   ÚwriteÚrstrip)Úline)Úoutfiler   r   Úwriteout   s   z(SummaryReporter.report.<locals>.writeoutr   z%s   %s: %sé   é   Fc                 S   s   g | ]
\}}t | ¡ ƒ‘qS r   )ÚlenÚrelative_filename)Ú.0ÚfrÚanalysisr   r   r   Ú
<listcomp>I   s    z*SummaryReporter.report.<locals>.<listcomp>é   z	%%- %ds  z,
%s file%s skipped due to complete coverage.ÚNamez Stmts   Missz%6d %6dz Branch BrPartz %6d %6dz%*sé   ÚCoverz	%%%ds%%%%é   z
   Missingz   %sú-éÿÿÿÿ)ÚnameÚstmtsÚmissÚcover)ÚbranchÚbrpartz, ÚsortzInvalid sorting option: {0!r}c                    s   | d ˆ  | d fS )Nr   r   r   )Úl)Úpositionr   r   Ú<lambda>Œ   s    z(SummaryReporter.report.<locals>.<lambda>)ÚkeyÚTOTAL)Ú zNo data to report.Úsr:   ))ÚsysÚstdoutr   Úfind_file_reportersr   Ú_analyzeÚnumbersr   Úskip_coveredÚ	n_missingÚn_partial_branchesÚappendr   Ú	ExceptionÚignore_errorsÚexc_infoÚ
issubclassr   Úshould_be_pythonr"   Ú__name__Úmaxr   Úpc_str_widthÚshow_missingr!   ÚdictÚupdateÚn_statementsÚ
n_branchesÚpc_covered_strÚmissing_formattedÚarcs_missing_formattedÚ
pc_coveredÚgetattrÚgetr4   Úlowerr   ÚformatÚn_files)r   Úmorfsr   r   Úfr_analysisÚskipped_countÚtotalÚfmt_errr$   r%   ÚnumsÚno_missing_linesÚno_missing_branchesÚ	report_itÚtypÚmsgÚmax_nameÚfmt_nameÚfmt_skip_coveredÚheaderÚfmt_coverageÚwidth100ÚruleÚcolumn_orderÚlinesÚargsÚmissing_fmtdÚbranches_fmtdÚtextr   r   )r   r6   r   Úreport   sÌ   


€÷


€÷

zSummaryReporter.reportr
   )rJ   Ú
__module__Ú__qualname__Ú__doc__r   rs   Ú__classcell__r   r   r   r   r	      s    r	   )rv   r<   r   r   Úcoverage.reportr   Úcoverage.resultsr   Úcoverage.miscr   r   r   r   r	   r   r   r   r   Ú<module>   s   