Ë
    oPêj©H  ã                  óX  — d Z ddlm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 ddlmZ dd	lmZmZ dd
lmZmZ erddlmZ ddlmZ 	 	 	 	 	 	 	 	 	 	 dd„Ze G d„ d«      «       Zee   Z G d„ d«      Ze G d„ d«      «       Zdd„Z	 	 	 	 	 	 dd„Z	 d	 	 	 	 	 	 	 dd„Z dd„Z!d d„Z"d!d„Z#y)"z Results of coverage measurement.é    )ÚannotationsN)ÚIterable)Ú	dataclass)ÚDecimal)ÚTYPE_CHECKING)ÚConfigError)ÚfirstÚ	nice_pair)ÚTArcÚTLineNo)ÚCoverageData)ÚFileReporterÚAnalysisc                óp  — | j                  «       }|j                  «       }|j                  «       }|j                  | j                  |«      xs g «      |z  }|�r"|j	                  «       }| j	                  |«      xs g }	|j                  |	«      }	t        j                  t        «      }
|D ]  \  }}|
|   j                  |«       Œ |
j                  «       D ��ci c]   \  }}t        |«      dk(  sŒ|t        |«      “Œ" }}}t        «       }|	D ]9  \  }}||k7  r|j                  ||f«       Œ||v sŒ$|j                  |||   f«       Œ; |j                  |«      }|j                  «       }|j                  «       }n t        «       }t        «       }i }t        «       }t        ||||||||||¬«
      S c c}}w )z'Create an Analysis from a FileReporter.é   ©
Ú	precisionÚfilenameÚhas_arcsÚ
statementsÚexcludedÚexecutedÚarc_possibilities_setÚarcs_executed_setÚexit_countsÚ	no_branch)r   ÚlinesÚexcluded_linesÚtranslate_linesÚarcsÚtranslate_arcsÚcollectionsÚdefaultdictÚsetÚaddÚitemsÚlenr	   r   Úno_branch_linesr   )Údatar   Úfile_reporterr   r   r   r   r   r   r    ÚdestsÚfromnoÚtonoÚtonosÚsingle_destsÚnew_arcsr   r   r   s                      úU/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/coverage/results.pyÚanalysis_from_file_reporterr2      s¼  € ð �}‰}‹€HØ×$Ñ$Ó&€JØ×+Ñ+Ó-€HØ×,Ñ,¨T¯Z©Z¸Ó-AÒ-GÀRÓHÈ:ÑU€HâØ -× 2Ñ 2Ó 4ÐØ#Ÿy™y¨Ó2Ò8°bˆØ×+Ñ+¨DÓ1ˆô ×'Ñ'¬Ó,ˆØ1ò 	$‰LˆF�DØ�&‰M×Ñ˜dÕ#ð	$àBGÇ+Á+Ã-×c±°¸ÔSVÐW\ÓS]ÐabÓSb˜¤ e£Ñ,ÐcˆÑcÜ“5ˆØ ò 	A‰LˆF�DØ˜Š~Ø—‘˜f d˜^Õ,à˜\Ò)Ø—L‘L &¨,°vÑ*>Ð!?Õ@ð	Að *×8Ñ8¸ÓBÐØ#×/Ñ/Ó1ˆØ!×1Ñ1Ó3‰	ä #£ÐÜ›EÐØˆÜ“Eˆ	äØØØØØØØ3Ø+ØØôð ùó% ds   ÃF2Ã2F2c                  ó¸   — e Zd ZU dZded<   ded<   ded<   ded	<   ded
<   ded<   ded<   ded<   ded<   ded<   dd„Zddd„Zdd„Zdd„Zd d„Z	d!d„Z
d!d„Zd"d„Zy)#r   z(The results of analyzing a FileReporter.Úintr   Ústrr   Úboolr   úset[TLineNo]r   r   r   ú	set[TArc]r   r   zdict[TLineNo, int]r   r   c           
     óJ  ‡ — t        ‰ j                  «      ‰ _        t        ‰ j                  «      ‰ _        ‰ j
                  ‰ j                  z
  ‰ _        ‰ j                  rc‰ j                  «       }‰ j                  «       }t        ˆ fd„|j                  «       D «       «      }t        d„ |j                  «       D «       «      }ndx}x}}t        ‰ j                  dt        ‰ j
                  «      t        ‰ j                   «      t        ‰ j                  «      |||¬«      ‰ _        y )Nc              3  óX   •K  — | ]!  \  }}|‰j                   vsŒt        |«      –— Œ# y ­w©N)Úmissingr'   )Ú.0ÚkÚvÚselfs      €r1   ú	<genexpr>z)Analysis.__post_init__.<locals>.<genexpr>e   s'   øè ø€ Ò$]±°°1ÀqÐPT×P\ÑP\ÒG\¤S¨§VÑ$]ùs   ƒ*š*c              3  ó8   K  — | ]  \  }}t        |«      –— Œ y ­wr;   )r'   )r=   r>   r?   s      r1   rA   z)Analysis.__post_init__.<locals>.<genexpr>f   s   è ø€ Ò$D±°°1¤S¨§VÑ$Dùs   ‚r   r   )r   Ún_filesÚn_statementsÚ
