
    3[gb)                        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y)zSummary reporting    )annotationsN)AnyIOTYPE_CHECKING)Iterable)ConfigErrorNoDataError)human_sorted_items)FileReporter)get_analysis_to_report)AnalysisNumbers)TMorf)Coveragec                  z    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y)SummaryReporterz*A reporter for writing the summary report.c                   || _         | j                   j                  | _        |j                         j                         | _        d | _        | j                  j                  xs d| _        | j                  dvrt        d| j                        g | _	        d| _
        d| _        t        | j                  j                        | _        y )Ntext>   r   totalmarkdownzUnknown report format choice: r   )	precision)coverageconfigget_datahas_arcsbranchesoutfileformatoutput_formatr   fr_analysisskipped_countempty_countr   r   r   )selfr   s     J/var/www/html/bid-api/venv/lib/python3.12/site-packages/coverage/report.py__init__zSummaryReporter.__init__   s     mm** ))+446'+![[//96%BB >t?Q?Q>TUVV@Bt{{'<'<=
    c                    | j                   J | j                   j                  |j                                | j                   j                  d       y)z-Write a line to the output, adding a newline.N
)r   writerstrip)r#   lines     r$   r)   zSummaryReporter.write(   s<    ||'''4;;=)4 r&   c                D    | j                  dj                  |             y)z)Write a list of strings, joined together. N)r)   join)r#   itemss     r$   write_itemszSummaryReporter.write_items.   s    

2775>"r&   c                @   t        |D cg c]  }t        |d          c}dgz         dz   }t        t        ||j                  d               dz   t        d            dz   }t        |g|D cg c]"  }t        ||j                  d               dz   $ c}z         }t        dddddd	d
      }|D 	cg c]  }	||	   j	                  |	||       }
}	dj                  |
      }dt        |      z  }| j                  |       | j                  |       |j                  t        d      d       |D ]R  }t        ||      D 	cg c](  \  }	}||	   j	                  t        |      ||dz
        * }}	}| j                  |       T |r| j                  |       t        ||      D 	cg c](  \  }	}||	   j	                  t        |      ||dz
        * }}	}| j                  |       |D ]  }| j                  |        yc c}w c c}w c c}	w c c}}	w c c}}	w )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.

        r         Cover   z Coverz{:{name_len}}z{:>7}z{:>{n}}z{:>10}NameStmtsMissBranchBrPartr4   Missingname_lennr-   -z{:>{n}}%r4   z   {:9})r<   N)maxlenindexdictr   r.   r)   updatezipstrr0   )r#   headerlines_values
total_line	end_linesr+   max_namemax_nformatsitemheader_items
header_strrulevaluesvalue
line_itemsend_lines                    r$   _report_textzSummaryReporter._report_text2   sJ     >DG>!DEIC
6<<#89:Q>HNQRRUGP\]P\s4W(=#>?!CP\]]^ 
 
 DM  E B 	 
 WW\*
S_$ 	

:

4t*-yA"F BEVVATAT+$ $$SZ!U1W % .AT   Z( # JJt >A=T
=TkdE DM  Uq ! *=T 	 
 	$!HJJx  "U ?]

s   H.'H

4H-H+-Hc                   t        d |D        d      }t        |t        d            dz   }t        ddddddd	
      }t        t        ||j                  d               dz   t        d            }|D cg c]  }||   j	                  |||       }	}dj                  |	      }
ddj                  dj                  t        |	d         dz
  d      g|	dd D cg c]   }dj                  t        |      dz
  d      " c}z         z   }| j                  |
       | j                  |       |D ]}  }|j                  t        d             t        ||      D cg c]8  \  }}||   j	                  t        |      j                  dd      ||dz
        : }}}| j                  |        |j                  t        dd             g }t        ||      D ]9  \  }}|dk(  r|}n|dk(  rd| d}nd| d}|||   j	                  |||      z  }; | j                  |       |D ]  }| j                  |        yc c}w c c}w c c}}w )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  X   K   | ]"  }t        |d    j                  dd             $ yw)r   _\_N)rC   replace).0r+   s     r$   	<genexpr>z3SummaryReporter._report_markdown.<locals>.<genexpr>   s%     R\TDGOOC78\s   (*r   )defaultz	**TOTAL**r3   z| {:{name_len}}|z{:>9} |z	{:>{n}} |z{:>10} |r6   r4      z Cover r=   r-   | z- |r@   Nz-: |z
{:>{n}}% |rA   r[   r\   z|{:>{name_len}} |)r7   r4   z **z%**z**)rB   rC   rE   rD   r   r.   rjustr)   rF   rG   rH   r]   r0   )r#   rI   rJ   rK   rL   rM   rO   rN   rP   rQ   rR   rule_strrT   rU   rV   total_line_itemsinsertrW   s                     r$   _report_markdownz SummaryReporter._report_markdowno   sq     R\R\]^x[!12Q6#
 C
