Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/site-packages/coverage/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/coverage/__pycache__/annotate.cpython-37.pyc

B

E�W(
�@s\dZddlZddlZddlZddlmZddlmZddlm	Z	ee�ZGdd�de	�Z
dS)z'Source file annotation for coverage.py.�N)�
flat_rootname)�isolate_module)�ReportercsFeZdZdZ�fdd�Ze�d�Ze�d�Zddd�Z	d	d
�Z
�ZS)�AnnotateReporteraGenerate annotated source files showing line coverage.

    This reporter creates annotated copies of the measured source files. Each
    .py file is copied as a .py,cover file, with a left-hand margin annotating
    each line::

        > def h(x):
        -     if 0:   #pragma: no cover
        -         pass
        >     if x == 1:
        !         a = 1
        >     else:
        >         a = 2

        > h(2)

    Executed lines use '>', lines not executed use '!', lines excluded from
    consideration use '-'.

    cstt|��||�d|_dS)N)�superr�__init__�	directory)�self�coverage�config)�	__class__��D/opt/alt/python37/lib64/python3.7/site-packages/coverage/annotate.pyr'szAnnotateReporter.__init__z\s*(#|$)z\s*else\s*:\s*(#|$)NcCs|�|j||�dS)zIRun the report.

        See `coverage.report()` for arguments.

        N)Zreport_files�
annotate_file)r	Zmorfsrr
r
r�report.szAnnotateReporter.reportc	Cs$t|j�}t|j�}t|j�}|jr`tj�|jt|�	���}|�
d�rV|dd�d}|d7}n
|jd}tj
|ddd����}d	}d	}	d
}
|��}�x�t|�d
�dd�D�]h\}}
x$|t|�kr�|||kr�|d7}q�Wx$|	t|�kr�||	|kr�|	d7}	q�W|t|�k�r4|||k�r4|	t|�k�p2||	|k}
|j�|
��rN|�d
�n�|j�|
��r�|t|�k�r�|	t|�k�r�|�d�nP|t|�k�s�|	t|�k�r�|�d�n(||||	k�r�|�d�n
|�d�n2||k�r�|�d�n|
�r�|�d�n
|�d�|�|
�q�WWdQRXdS)z]Annotate a single file.

        `fr` is the FileReporter for the file to annotate.

        Z_pyN���z.pyz,cover�w�utf8)�encodingrT�)�startz  z! z> z- )�sorted�
statements�missing�excludedr�os�path�joinrZrelative_filename�endswith�filename�io�open�source�	enumerate�
splitlines�len�blank_re�match�write�else_re)r	�frZanalysisrrrZ	dest_file�dest�i�jZcoveredr"�lineno�liner
r
rr6sJ





 

zAnnotateReporter.annotate_file)N)�__name__�
__module__�__qualname__�__doc__r�re�compiler&r)rr�
__classcell__r
r
)rrrs


r)r3r rr4Zcoverage.filesrZ
coverage.miscrZcoverage.reportrrr
r
r
r�<module>s