n_excludedÚ	n_missingÚ
n_branchesÚn_partial_branchesÚn_missing_branches)Úsortedr   Úarc_possibilitiesr   Úarcs_executedr   r   r<   r   Ú_total_branchesÚmissing_branch_arcsÚsumr&   ÚNumbersr   r'   r   Únumbers)r@   rG   ÚmbarH   rI   s   `    r1   Ú__post_init__zAnalysis.__post_init__]   sâ   ø€ Ü!'¨×(BÑ(BÓ!CˆÔÜ# D×$:Ñ$:Ó;ˆÔØ—‘¨¯©Ñ6ˆŒà�=Š=Ø×-Ñ-Ó/ˆJØ×*Ñ*Ó,ˆCÜ!$Ó$]¸¿	¹	»Ô$]Ó!]ÐÜ!$Ñ$D¸¿	¹	»Ô$DÓ!DÑàCDÐDˆJÐDÐ+Ð.@äØ—n‘nØÜ˜TŸ_™_Ó-Ü˜4Ÿ=™=Ó)Ü˜$Ÿ,™,Ó'Ø!Ø1Ø1ô	
ˆ�ó    c                ó¤   — |r+| j                   r| j                  «       j                  «       }nd}t        | j                  | j
                  |¬«      S )z¯The missing line numbers, formatted nicely.

        Returns a string like "1-2, 5-11, 13-14".

        If `branches` is true, includes the missing branch arcs also.

        N)r    )r   rN   r&   Úformat_linesr   r<   )r@   Úbranchesr    s      r1   Úmissing_formattedzAnalysis.missing_formattedu   s@   € ñ ˜ŸšØ×+Ñ+Ó-×3Ñ3Ó5‰DàˆDä˜DŸO™O¨T¯\©\ÀÔEÐErT   c                óD   ‡ — ˆ fd„‰ j                   D «       }t        |«      S )z:Returns a sorted list of the un-executed arcs in the code.c              3  ó‚   •K  — | ]6  }|‰j                   vr&|d    ‰j                  vr|d   ‰j                  vr|–— Œ8 y­w)r   r   N)r   r   r   )r=   Úpr@   s     €r1   rA   z(Analysis.arcs_missing.<locals>.<genexpr>†   sG   øè ø€ ò 
àØ˜×.Ñ.Ñ.Ø�!‘˜DŸN™NÑ*Ø�!‘˜DŸM™MÑ)ô	 ñ
ùs   ƒ<?)rK   rJ   )r@   r<   s   ` r1   Úarcs_missingzAnalysis.arcs_missing„   s$   ø€ ó
à×+Ñ+ô
ˆô �g‹ÐrT   c                ót   — | j                   j                  «       D ��cg c]  \  }}|dkD  sŒ|‘Œ c}}S c c}}w )z<Returns a list of line numbers that have more than one exit.r   )r   r&   )r@   Úl1Úcounts      r1   Ú_branch_lineszAnalysis._branch_lines�   s/   € à$(×$4Ñ$4×$:Ñ$:Ó$<×J‘y�r˜5ÀÈÃ	’ÓJÐJùÓJs   ž4¬4c                óV   — t        d„ | j                  j                  «       D «       «      S )z"How many total branches are there?c              3  ó,   K  — | ]  }|d kD  sŒ	|–— Œ y­w)r   N© )r=   r_   s     r1   rA   z+Analysis._total_branches.<locals>.<genexpr>•   s   è ø€ ÒM˜UÀ5È1Ã9”5ÑMùs   ‚
�)rO   r   Úvalues©r@   s    r1   rM   zAnalysis._total_branches“   s"   € äÑM d×&6Ñ&6×&=Ñ&=Ó&?ÔMÓMÐMrT   c                ó  — | j                  «       }t        | j                  «       «      }t        j                  t
        «      }|D ]=  \  }}||k7  sJ d| j                  › d|› d|› �«       ‚||v sŒ*||   j                  |«       Œ? |S )zgReturn arcs that weren't executed from branch lines.

        Returns {l1:[l2a,l2b,...], ...}

        zIn z, didn't expect z == )r\   r$   r`   r"   r#   Úlistr   Úappend)r@   r<   Úbranch_linesrR   r^   Úl2s         r1   rN   zAnalysis.missing_branch_arcs—   s�   € ð ×#Ñ#Ó%ˆÜ˜4×-Ñ-Ó/Ó0ˆÜ×%Ñ%¤dÓ+ˆØò 	#‰FˆB�Ø˜’8ÐN˜s 4§=¡= /Ð1AÀ"ÀÀTÈ"ÈÐNÓN�8Ø�\Ò!Ø�B‘—‘˜rÕ"ð	#ð ˆ
