Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/coverage/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/coverage/__pycache__/results.cpython-311.pyc

�

�܋fH4����dZddlmZddlZddlmZmZmZmZm	Z	m
Z
mZddlm
Z
ddlmZddlmZddlmZmZerdd	lmZdd
lmZGd�d��ZGd
�de
��Zd d�Z	d!d"d�Zd#d�ZdS)$z Results of coverage measurement.�)�annotationsN)�Callable�Dict�Iterable�List�Optional�Tuple�
TYPE_CHECKING)�
AutoReprMixin)�ConfigError��	nice_pair)�TArc�TLineNo)�CoverageData)�FileReporterc�t�eZdZdZd!d�Zd"d#d�Zd$d�Zd%d�Zd%d�Zd%d�Z	d%d�Z
d&d�Zd'd�Zd(d�Z
d(d�Zd)d�Zd S)*�Analysisz(The results of analyzing a FileReporter.�datar�	precision�int�
file_reporterr�file_mapper�Callable[[str], str]�return�Nonec
�p��|�_|�_|�jj���_�j����_�j����_�j��j��pg}�j�|��}|�_�j�jz
�_	�j�
��r�t�j������_
�j����_�j����_����}����}t'�fd�|���D����}t'd�|���D����}	n'g�_
i�_t+���_dx}x}}	t-|dt/�j��t/�j��t/�j	��|||	����_dS)Nc3�N�K�|]\}}|�jv�t|��V�� dS�N)�missing�len)�.0�k�v�selfs   ��c/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/coverage/results.py�	<genexpr>z$Analysis.__init__.<locals>.<genexpr>3s9�����$\�$\���!�a�t�|�F[�F[�S��V�V�F[�F[�F[�F[�$\�$\�c3�:K�|]\}}t|��V��dSr)r!)r"r#r$s   r&r'z$Analysis.__init__.<locals>.<genexpr>4s,����$C�$C���!�S��V�V�$C�$C�$C�$C�$C�$Cr(r�)r�n_files�n_statements�
n_excluded�	n_missing�
n_branches�n_partial_branches�n_missing_branches)rr�filename�lines�
statements�excluded_lines�excluded�translate_lines�executedr �has_arcs�sorted�arcs�_arc_possibilities�exit_counts�no_branch_lines�	no_branch�_total_branches�missing_branch_arcs�sum�items�set�Numbersr!�numbers)
r%rrrrr8r/�mbar0r1s
`         r&�__init__zAnalysis.__init__s������	�*���#��D�$6�$?�@�@��
��,�2�2�4�4����*�9�9�;�;��
��9�?�?�4�=�1�1�7�R���%�5�5�h�?�?�� ��
�����6����9�����	E�&,�T�-?�-D�-D�-F�-F�&G�&G�D�#�#�1�=�=�?�?�D��!�/�?�?�A�A�D�N��-�-�/�/�J��*�*�,�,�C�!$�$\�$\�$\�$\�s�y�y�{�{�$\�$\�$\�!\�!\��!$�$C�$C�s�y�y�{�{�$C�$C�$C�!C�!C���&(�D�#�!�D�� �U�U�D�N�CD�D�J�D�+�.@�����T�_�-�-��4�=�)�)��$�,�'�'�!�1�1�	
�	
�	
����r(F�branches�bool�strc��|r;|���r'|������}nd}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;)r9rArC�format_linesr4r )r%rIr;s   r&�missing_formattedzAnalysis.missing_formattedFsX���	��
�
���	��+�+�-�-�3�3�5�5�D�D��D��D�O�T�\��E�E�E�Er(c�4�|j���S)z"Were arcs measured in this result?)rr9�r%s r&r9zAnalysis.has_arcsUs���y�!�!�#�#�#r(�
List[TArc]c��|jS)z.Returns a sorted list of the arcs in the code.)r<rPs r&�arc_possibilitieszAnalysis.arc_possibilitiesYs���&�&r(c��|j�|j��pg}|j�|��}t|��S)z@Returns a sorted list of the arcs actually executed in the code.)rr;r2r�translate_arcsr:)r%r8s  r&�
arcs_executedzAnalysis.arcs_executed]sB���9�>�>�$�-�0�0�6�B���%�4�4�X�>�>���h���r(c��������}�������fd�|D��}t|��S)z:Returns a sorted list of the un-executed arcs in the code.c3�`�K�|](}|�vr"|d�jvr|d�jv�$|V��)dS�rr*N)r?r6)r"�pr8r%s  ��r&r'z(Analysis.arcs_missing.<locals>.<genexpr>hs^�����
�
���H�$�$��!��D�N�2�2��!��D�M�1�1�
�2�1�1�1�	
�
r(�rSrVr:)r%�possibler r8s`  @r&�arcs_missingzAnalysis.arcs_missingdsa�����)�)�+�+���%�%�'�'��
�
�
�
�
��
�
�
���g���r(c���|����|���}�fd�|D��}t|��S)zAReturns a sorted list of the executed arcs missing from the code.c3�x�K�|]4}|�vr.|d|dkr|ddks|ddk�0|V��5dSrY�)r"�er\s  �r&r'z,Analysis.arcs_unpredicted.<locals>.<genexpr>ysc�����
�
���H�$�$��!���!�����1�����Q�q�T�A�X�X�
�&.�X�X�X�	
�
r(r[)r%r8�unpredictedr\s   @r&�arcs_unpredictedzAnalysis.arcs_unpredictedps]����)�)�+�+���%�%�'�'��
�
�
�
��
�
�
���k�"�"�"r(�
List[TLineNo]c�H�d�|j���D��S)z<Returns a list of line numbers that have more than one exit.c�$�g|]
\}}|dk�|��S)r*r`)r"�l1�counts   r&�
<listcomp>z*Analysis._branch_lines.<locals>.<listcomp>�s!��I�I�I�x�r�%�u�q�y�y��y�y�yr()r=rCrPs r&�
_branch_lineszAnalysis._branch_lines�s%��I�I�4�#3�#9�#9�#;�#;�I�I�I�Ir(c�b�td�|j���D����S)z"How many total branches are there?c3�&K�|]}|dk�|V��
dS)r*Nr`)r"rhs  r&r'z+Analysis._total_branches.<locals>.<genexpr>�s&����M�M�U�5�1�9�9�5�9�9�9�9�M�Mr()rBr=�valuesrPs r&r@zAnalysis._total_branches�s.���M�M�d�&6�&=�&=�&?�&?�M�M�M�M�M�Mr(�Dict[TLineNo, List[TLineNo]]c���|���}t|�����}tjt
��}|D]$\}}||vr||�|���%|S)zgReturn arcs that weren't executed from branch lines.

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

        )r]rDrj�collections�defaultdict�list�append)r%r �branch_linesrGrg�l2s      r&rAzAnalysis.missing_branch_arcs�sx���#�#�%�%���4�-�-�/�/�0�0���%�d�+�+���	#�	#�F�B���\�!�!��B����r�"�"�"���
r(c���|���}t|�����}tjt
��}|D]$\}}||vr||�|���%|S)zdReturn arcs that were executed from branch lines.

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

        )rVrDrjrprqrrrs)r%r8rt�ebargrus      r&�executed_branch_arcszAnalysis.executed_branch_arcs�sx���%�%�'�'���4�-�-�/�/�0�0���%�d�+�+���	#�	#�F�B���\�!�!��B����r�"�"�"���
r(�Dict[TLineNo, Tuple[int, int]]c��|���}i}|���D].}|j|}t||��}|||z
f||<�/|S)zGet stats about branches.

        Returns a dict mapping line numbers to a tuple:
        (total_exits, taken_exits).
        )rArjr=r!)r%�missing_arcs�stats�lnum�exitsr s      r&�branch_statszAnalysis.branch_stats�sm���/�/�1�1�����&�&�(�(�	3�	3�D��$�T�*�E��,�t�,�-�-�G� �%�'�/�2�E�$�K�K��r(N)
rrrrrrrrrr)F)rIrJrrK)rrJ)rrQ)rrd�rr)rrn)rry)�__name__�
__module__�__qualname__�__doc__rHrNr9rSrVr]rcrjr@rArxrr`r(r&rrs������2�2�+
�+
�+
�+
�Z
F�
F�
F�
F�
F�$�$�$�$�'�'�'�'� � � � �
�
�
�
�#�#�#�#�"J�J�J�J�N�N�N�N���������
�
�
�
�
�
r(rc���eZdZdZ								d d!d�Zd"d�Zed#d���Zed#d���Zed$d���Z	ed%d���Z
d&d�Zd#d�Zed'd���Z
d(d�Zd)d�ZdS)*rEz�The numerical results of measuring coverage.

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

    rrrr+r,r-r.r/r0r1rrc	���d|cxkrdksnJ�||_dd|zz|_d|jz
|_||_||_||_||_||_||_||_	dS)Nr�
g�?�Y@)
�
_precision�_near0�_near100r+r,r-r.r/r0r1)	r%rr+r,r-r.r/r0r1s	         r&rHzNumbers.__init__�s����I�"�"�"�"��"�"�"�"�"�"�#����B�	�M�)������+��
����(���$���"���$���"4���"4����r(�	List[int]c�f�|j|j|j|j|j|j|j|jgS)z:Return a list for __init__(*args) to recreate this object.)r�r+r,r-r.r/r0r1rPs r&�	init_argszNumbers.init_args�s4��
�O��L�$�+�T�_�d�n��O�T�4�d�6M�
�	
r(c� �|j|jz
S)z*Returns the number of executed statements.)r,r.rPs r&�
n_executedzNumbers.n_executed�s��� �4�>�1�1r(c� �|j|jz
S)z(Returns the number of executed branches.)r/r1rPs r&�n_executed_brancheszNumbers.n_executed_branches�s�����!8�8�8r(�floatc�F�|jdkr|j\}}d|z|z}nd}|S)z/Returns a single percentage value for coverage.rr�)r,�
ratio_covered)r%�	numerator�denominator�pc_covs    r&�
pc_coveredzNumbers.pc_covered�s:����q� � �%)�%7�"�I�{��i�'�;�6�F�F��F��
r(rKc�6�|�|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�rPs r&�pc_covered_strzNumbers.pc_covered_str�s���#�#�D�O�4�4�4r(�pcc��d|cxkr|jkrnn|j}n2|j|cxkrdkrnn|j}nt||j��}d|j|fzS)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�dz%.*f)r�r��roundr�)r%r�s  r&r�zNumbers.display_covered�s���
�r�����D�K��������B�B�
�]�R�
%�
%�
%�
%�#�
%�
%�
%�
%�
%���B�B��r�4�?�+�+�B����"�-�-�-r(c�:�d}|jdkr
|d|jzz
}|S)z/How many characters wide can pc_covered_str be?�rr*)r�)r%�widths  r&�pc_str_widthzNumbers.pc_str_widths*�����?�Q����Q���(�(�E��r(�Tuple[int, int]c�F�|j|jz}|j|jz}||fS)z:Return a numerator and denominator for the coverage ratio.)r�r�r,r/)r%r�r�s   r&r�zNumbers.ratio_covereds-���O�d�&>�>�	��'�$�/�9���+�%�%r(�otherc�H�t|j���}|j|jz|_|j|jz|_|j|jz|_|j|jz|_|j|jz|_|j|jz|_|j|jz|_|S)N)r)	rEr�r+r,r-r.r/r0r1)r%r��numss   r&�__add__zNumbers.__add__s������1�1�1���|�e�m�3��� �-��0B�B����/�E�,<�<�����%�/�9����/�E�,<�<����#�e�&>�>�	
��
�#�e�&>�>�	
���r(c��|dksJ�|S)Nrr`)r%r�s  r&�__radd__zNumbers.__radd__(s����z�z�z�z��r(N)rrrrrrrr)rrr+rr,rr-rr.rr/rr0rr1rrr)rr�r�)rr�)rrK)r�r�rrK)rr�)r�rErrE)r�rrrE)r�r�r�r�rHr��propertyr�r�r�r�r�r�r�r�r�r`r(r&rErE�sU��������������"#�"#�5�5�5�5�5�.
�
�
�
��2�2�2��X�2��9�9�9��X�9������X���5�5�5��X�5�.�.�.�.� �����&�&�&��X�&�
�
�
�
������r(rEr4�Iterable[TLineNo]r3r�List[Tuple[TLineNo, TLineNo]]c��t|��}t|��}g}d}d}|D]J}|t|��krn4|||kr|dz
}|s|}|}�/|r|�||f��d}�K|r|�||f��|S)z,Produce a list of ranges for `format_lines`.Nrr*)r:r!rs)r4r3�pairs�start�lidx�stmt�ends       r&�_line_rangesr�.s���
�
�#�#�J��5�M�M�E��E��E��D��
�
���3�u�:�:����E��5��;����A�I�D��
����C�C�
�	��L�L�%���&�&�&��E���#�
���e�S�\�"�"�"��Lr(r;�1Optional[Iterable[Tuple[TLineNo, List[TLineNo]]]]rKc�D�d�t||��D��}|�Wt|��}|D]E\}}t|��D]0}||vr*||vr&|dkr|nd}|�||�d|��f���1�Fd�d�t|��D����}	|	S)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`.

    c�<�g|]}|dt|��f��S)rr
)r"�pairs  r&riz format_lines.<locals>.<listcomp>_s'��Y�Y�Y��4��7�I�d�O�O�,�Y�Y�Yr(Nr�exitz->z, c3�&K�|]}|dV��
dS)���Nr`)r"�ts  r&r'zformat_lines.<locals>.<genexpr>hs&����6�6�a�A�b�E�6�6�6�6�6�6r()r�r:rs�join)
r4r3r;�
line_items�
line_exits�liner~�ex�dest�rets
          r&rMrMIs���,Z�Y��j�RW�9X�9X�Y�Y�Y�J����D�\�\�
�%�	A�	A�K�D�%��U�m�m�
A�
A���u�$�$��5���"$�q�&�&�B�B�f�D��%�%�t��->�->��->�->�&?�@�@�@��
A�
�)�)�6�6�6�*�#5�#5�6�6�6�
6�
6�C��Jr(�totalr��
fail_underrrrJc��d|cxkrdksnd|�d�}t|���|dkr|dkrdSt||��|kS)a'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 number of digits
    to consider after the decimal point.

    Returns True if the total should fail.

    rr�zfail_under=z' is invalid. Must be between 0 and 100.T)rr�)r�r�r�msgs    r&�should_fail_underr�lsp��
��$�$�$�$�u�$�$�$�$�O�J�O�O�O���#�����U���u��~�~��t���	�"�"�Z�/�/r()r4r�r3r�rr�r)r4r�r3r�r;r�rrK)r�r�r�r�rrrrJ)r��
__future__rrp�typingrrrrrr	r
�coverage.debugr�coverage.exceptionsr�
coverage.miscr�coverage.typesrr�
coverage.datar�coverage.pluginrrrEr�rMr�r`r(r&�<module>r�s���'�&�"�"�"�"�"�"�����Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�(�(�(�(�(�(�+�+�+�+�+�+�#�#�#�#�#�#�(�(�(�(�(�(�(�(��-�*�*�*�*�*�*�,�,�,�,�,�,�\�\�\�\�\�\�\�\�~v�v�v�v�v�m�v�v�v�r����<?C� � � � � �F0�0�0�0�0�0r(

Hacked By AnonymousFox1.0, Coded By AnonymousFox