
    L-Phb)                        d Z ddlmZ ddlZddlmZmZmZ ddlm	Z	 ddl
mZmZ ddlmZ ddlmZ dd	lmZ dd
lmZmZ ddlmZ erddlmZ  G d d          ZdS )zSummary reporting    )annotationsN)AnyIOTYPE_CHECKING)Iterable)ConfigErrorNoDataError)human_sorted_items)FileReporter)get_analysis_to_report)AnalysisNumbers)TMorf)Coveragec                  T    e Zd ZdZd#dZd$d	Zd%dZd&dZd&dZd'd(dZ	d)dZ
d*d"ZdS )+SummaryReporterz*A reporter for writing the summary report.coverager   returnNonec                h   || _         | j         j        | _        |                                                                | _        d | _        | j        j        pd| _        | j        dvrt          d| j                  g | _	        d| _
        d| _        t          | j        j                  | _        d S )Ntext>   r   totalmarkdownzUnknown report format choice: r   )	precision)r   configget_datahas_arcsbranchesoutfileformatoutput_formatr   fr_analysisskipped_countempty_countr   r   r   )selfr   s     O/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/coverage/report.py__init__zSummaryReporter.__init__   s     m* ))++4466'+![/96%BBBUt?QUUVVV@Bt{'<===


    linestrc                    | j         J | j                             |                                           | j                             d           dS )z-Write a line to the output, adding a newline.N
)r   writerstrip)r%   r)   s     r&   r-   zSummaryReporter.write(   sJ    |'''4;;==)))4     r(   itemsIterable[str]c                V    |                      d                    |                     dS )z)Write a list of strings, joined together. N)r-   join)r%   r/   s     r&   write_itemszSummaryReporter.write_items.   s$    

2775>>"""""r(   header	list[str]lines_valueslist[list[Any]]
total_line	list[Any]	end_linesc           	        t          d |D             dgz             dz   t          t          |                    d                             dz   t          d                    dz   t          gfd|D             z             t          dd	d	d	d	d
d          fdD             }d                    |          }dt          |          z  }|                     |           |                     |                               t          d          d           |D ]5}fdt          |          D             }	|                     |	           6|r|                     |           fdt          |          D             }	|                     |	           |D ]}
|                     |
           dS )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.

        c                8    g | ]}t          |d                    S )r   )len.0r)   s     r&   
<listcomp>z0SummaryReporter._report_text.<locals>.<listcomp>B   s"    >>>DG>>>r(         Cover   z Coverc                f    g | ]-}t          |                    d                              dz   .S )rD   rE   )r>   index)r@   r)   r5   s     r&   rA   z0SummaryReporter._report_text.<locals>.<listcomp>D   s7    ]]]s4W(=(=#>??!C]]]r(   z{:{name_len}}z{:>7}z{:>{n}}z{:>10}NameStmtsMissBranchBrPartrD   Missingc                L    g | ] }|                              |           !S name_lennr    r@   itemformatsmax_nmax_names     r&   rA   z0SummaryReporter._report_text.<locals>.<listcomp>N   sB     
 
 
 DM  E BB
 
 
r(   r2   -z{:>{n}}%rD   z   {:9})rN   c                r    g | ]3\  }}|                              t          |          d z
            4S rC   rQ   r    r*   r@   rV   valuerW   rX   rY   s      r&   rA   z0SummaryReporter._report_text.<locals>.<listcomp>\   sW       2=$ $$SZZ!U1W % . .  r(   c                r    g | ]3\  }}|                              t          |          d z
            4S r]   r^   r_   s      r&   rA   z0SummaryReporter._report_text.<locals>.<listcomp>f   sW     
 
 
.9dE DM  Uq ! * *
 
 
r(   N)	maxr>   rG   dictr3   r-   updatezipr4   )r%   r5   r7   r9   r;   header_items
header_strrulevalues
line_itemsend_linerW   rX   rY   s    `         @@@r&   _report_textzSummaryReporter._report_text2   sX     >>>>>!DEEIC
6<<#8#89::Q>HNNQRRUG]]]]P\]]]]^^ 
 
 

 
 
 
 
 

 
 
 WW\**
S__$ 	

:

4t*---yAAA" 	) 	)F     ADVVATAT  J Z((((  	JJt
 
 
 
 
 
=@=T=T
 
 

 	$$$! 	! 	!HJJx    	! 	!r(   c           	        t          d |D             d          t          t          d                    dz   t          ddddddd	
          t          t          ||                    d                             dz   t          d                    fd|D             }d                    |          }dd                    d                    t          |d                   dz
  d          gd |dd         D             z             z   }|                     |           |                     |           |D ]X}                    t          d                     fdt          ||          D             }	| 	                    |	           Y                    t          dd                     g }
t          ||          D ]B\  }}|dk    r|}n|dk    rd| d}nd| d}|
|         
                    |          z  }
C| 	                    |
           |D ]}|                     |           dS )aT  Internal 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.

        c              3  h   K   | ]-}t          |d                              dd                    V  .dS )r   _\_N)r>   replacer?   s     r&   	<genexpr>z3SummaryReporter._report_markdown.<locals>.<genexpr>   s<      RRTDGOOC7788RRRRRRr(   r   )defaultz	**TOTAL**rC   z| {:{name_len}}|z{:>9} |z	{:>{n}} |z{:>10} |rH   rD      z Cover c                L    g | ] }|                              |           !S rP   rT   rU   s     r&   rA   z4SummaryReporter._report_markdown.<locals>.<listcomp>   s3    bbbSW,,TH,NNbbbr(   r2   | z- |rZ   c                Z    g | ](}d                      t          |          dz
  d          )S )z-: |rC   rZ   )rjustr>   )r@   rV   s     r&   rA   z4SummaryReporter._report_markdown.<locals>.<listcomp>   s0    IIIV\\#d))A+s++IIIr(   Nz
{:>{n}}% |r[   c                    g | ]G\  }}|                              t          |                              d d          dz
            HS )ro   rp   rC   rQ   )r    r*   rq   r_   s      r&   rA   z4SummaryReporter._report_markdown.<locals>.<listcomp>   sc       D% $$SZZ%7%7U%C%ChZ_`aZa$bb  r(   z|{:>{name_len}} |)rI   rD   z **z%**z**rQ   )rb   r>   rc   rG   r3   ry   r-   rd   re   r4   r    )r%   r5   r7   r9   r;   rf   rg   rule_strri   rj   total_line_itemsrV   r`   insertrk   rW   rX   rY   s                  @@@r&   _report_markdownz SummaryReporter._report_markdowno   s     RR\RRR\]^^^x[!1!122Q6#
 
 
 C
6<<#8#89::Q>IOObbbbbb[abbbWW\**
5;;s<?/C/CA/Es#K#K"LIIQRR8HIII#J 
 
 

 	

:

8" 	) 	)FNN4l333444     #&vv#6#6  J Z(((( 	t!4KHHHIII&(vz22 	Y 	YKD%{{)u)))(u 4 4VhRW 4 X XX)***! 	! 	!HJJx    	! 	!r(   NmorfsIterable[TMorf] | Noner   IO[str] | Nonefloatc                   |pt           j        | _        | j                                                            | j        j                   t          | j        |          D ]\  }}| 	                    ||           | j
        j        s| j        st          d          | j        dk    r |                     | j
        j                   n|                                  | j
        j        S )zWrites a report summarizing coverage statistics per module.

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

        zNo data to report.r   )sysstdoutr   r   r   set_query_contextsr   report_contextsr   report_one_filer   n_filesr#   r	   r!   r-   pc_covered_strtabular_report
pc_covered)r%   r   r   franalysiss        r&   reportzSummaryReporter.report   s     ,#*  33DK4OPPP24=%HH 	/ 	/LB  X....z! 	4$*< 	42333((JJtz01111!!!z$$r(   c                   g d}| j         r|ddgz  }|dgz  }| j        j        r|dgz  }t          dddd	
          }| j         r$|                    t          dd                     g }| j        D ]\  }}|j        }|                                |j        |j	        g}| j         r||j
        |j        gz  }||j        gz  }| j        j        r||                    d          gz  }||j        gz  }|                    |           | j        j        pd                                }d}	|d         dk    rd}	|dd         }n|d         dk    r
|dd         }|                    |          t'          d| j        j                  |dk    rt)          ||	          }n|                    fd|	           d| j        j        | j        j	        g}
| j         r|
| j        j
        | j        j        gz  }
|
| j        j        gz  }
| j        j        r|
dgz  }
g }| j        j        r7| j        r0| j        dk    rdnd}|                    d| j         d| d           | j        j        r7| j        r0| j        dk    rdnd}|                    d| j         d| d            | j        d!k    r| j        }n| j        } ||||
|           dS )"zWrites tabular report formats.)rI   rJ   rK   rL   rM   rD   rN   r   rC   rE   )namestmtsmisscover      )branchbrpartT)r   r   FrZ   N+zInvalid sorting option: )reversec                $    |          | d         fS )Nr    )r)   sort_idxs    r&   <lambda>z0SummaryReporter.tabular_report.<locals>.<lambda>   s    $x.$q'!: r(   )keyr   TOTALr2   sr,   z filez" skipped due to complete coverage.z empty filez	 skipped.r   )r   r   show_missingrc   rd   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!   r~   rl   )r%   r5   column_orderr7   r   r   numsargssort_optionr   r9   r;   file_suffix	formatterr   s                 @r&   r   zSummaryReporter.tabular_report   s    +**= 	+x**F7);# 	"yk!F!!2>>>= 	:Aa 8 8 8999 ". 
	& 
	&NR#D((**D,=t~ND} C$*ABBT())D{' D33T3BBCCT_%%D%%%% {'1688::q>S  G%abb/KK^s""%abb/K##K00M9IMMNNN&  -lGLLLLL::::     tz6
8LM
= 	Q4:0$*2OPPJtz011
;# 	2$J 	;# 	(: 	!%!3A!5!5##2K]T']]k]]]   ;! 	Wd&6 	W!%!1A!5!5##2KU$"2UU{UUUVVV++-II)I	&,
I>>>>>r(   r   r   r   r   c                .   |j         }| xj        |z  c_        |j        dk    }|j        dk    }| j        j        r|r|r| xj        dz  c_        dS | j        j        r|j        dk    r| xj	        dz  c_	        dS | j
                            ||f           dS )z4Report on just one file, the callback from report().r   rC   N)r   r   r   r   r   r   r#   r   r   r$   r"   r   )r%   r   r   r   no_missing_linesno_missing_branchess         r&   r   zSummaryReporter.report_one_file  s    

d

 Na/#6!;;# 	4(8 	4=P 	4!#[# 	4(9Q(>(>!##RN33333r(   )r   r   r   r   )r)   r*   r   r   )r/   r0   r   r   )
r5   r6   r7   r8   r9   r:   r;   r6   r   r   )N)r   r   r   r   r   r   )r   r   )r   r   r   r   r   r   )__name__
__module____qualname____doc__r'   r-   r4   rl   r~   r   r   r   r   r(   r&   r   r      s        44> > > >! ! ! !# # # #;! ;! ;! ;!z<! <! <! <!|% % % % %,G? G? G? G?R4 4 4 4 4 4r(   r   )r   
__future__r   r   typingr   r   r   collections.abcr   coverage.exceptionsr   r	   coverage.miscr
   coverage.pluginr   coverage.report_corer   coverage.resultsr   r   coverage.typesr   r   r   r   r   r(   r&   <module>r      s&     " " " " " " 



 ) ) ) ) ) ) ) ) ) ) $ $ $ $ $ $ 8 8 8 8 8 8 8 8 , , , , , , ( ( ( ( ( ( 7 7 7 7 7 7 . . . . . . . .             "!!!!!!B4 B4 B4 B4 B4 B4 B4 B4 B4 B4r(   