rT   c                ó
  — t        | j                  «       «      }t        j                  t        «      }| j
                  D ]A  \  }}||k7  sJ d|›d|›�«       ‚||f| j                  vrŒ)||v sŒ.||   j                  |«       ŒC |S )zœReturn arcs that were executed from branch lines.

        Only include ones that we considered possible.

        Returns {l1:[l2a,l2b,...], ...}

        z+Oops: Didn't think this could happen: l1 = z, l2 = )r$   r`   r"   r#   rg   rL   r   rh   )r@   ri   Úebar^   rj   s        r1   Úexecuted_branch_arcszAnalysis.executed_branch_arcs¦   s“   € ô ˜4×-Ñ-Ó/Ó0ˆÜ×%Ñ%¤dÓ+ˆØ×(Ñ(ò 	#‰FˆB�Ø˜’8ÐVÐKÀbÀWÈHÈrÈgÐVÓV�8Ø�Bˆx˜t×9Ñ9Ñ9ØØ�\Ò!Ø�B‘—‘˜rÕ"ð	#ð ˆ
rT   c                ó¢   — | j                  «       }i }| j                  «       D ])  }| j                  |   }t        ||   «      }|||z
  f||<   Œ+ |S )z€Get stats about branches.

        Returns a dict mapping line numbers to a tuple:
        (total_exits, taken_exits).

        )rN   r`   r   r'   )r@   Úmissing_arcsÚstatsÚlnumÚexitsr<   s         r1   Úbranch_statszAnalysis.branch_stats¸   sg   € ð ×/Ñ/Ó1ˆØˆØ×&Ñ&Ó(ò 	3ˆDØ×$Ñ$ TÑ*ˆEÜ˜, tÑ,Ó-ˆGØ  %¨'¡/Ð2ˆE�$ŠKð	3ð ˆrT   N)ÚreturnÚNone)F)rW   r6   rt   r5   )rt   z
list[TArc])rt   zlist[TLineNo]©rt   r4   )rt   zdict[TLineNo, list[TLineNo]])rt   zdict[TLineNo, tuple[int, int]])Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__rS   rX   r\   r`   rM   rN   rm   rs   rc   rT   r1   r   r   N   si   … á2àƒNØƒMØƒNØÓØÓØÓØ$Ó$Ø Ó Ø#Ó#ØÓó
ô0Fó	óKóNóóô$rT   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)	ÚAnalysisNarrowera  
    For reducing an `Analysis` to a subset of its lines.

    Originally this was a simpler method on Analysis, but that led to quadratic
    behavior.  This class does the bulk of the work up-front to provide the
    same results in linear time.

    Create an AnalysisNarrower from an Analysis, bulk-add region lines to it
    with `add_regions`, then individually request new narrowed Analysis objects
    for each region with `narrow`.  Doing most of the work in limited calls to
    `add_regions` lets us avoid poor performance.
    c                óÆ   — || _         t        j                  t        «      | _        t        j                  t        «      | _        t        j                  t        «      | _        y r;   )Úanalysisr"   r#   r$   Úregion2arc_possibilitiesÚregion2arc_executedÚdictÚregion2exit_counts)r@   r   s     r1   Ú__init__zAnalysisNarrower.__init__Ü   sH   € Ø ˆŒÜGR×G^ÑG^Ô_bÓGcˆÔ%ÜBM×BYÑBYÔZ]ÓB^ˆÔ ÜJU×JaÑJaÜóK
