HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/coverage/__pycache__/report.cpython-310.pyc
o

!we)�@s�dZddlmZddlZddlmZmZmZmZm	Z	m
Z
mZddlm
Z
mZddlmZddlmZddlmZdd	lmZmZdd
lmZerNddlmZGdd
�d
�ZdS)zSummary reporting�)�annotationsN)�Any�IO�Iterable�List�Optional�Tuple�
TYPE_CHECKING)�ConfigError�NoDataError)�human_sorted_items)�FileReporter)�get_analysis_to_report)�Analysis�Numbers)�TMorf)�Coveragec@sbeZdZdZd+dd�Zd,d
d�Zd-dd�Zd.dd�Zd.dd�Zd/d0d!d"�Z	d1d#d$�Z
d2d)d*�ZdS)3�SummaryReporterz*A reporter for writing the summary report.�coverager�return�NonecCsr||_|jj|_|����|_d|_|jjpd|_|jdvr&td|j����g|_	d|_
d|_t|jj
d�|_dS)N�text>r�total�markdownzUnknown report format choice: r)�	precision)r�config�get_data�has_arcs�branches�outfile�format�
output_formatr
�fr_analysis�
skipped_count�empty_countrrr)�selfr�r&�H/home/arjun/projects/env/lib/python3.10/site-packages/coverage/report.py�__init__s

zSummaryReporter.__init__�line�strcCs.|jdusJ�|j�|���|j�d�dS)z-Write a line to the output, adding a newline.N�
)r�write�rstrip)r%r)r&r&r'r,'szSummaryReporter.write�items�
Iterable[str]cCs|�d�|��dS)z)Write a list of strings, joined together.�N)r,�join)r%r.r&r&r'�write_items-szSummaryReporter.write_items�header�	List[str]�lines_values�List[List[Any]]�
total_line�	List[Any]�	end_linesc	sBtdd�|D�dg�d�tt|��d��dtd��d�t�g�fdd�|D���td	d
d
d
d
ddd
�����fdd��D�}d�|�}dt|�}|�|�|�|��jtdd�dd�|D]}���fdd�t�|�D�}	|�|	�qe|r�|�|����fdd�t�|�D�}	|�|	�|D]}
|�|
�q�dS)a:Internal method that prints report data in text format.

        `header` is a list with captions.
        `lines_values` is list of lists of sortable values.
        `total_line` is a list with values of the total line.
        `end_lines` is a list of ending lines with information about skipped files.

        cSsg|]}t|d��qS)r)�len��.0r)r&r&r'�
<listcomp>Asz0SummaryReporter._report_text.<locals>.<listcomp>���Cover�z Covercs"g|]
}t|��d��d�qS)r@rA)r:�indexr;)r3r&r'r=Cs"z
{:{name_len}}z{:>7}z{:>{n}}z{:>10}��Name�Stmts�Miss�Branch�BrPartr@�Missingc� g|]}�|j|��d��qS���name_len�n�r �r<�item��formats�max_n�max_namer&r'r=Ms��r0�-z{:>{n}}%�r@z   {:9})rIc�,g|]\}}�|jt|���dd��qS�r?rL�r r*�r<rQ�valuerRr&r'r=[����crXrYrZr[rRr&r'r=er]N)	�maxr:rB�dictr1r,�update�zipr2)r%r3r5r7r9�header_items�
header_str�rule�values�
line_items�end_liner&)rSr3rTrUr'�_report_text1sD$�	�


�
�
�zSummaryReporter._report_textc	s�tdd�|D�dd��t�td��d�tdddddd	d
d��tt||�d��d
td������fdd�|D�}d�|�}dd�d�t|d�dd�gdd�|dd�D��}|�|�|�|�|D]}��tdd�����fdd�t||�D�}	|�	|	�qh��tdd	d��g}
t||�D](\}}|dkr�|}
n|dkr�d|�d�}
nd|�d�}
|
�|j
|
��d �7}
q�|�	|
�|D]}|�|�q�dS)!aTInternal method that prints report data in markdown format.

        `header` is a list with captions.
        `lines_values` is a sorted list of lists containing coverage information.
        `total_line` is a list with values of the total line.
        `end_lines` is a list of ending lines with information about skipped files.

        css$�|]
}t|d�dd��VqdS)r�_�\_N)r:�replacer;r&r&r'�	<genexpr>~s�"z3SummaryReporter._report_markdown.<locals>.<genexpr>r)�defaultz	**TOTAL**r?z| {:{name_len}}|z{:>9} |z	{:>{n}} |z{:>10} |rCr@�z Cover crJrKrOrPrRr&r'r=�� z4SummaryReporter._report_markdown.<locals>.<listcomp>r0�|� z- |rVcSs g|]}d�t|�dd��qS)z-: |r?rV)�rjustr:rPr&r&r'r=�roNz
{:>{n}}% |rWcs4g|]\}}�|jt|��dd���dd��qS)rirjr?rL)r r*rkr[rRr&r'r=�s"��z|{:>{name_len}} |)rDr@z **z%**z**rL)r^r:r_rBr1rrr,r`rar2r )r%r3r5r7r9rbrc�rule_strrerf�total_line_itemsrQr\�insertrgr&rRr'�_report_markdownnsL� 	
�

�
�z SummaryReporter._report_markdownN�morfs�Optional[Iterable[TMorf]]r�Optional[IO[str]]�floatcCs�|ptj|_|j���|jj�t|j|�D]
\}}|�	||�q|j
js,|js,t
d��|jdkr<|�|j
j�|j
jS|��|j
jS)z�Writes a report summarizing coverage statistics per module.

        `outfile` is a text-mode file object to write the summary to.

        zNo data to report.r)�sys�stdoutrrr�set_query_contextsr�report_contextsr�report_one_filer�n_filesr#rr!r,�pc_covered_str�tabular_report�
pc_covered)r%rwr�fr�analysisr&r&r'�report�s
�zSummaryReporter.reportcspgd�}|jr
|ddg7}|dg7}|jjr|dg7}tdddd	d
�}|jr/|�tddd
��g}|jD]9\}}|j}|��|j|j	g}|jrO||j
|jg7}||jg7}|jjrb||j
dd�g7}||jg7}|�|�q4|jjpsd��}d}	|ddkr�d}	|dd�}n|ddkr�|dd�}|�|���dur�td|jj����|dkr�t||	d�}n|j�fdd�|	d�d|jj|jj	g}
|jr�|
|jj
|jjg7}
|
|jjg7}
|jjr�|
dg7}
g}|jj�r|j�r|jdkr�dnd}|�d|j�d|�d��|jj�r"|j�r"|jdk�rdnd}|�d|j�d |�d!��|jd"k�r,|j}
n|j}
|
|||
|�dS)#zWrites tabular report formats.)rDrErFrGrHr@rIrr?rA���)�name�stmts�miss�cover��)�branch�brpartT)rr�FrVN�+zInvalid sorting option: )�reversecs|�|dfS)Nrr&)r)��sort_idxr&r'�<lambda>�sz0SummaryReporter.tabular_report.<locals>.<lambda>)�keyr��TOTALr0�sr+z filez" skipped due to complete coverage.z empty filez	 skipped.r)rr�show_missingr_r`r"�numbers�relative_filename�n_statements�	n_missing�
n_branches�n_partial_branchesr��missing_formattedr��append�sort�lower�getr
rr�skip_coveredr#�
skip_emptyr$r!rvrh)r%r3�column_orderr5r�r��nums�args�sort_optionr�r7r9�file_suffix�	formatterr&r�r'r��sn



�
�zSummaryReporter.tabular_reportr�r
r�rcCs�|j}|j|7_|jdk}|jdk}|jjr%|r%|r%|jd7_dS|jjr7|jdkr7|j	d7_	dS|j
�||f�dS)z4Report on just one file, the callback from report().rr?N)r�rr�r�rr�r#r�r�r$r"r�)r%r�r�r��no_missing_lines�no_missing_branchesr&r&r'rs

zSummaryReporter.report_one_file)rrrr)r)r*rr)r.r/rr)
r3r4r5r6r7r8r9r4rr)N)rwrxrryrrz)rr)r�r
r�rrr)�__name__�
__module__�__qualname__�__doc__r(r,r2rhrvr�r�rr&r&r&r'rs




=>
Ir)r��
__future__rr{�typingrrrrrrr	�coverage.exceptionsr
r�
coverage.miscr�coverage.pluginr
�coverage.report_corer�coverage.resultsrr�coverage.typesrrrrr&r&r&r'�<module>s$