
    V.j),                    2   d Z ddlmZ ddlZddlZddlmZ ddlmZm	Z	m
Z
 ddlmZmZ ddlmZ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 ej;                  ej<                  D  ci c]  } | dvs| d|   c}       ZddZ  G d d      Z!yc c} w )zSummary reporting    )annotationsN)Iterable)IOTYPE_CHECKINGAny)ConfigErrorNoDataError)human_sorted_itemsplural)FileReporter)get_analysis_to_report)AnalysisNumbers)TMorfs)Coveragez.,/-\c                ,    | j                  t              S )zEPrefix all characters meaningful in markdown tables with backslashes.)	translateMARKDOWN_ESCAPES)texts    QC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\coverage/report.pyescape_markdownr      s    >>*++    c                  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 )Nr   >   r   totalmarkdownzUnknown report format choice: r   )	precision)coverageconfigget_datahas_arcsbranchesoutfileformatoutput_formatr   fr_analysesskipped_countempty_countr   r   r   )selfr    s     r   __init__zSummaryReporter.__init__$   s     mm** ))+446'+![[//96%BB >t?Q?Q>TUVV@Bt{{'<'<=
r   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.write1   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_items7   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 ](  }
| j                  fdt        ||
      D               * |r| j                  |	       | j                  fdt        ||      D               |D ]  }| j                  |        y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BrPartr:   Missingname_lennr3   -z{:>{n}}%z   {:9})r:   rB   c              3  j   K   | ]*  \  }}|   j                  t        |      d z
         , ywr9   rC   Nr&   str.0itemvalueformatsmax_nmax_names      r   	<genexpr>z.SummaryReporter.report_text.<locals>.<genexpr>h   s<      ':e DM((Uh%RS)(T':   03c              3  j   K   | ]*  \  }}|   j                  t        |      d z
         , ywrH   rI   rK   s      r   rR   z.SummaryReporter.report_text.<locals>.<genexpr>s   s;      #:KD% $$SZ(eai$P#:rS   N)
maxlenindexdictr&   r4   r/   updater6   zip)r+   headerlines_values
total_line	end_linesr1   rM   header_items
header_strrulevaluesend_linerO   rP   rQ   s               @@@r   report_textzSummaryReporter.report_text;   s     >DG>!DEIC
6<<#89:Q>HNQRRUGP\]P\s4W(=#>?!CP\]]^ 
 \bb[aSW,,TH,N[abWW\*
S_$ 	

:

4 	 !	
 #F'*66': # JJt#&vz#:	
 "HJJx  "] ?] cs   F31'F8
7F=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 ]C  }	j                  t        d             | j                  fdt        ||	      D               E 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 )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  J   K   | ]  }t        t        |d                  yw)r   N)rV   r   )rL   r1   s     r   rR   z2SummaryReporter.report_markdown.<locals>.<genexpr>   s     O,$ODG45,s   !#r   )defaultz	**TOTAL**r9   z| {:{name_len}}|z{:>9} |z	{:>{n}} |z{:>10} |r<   r:      z Cover rC   r3   | z- |rF   Nz-: |z
{:>{n}}% |)r:   c              3  |   K   | ]3  \  }}|   j                  t        t        |            d z
         5 ywrH   )r&   r   rJ   rK   s      r   rR   z2SummaryReporter.report_markdown.<locals>.<genexpr>   sJ       (;e DM(('E
3h%RS) )  (;s   9<z|{:{name_len}} |)r=   r:   z **z%**z**)rU   rV   rX   rW   r&   r4   rjustr/   rY   r6   rZ   )r+   r[   r\   r]   r^   rM   r_   r`   rule_strrb   total_line_itemsrN   insertrc   rO   rP   rQ   s                 @@@r   report_markdownzSummaryReporter.report_markdown|   s:   " O,OYZ[x[!12Q6#
 C
6<<#89:Q>IO[ab[aSW,,TH,N[abWW\*
[[\!_-1378<H<LM<LDv||CIM3/<LMN
 
 	

:

8 #FNN&
  (+66':	 #  	'!	
 ')vz2KD%{ugS)ugR 4 4VhRW 4 XX 3 	)*!HJJx  "[ c Ns   9H%H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,                  r5| j.                  r)|j                  dt1        | j.                  d       d       | j                  j2                  r5| j4                  r)|j                  dt1        | j4                  d       d       | j6                  d k(  r| j8                  }n| j:                  } ||||
|       y)!zWrites tabular report formats.)r=   r>   r?   r@   rA   r:   rB   r   r9   r;   )namestmtsmisscover      )branchbrpartT)r$   r   FrF   N+zInvalid sorting option: )reversec                    |    | d   fS )Nr    )r1   sort_idxs    r   <lambda>z0SummaryReporter.tabular_report.<locals>.<lambda>
  s    $x.$q'!:r   )keyr   TOTALr3   r.   filez" skipped due to complete coverage.z
empty filez	 skipped.r   )r$   r!   show_missingrX   rY   r(   numbersrelative_filenamen_statements	n_missing
n_branchesn_partial_branchesrx   missing_formattedrz   appendsortlowergetr   r
   r   skip_coveredr)   r   
skip_emptyr*   r'   rp   rd   )r+   r[   column_orderr\   r|   r}   numsargssort_optionr   r]   r^   	formatterr   s                @r   ry   zSummaryReporter.tabular_report   s    +==x**F7);;##yk!F!!2>==Aa 89  ,,LB##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 	;;##(:(:VD..788Z[ ;;!!d&6&6r&)9)9<"H!IST+,,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   r9   N)r   r   r   r   r!   r   r)   r   r   r*   r(   r   )r+   r|   r}   r   no_missing_linesno_missing_branchess         r   rv   zSummaryReporter.report_one_file%  s    

d
 NNa/#66!;;;##(8=P!#[[##(9(9Q(>!##RN3r   )r    r   returnNone)r1   rJ   r   r   )r5   zIterable[str]r   r   )
r[   	list[str]r\   zlist[list[Any]]r]   z	list[Any]r^   r   r   r   )N)r{   r   r%   zIO[str] | Noner   float)r   r   )r|   r   r}   r   r   r   )__name__
__module____qualname____doc__r,   r/   r6   rd   rp   r~   ry   rv   r   r   r   r   r   !   s    4>!#?!?! &?! 	?!
 ?! 
?!BK!K! &K! 	K!
 K! 
K!Z%,D?L4r   r   )r   rJ   r   rJ   )"r   
__future__r   stringrr   collections.abcr   typingr   r   r   coverage.exceptionsr   r	   coverage.miscr
   r   coverage.pluginr   coverage.report_corer   coverage.resultsr   r   coverage.typesr   r    r   rJ   	maketranspunctuationr   r   r   )chars   0r   <module>r      s     "  
 $ ) ) 8 4 ( 7 . !!==#)#5#5L#54V9KTRv;#5L 
,
R4 R4 Ms   ,	B6B