ˆÕrT   c                óÌ  ‡	— | j                   j                  rÍi Š	|D ]  }t        |«      }|D ]  }|‰	|<   Œ	 Œ 	 	 	 	 	 	 dˆ	fd„} || j                   j                  | j                  «        || j                   j
                  | j                  «       | j                   j                  j                  «       D ]+  \  }}‰	j                  |«      x}sŒ|| j                  |   |<   Œ- yy)z™
        Pre-process a number of sets of line numbers.  Later calls to `narrow`
        with one of these sets will provide a narrowed Analysis.
        c                óÀ   •— | D ]X  \  }}‰j                  |«      x}r||   j                  ||f«       ‰j                  |«      x}sŒC||   j                  ||f«       ŒZ y r;   )Úgetr%   )Úarc_setÚregion2arcsÚaÚbÚrÚline2regions        €r1   Úcollect_arcsz2AnalysisNarrower.add_regions.<locals>.collect_arcsñ   sl   ø€ ð $ò 3‘D�A�qØ'ŸO™O¨AÓ.Ð.�qÐ.Ø# A™×*Ñ*¨A¨q¨6Ô2Ø'ŸO™O¨AÓ.Ð.�qÑ.Ø# A™×*Ñ*¨A¨q¨6Õ2ñ	3rT   N)rˆ   r8   r‰   zdict[TRegionLines, set[TArc]]rt   ru   )r   r   Ú	frozensetr   r€   r   r�   r   r&   r‡   rƒ   )
r@   Úlinessr   ÚfzlinesÚlinerŽ   ÚlnoÚnumrŒ   r�   s
            @r1   Úadd_regionszAnalysisNarrower.add_regionsä   sò   ø€ ð
 �=‰=×!Ò!Ø79ˆKàò 0�Ü# EÓ*�Ø!ò 0�DØ(/�K Ò%ñ0ð0ð
