Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/site-packages/coverage/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/site-packages/coverage/__pycache__/annotate.cpython-35.pyc



E�W(
�@s�dZddlZddlZddlZddlmZddlmZddlm	Z	ee�ZGdd�de	�Z
dS)z'Source file annotation for coverage.py.�N)�
flat_rootname)�isolate_module)�ReportercsaeZdZdZ�fdd�Zejd�Zejd�Zddd�Z	d	d
�Z
�S)�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 '-'.

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

        See `coverage.report()` for arguments.

        N)Zreport_files�
annotate_file)r	Zmorfsrr
r
r�report.szAnnotateReporter.reportcCs�t|j�}t|j�}t|j�}|jr�tjj|jt|j	���}|j
d�r}|dd�d}|d7}n
|jd}tj
|ddd��}d	}d	}	d
}
|j�}x�t|jd
�dd�D]�\}}
x0|t|�kr*|||kr*|d7}q�Wx0|	t|�kr]||	|kr]|	d7}	q.W|t|�kr�|||kr�|	t|�kp�||	|k}
|jj|
�r�|jd
�n�|jj|
�rr|t|�kr
|	t|�kr
|jd�q�|t|�ks.|	t|�kr>|jd�q�||||	krb|jd�q�|jd�n?||kr�|jd�n#|
r�|jd�n
|jd�|j|
�q�WWdQRXdS)z]Annotate a single file.

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

        Z_pyN�z.pyz,cover�w�encoding�utf8rT�start�z  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)�__name__�
__module__�__qualname__�__doc__r�re�compiler'r*rrr
r
)rrrsr)r4r!rr5Zcoverage.filesrZ
coverage.miscrZcoverage.reportrrr
r
r
r�<module>s