6<<#89:Q>IO[ab[aSW,,TH,N[abWW\*
5;;s<?/CA/Es#K"L8DQR8HI8HV\\#d)A+s+8HI#J 
 

 	

:

8"FNN4l34 $'vv#6#6KD% $$SZ%7%7U%ChZ_`aZa$b#6   Z( # 	t!4KHI&(vz2KD%{ugS)ugR 4 4VhRW 4 XX 3 	)*!HJJx  "? c Js   6H?%I=I	Nc                H   |xs t         j                  | _        | j                  j	                         j                  | j                  j                         t        | j                  |      D ]  \  }}| j                  ||        | j                  j                  s| j                  st        d      | j                  dk(  r;| j                  | j                  j                          | j                  j$                  S | j#                          | 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#   morfsr   franalysiss        r$   reportzSummaryReporter.report   s     ,#** 33DKK4O4OP24==%HLB  X. I zz!!$*<*<233(JJtzz001 zz$$$ !zz$$$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|j	                  t        dd             g }| j
                  D ]  \  }}|j                  }|j                         |j                  |j                  g}| j                   r||j                  |j                  gz  }||j                  gz  }| j                  j                  r||j                  d      gz  }||j                  gz  }|j                  |        | j                  j                   xs dj#                         }d}	|d   dk(  rd}	|dd }n|d   dk(  r|dd }|j%                  |      "t'        d| j                  j                         |dk(  rt)        ||	      }n|j!                  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,                  rA| j.                  r5| j.                  dkD  rdnd}|j                  d| j.                   d| d       | j                  j0                  rA| j2                  r5| j2                  dkD  rdnd}|j                  d| j2                   d| d        | j4                  d!k(  r| j6                  }n| j8                  } ||||
|       y)"zWrites tabular report formats.)r7   r8   r9   r:   r;   r4   r<   r   r3   r5   )namestmtsmisscover      )branchbrpartT)r   ry   Fr@   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   TOTALr-   sr(   z filez" skipped due to complete coverage.z empty filez	 skipped.r   )r   r   show_missingrE   rF   r    numbersrelative_filenamen_statements	n_missing
n_branchesn_partial_branchesrp   missing_formattedrr   appendsortlowergetr   r
   r   skip_coveredr!   
skip_emptyr"   r   rh   rX   )r#   rI   column_orderrJ   rt   ru   numsargssort_optionr   rK   rL   file_suffix	formatterr   s                 @r$   rq   zSummaryReporter.tabular_report   s=    +==x**F7);;##yk!F!!2>==Aa 89 "..NR##D((*D,=,=t~~ND}}$*A*ABBT(())D{{''33T3BCCT__%%D% / {{''1688:q>S G%ab/K^s"%ab/K##K0 89I9I8LMNN& -lGLL:   tzz66

8L8LM
==4::00$**2O2OPPJtzz0011
;;##2$J 	;;##(:(:!%!3!3A!5#2KT''(k]:\] ;;!!d&6&6!%!1!1A!5#2Kr$"2"2!3;{m9UV+--I))I&,
I>r&   c                   |j                   }| xj                  |z  c_        |j                  dk(  }|j                  dk(  }| j                  j
                  r|r|r| xj                  dz  c_        y| j                  j                  r%|j                  dk(  r| xj                  dz  c_	        y| j                  j                  ||f       y)z4Report on just one file, the callback from report().r   r3   N)r   r   r   r   r   r   r!   r   r   r"   r    r   )r#   rt   ru   r   no_missing_linesno_missing_branchess         r$   rn   zSummaryReporter.report_one_file  s    

d
 NNa/#66!;;;##(8=P!#[[##(9(9Q(>!##RN3r&   )r   r   returnNone)r+   rH   r   r   )r/   zIterable[str]r   r   )
rI   	list[str]rJ   zlist[list[Any]]rK   z	list[Any]rL   r   r   r   )N)rs   zIterable[TMorf] | Noner   zIO[str] | Noner   float)r   r   )rt   r   ru   r   r   r   )__name__
__module____qualname____doc__r%   r)   r0   rX   rh   rv   rq   rn   r   r&   r$   r   r      s    4>!#;!;! &;! 	;!
 ;! 
;!z<!<! &<! 	<!
 <! 
<!|%,G?R4r&   r   )r   
__future__r   rj   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 , ( 7 .  !B4 B4r&   