3Ø"ð3à:ð3ð õ3ñ ˜Ÿ™×<Ñ<¸d×>[Ñ>[Ô\Ù˜Ÿ™×8Ñ8¸$×:RÑ:RÔSà ŸM™M×5Ñ5×;Ñ;Ó=ò :‘��SØ#Ÿ™¨Ó,Ð,�1Ñ,Ø69�D×+Ñ+¨AÑ.¨sÒ3ñ:ð+ "rT   c                óJ  — | j                   j                  |z  }| j                   j                  |z  }| j                   j                  |z  }| j                   j                  rRt        |«      }| j                  |   }| j                  |   }| j                  |   }| j                   j                  |z  }	n t        «       }t        «       }i }t        «       }	t        | j                   j                  | j                   j                  | j                   j                  |||||||	¬«
      S )z�Create a narrowed Analysis.

        The current analysis is copied to make a new one that only considers
        the lines in `lines`.
        r   )r   r   r   r   r   r�   r€   r�   rƒ   r   r$   r   r   r   )
r@   r   r   r   r   r‘   r   r   r   r   s
             r1   ÚnarrowzAnalysisNarrower.narrow  s  € ð —]‘]×-Ñ-°Ñ5ˆ
Ø—=‘=×)Ñ)¨EÑ1ˆØ—=‘=×)Ñ)¨EÑ1ˆà�=‰=×!Ò!Ü Ó&ˆGØ$(×$AÑ$AÀ'Ñ$JÐ!Ø $× 8Ñ 8¸Ñ AÐØ×1Ñ1°'Ñ:ˆKØŸ™×/Ñ/°%Ñ7‰Iä$'£EÐ!Ü #£ÐØˆKÜ›ˆIäØ—m‘m×-Ñ-Ø—]‘]×+Ñ+Ø—]‘]×+Ñ+Ø!ØØØ"7Ø/Ø#Øô
ð 	
rT   N)r   r   rt   ru   )r�   zIterable[set[TLineNo]]rt   ru   )r   r7   rt   r   )rw   rx   ry   rz   r„   r•   r—   rc   rT   r1   r}   r}   Ì   s   „ ñó
ó:ô<&
rT   r}   c                  ó`  — e Zd ZU dZdZded<   dZded<   dZded<   dZded<   dZ	ded<   dZ
ded	<   dZded
<   dZded<   edd„«       Zedd„«       Zedd„«       Zedd„«       Zdd„Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zd d„Zd!d„Zy)"rP   zœThe numerical results of measuring coverage.

    This holds the basic statistics from `Analysis`, and is used to roll
    up statistics across files.

    r   r4   r   rC   rD   rE   rF   rG   rH   rI   c                ó4   — | j                   | j                  z
  S )z*Returns the number of executed statements.)rD   rF   re   s    r1   Ú
n_executedzNumbers.n_executed=  s   € ð × Ñ  4§>¡>Ñ1Ð1rT   c                ó4   — | j                   | j                  z
  S )z(Returns the number of executed branches.)rG   rI   re   s    r1   Ún_executed_brancheszNumbers.n_executed_branchesB  s   € ð �‰ ×!8Ñ!8Ñ8Ð8rT   c                ó2   — | j                   | j                  fS )z4Return numerator/denominator for statement coverage.)rš   rD   re   s    r1   Úratio_statementszNumbers.ratio_statementsG  s   € ð �‰ × 1Ñ 1Ð1Ð1rT   c                ó2   — | j                   | j                  fS )z1Return numerator/denominator for branch coverage.)rœ   rG   re   s    r1   Úratio_brancheszNumbers.ratio_branchesL  s   € ð ×'Ñ'¨¯©Ð8Ð8rT   c                ó   — |dkD  rd|z  |z  S y)zHelper for pc_* properties.r   ç      Y@rc   ©r@   Ú	numeratorÚdenominators      r1   Ú_percentzNumbers._percentQ  s   € à˜Š?Ø˜IÑ%¨Ñ4Ð4ØrT   c                ó4   —  | j                   | j                  Ž S )z/Returns a single percentage value for coverage.)r¦   Úratio_coveredre   s    r1   Ú
pc_coveredzNumbers.pc_coveredW  s   € ð ˆt�}‰}˜d×0Ñ0Ð1Ð1rT   c                ó4   —  | j                   | j                  Ž S )z.Returns the percentage covered for statements.)r¦   rž   re   s    r1   Úpc_statementszNumbers.pc_statements\  s   € ð ˆt�}‰}˜d×3Ñ3Ð4Ð4rT   c                ó4   —  | j                   | j                  Ž S )z,Returns the percentage covered for branches.)r¦   r    re   s    r1   Úpc_brancheszNumbers.pc_branchesa  s   € ð ˆt�}‰}˜d×1Ñ1Ð2Ð2rT   c                óB   — t        | j                  | j                  «      S )a  Returns the percent covered, as a string, without a percent sign.

        Note that "0" is only returned when the value is truly zero, and "100"
        is only returned when the value is truly 100.  Rounding can never
        result in either "0" or "100".

        )Údisplay_coveredr©   r   re   s    r1   Úpc_covered_strzNumbers.pc_covered_strf  s   € ô ˜tŸ™°·±Ó?Ð?rT   c                óB   — t        | j                  | j                  «      S )z=Returns the statement percent covered without a percent sign.)r¯   r«   r   re   s    r1   Úpc_statements_strzNumbers.pc_statements_strq  s   € ô ˜t×1Ñ1°4·>±>ÓBÐBrT   c                óB   — t        | j                  | j                  «      S )z:Returns the branch percent covered without a percent sign.)r¯   r­   r   re   s    r1   Úpc_branches_strzNumbers.pc_branches_strv  s   € ô ˜t×/Ñ/°·±Ó@Ð@rT   c                ón   — | j                   | j                  z   }| j                  | j                  z   }||fS )z:Return a numerator and denominator for the coverage ratio.)rš   rœ   rD   rG   r£   s      r1   r¨   zNumbers.ratio_covered{  s7   € ð —O‘O d×&>Ñ&>Ñ>ˆ	Ø×'Ñ'¨$¯/©/Ñ9ˆØ˜+Ð%Ð%rT   c                ó|  — t        | j                  | j                  |j                  z   | j                  |j                  z   | j                  |j                  z   | j
                  |j
                  z   | j                  |j                  z   | j                  |j                  z   | j                  |j                  z   «      S r;   )	rP   r   rC   rD   rE   rF   rG   rH   rI   ©r@   Úothers     r1   Ú__add__zNumbers.__add__‚  s–   € ÜØ�N‰NØ�L‰L˜5Ÿ=™=Ñ(Ø×Ñ × 2Ñ 2Ñ2Ø�O‰O˜e×.Ñ.Ñ.Ø�N‰N˜UŸ_™_Ñ,Ø�O‰O˜e×.Ñ.Ñ.Ø×#Ñ# e×&>Ñ&>Ñ>Ø×#Ñ# e×&>Ñ&>Ñ>ó	
ð 		
rT   c                ó   — |dk(  sJ ‚| S )Nr   rc   r·   s     r1   Ú__radd__zNumbers.__radd__Ž  s   € à˜ŠzÐˆzØˆrT   Nrv   )rt   ztuple[int, int])r¤   r4   r¥   r4   rt   Úfloat)rt   r¼   )rt   r5   )r¸   rP   rt   rP   )r¸   r4   rt   rP   )rw   rx   ry   rz   r   r{   rC   rD   rE   rF   rG   rH   rI   Úpropertyrš   rœ   rž   r    r¦   r©   r«   r­   r°   r²   r´   r¨   r¹   r»   rc   rT   r1   rP   rP   +  sJ  … ñð €IˆsÓØ€GˆSÓØ€L�#ÓØ€J�ÓØ€IˆsÓØ€J�ÓØÐ˜ÓØÐ˜Óàò2ó ð2ð ò9ó ð9ð ò2ó ð2ð ò9ó ð9óð ò2ó ð2ð ò5ó ð5ð ò3ó ð3ð ò@ó ð@ð òCó ðCð òAó ðAð ò&ó ð&ó

ôrT   rP   c                ó²   — |dk  rt        d|› d�«      ‚dd|z  z  }d| cxk  r|k  rn n|} n#d|z
  | cxk  rdk  r	n nd|z
  } nt        | |«      } | d|› d	�›S )
zîReturn a displayable total percentage, as a string.

    Note that "0" is only returned when the value is truly zero, and "100"
    is only returned when the value is truly 100.  Rounding can never
    result in either "0" or "100".

    r   z
precision=z" is invalid. Must not be negative.g      ð?é
   r¢   éd   ú.Úf)r   Úround)Úpcr   Únear0s      r1   r¯   r¯   ”  sw   € ð �1‚}Ü˜J y kÐ1SÐTÓUÐUà�"�i‘-Ñ€EØˆ2„~�…~Ø‰Ø
�%‰-˜2Ô	# Õ	#Ø�U‰]‰ä�2�yÓ!ˆØ��9�+˜Q�ÐÐ rT   c                óî   — t        | «      } t        |«      }g }d}d}| D ]>  }|t        |«      k\  r n.|||   k(  r|dz  }|s|}|}Œ'|sŒ*|j                  |f«       d}Œ@ |r|j                  |f«       |S )z,Produce a list of ranges for `format_lines`.Nr   r   )rJ   r'   rh   )r   r   ÚpairsÚstartÚlidxÚstmtÚends          r1   Ú_line_rangesrÌ   ©  s˜   € ô
 ˜
Ó#€JÜ�5‹M€Eà€EØ €EØ€DØò 
ˆØ”3�u“:ÒÙØ�5˜‘;ÒØ�A‰IˆDÙØ�Ø‰CÚØ�L‰L˜% ˜Ô&Ø‰Eð
ñ Ø�‰�e˜S�\Ô"Ø€LrT   c                óD  — t        | |«      D �cg c]  }|d   t        |«      f‘Œ }}|�Pt        |«      }|D ]@  \  }}t        |«      D ]-  }||vsŒ||vsŒ|dkD  r|nd}	|j                  ||› d|	› �f«       Œ/ ŒB dj	                  d„ t        |«      D «       «      }
|
S c c}w )a¿  Nicely format a list of line numbers.

    Format a list of line numbers for printing by coalescing groups of lines as
    long as the lines represent consecutive statements.  This will coalesce
    even if there are gaps between statements.

    For example, if `statements` is [1,2,3,4,5,10,11,12,13,14] and
    `lines` is [1,2,5,10,11,13,14] then the result will be "1-2, 5-11, 13-14".

    Both `lines` and `statements` can be any iterable. All of the elements of
    `lines` must be in `statements`, and all of the values must be positive
    integers.

    If `arcs` is provided, they are (start,[end,end,end]) pairs that will be
    included in the output as long as start isn't in `lines`.

    r   Úexitz->z, c              3  ó&   K  — | ]	  }|d    –— Œ y­w)éÿÿÿÿNrc   )r=   Úts     r1   rA   zformat_lines.<locals>.<genexpr>ã  s   è ø€ Ò6˜a�A�b•EÑ6ùs   ‚)rÌ   r
   rJ   rh   Újoin)r   r   r    ÚpairÚ
line_itemsÚ
line_exitsr’   rr   ÚexÚdestÚrets              r1   rV   rV   Ä  sÅ   € ô, :FÀjÐRWÓ9XÖY°�4˜‘7œI d›OÒ,ÐY€JÐYØÐÜ˜D“\ˆ
Ø%ò 	A‰KˆD�%Ü˜U“mò A�Ø˜uÒ$¨°5ªØ!# a¢™2¨V�DØ×%Ñ% t°¨v°R¸°vÐ->Ð&?Õ@ñAð	Að �)‰)Ñ6¤6¨*Ó#5Ô6Ó
6€CØ€Jùò Zs   �Bc                ó¦   — | t        | «      k(  r|S t        t        | «      «      j                  «       j                  }t        |t        |«       «      S )z>Use at least enough decimal places to represent the threshold.)r4   r   r5   Úas_tupleÚexponentÚmax)Ú
fail_underr   rÛ   s      r1   Ú_fail_under_precisionrÞ   ç  sD   € à”S˜“_Ò$ØÐÜ”s˜:“Ó'×0Ñ0Ó2×;Ñ;€HÜˆyœ3˜x›=˜.Ó)Ð)rT   c                ó†   — d|cxk  rdk  sn d|› d�}t        |«      ‚|dk(  r| dk7  ryt        | t        ||«      «      |k  S )aM  Determine if a total should fail due to fail-under.

    `total` is a float, the coverage measurement total. `fail_under` is the
    fail_under setting to compare with. `precision` is the minimum number of
    digits to consider after the decimal point. The threshold can imply more.

    Returns True if the total should fail.

    r   r¢   zfail_under=z' is invalid. Must be between 0 and 100.T)r   rÃ   rÞ   )ÚtotalrÝ   r   Úmsgs       r1   Úshould_fail_underrâ   ï  sX   € ð �Ô$˜uÔ$Ø˜J˜<Ð'NÐOˆÜ˜#ÓÐð �UÒ˜u¨š~Øä�Ô-¨j¸)ÓDÓEÈ
ÑRÐRrT   c                óŒ   — t        ||«      }|dk(  r| dk7  rt        | |«      }nt        | |«      d|› d�›}|d|› d�›}d|› d|› �S )zÅFormat the fail-under failure message with values that match the check.

    Use the same effective precision as `should_fail_under`, including the
    decimal places implied by `fail_under`.

    r¢   rÁ   rÂ   z	total of z is less than fail-under=)rÞ   r¯   rÃ   )rà   rÝ   r   Úshown_totalÚshown_fail_unders        r1   Úformat_fail_under_msgræ     sn   € ô & j°)Ó<€IØ�UÒ˜u¨š~ô & e¨YÓ7‰ä˜u iÓ0°°9°+¸Q°Ð?ˆà$ Q y k° NÐ3ÐØ�{�mÐ#<Ð=MÐ<NÐOÐOrT   )
r)   r   r   r4   r*   r   r   r5   rt   r   )rÄ   r¼   r   r4   rt   r5   )r   úIterable[TLineNo]r   rç   rt   zlist[tuple[TLineNo, TLineNo]]r;   )r   rç   r   rç   r    z.Iterable[tuple[TLineNo, list[TLineNo]]] | Nonert   r5   )rÝ   r¼   r   r4   rt   r4   )rà   r¼   rÝ   r¼   r   r4   rt   r6   )rà   r¼   rÝ   r¼   r   r4   rt   r5   )$rz   Ú
__future__r   r"   Úcollections.abcr   Údataclassesr   Údecimalr   Útypingr   Úcoverage.exceptionsr   Úcoverage.miscr	   r
   Úcoverage.typesr   r   Úcoverage.datar   Úcoverage.pluginr   r2   r   r�   ÚTRegionLinesr}   rP   r¯   rÌ   rV   rÞ   râ   ræ   rc   rT   r1   ú<module>ró      s  ðñ 'õ #ã Ý $Ý !Ý Ý  å +ß *ß (áÝ*Ý,ð2Ø
ð2àð2ð  ð2ð ð	2ð
 ó2ðj ÷wð wó ðwðt ˜Ñ!€÷\
ñ \
ð~ ÷eð eó ðeóP!ð*Ø!ðàðð #óð< <@ð Ø!ð àð ð 9ð ð 	ó	 óF*óSô,PrT   