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__/python.cpython-37.pyc

B

E�W��@s�dZddlZddlZddlZddlmZmZddlm	Z	m
Z
mZmZm
Z
mZddlmZddlmZmZddlmZee�Ze	dd	�d
d��Ze	dd	�d
d��Ze	dd	�dd��ZGdd�de�ZdS)z'Python source expertise for coverage.py�N)�env�files)�contract�CoverageException�	expensive�NoSource�
join_regex�isolate_module)�PythonParser)�source_token_lines�source_encoding)�FileReporter�bytes)�returnsc	Cs.t|d��}|���dd��dd�SQRXdS)zFRead the Python source text from `filename`.

    Returns bytes.

    �rbs
�
�
N)�open�read�replace)�filename�f�r�B/opt/alt/python37/lib64/python3.7/site-packages/coverage/python.py�read_python_sourcesr�unicodecCs�tj�|�\}}|dkr(tjr(ddg}n|g}xV|D]4}||}tj�|�rVt|�}Pt|�}|dk	r4Pq4Wd|f}|d7}t|��|�	dd�}|�
t|�d�}|r�|d	d
kr�|d
7}|S)z#Return the source code, as unicode.z.pyz.pywNzNo source for code: '%s'.
z*Aborting report output, consider using -i.�� r����
)�os�path�splitextrZWINDOWS�existsr�
get_zip_bytesrr�decoder)r�base�extZextsZtry_filename�source�exc_msgrrr�get_python_source s(


r*z
bytes|Nonec	Cs�dtjdtjg}x�|D]|}||kr|�|�}yt�|d|dd��}Wntjk
rfwYnXy|�|d�}Wntk
r�wYnX|SqWdS)z�Get data from `filename` if it is a zip file path.

    Returns the bytestring data read from the zip file, or None if no zip file
    could be found or `filename` isn't in it.  The data returned will be
    an empty string if the file is empty.

    z.zipz.eggrNr�)r �sep�split�	zipimport�zipimporter�ZipImportError�get_data�IOError)r�markers�marker�partsZzi�datarrrr$Es	

r$cs�eZdZdZd!�fdd�	Zedd�dd��Zed	d
��Zdd�Z	d
d�Z
dd�Zdd�Ze
dd��Ze
dd��Ze
dd��Zd"dd�Zedd�dd��Zdd�Zdd �Z�ZS)#�PythonFileReporterz!Report support for a Python file.Ncs�||_t|d�r|j}n t|tj�r4td�|���n|}t�	|�}|�
d�rZ|dd�}n|�
d�rt|dd�d}tt|��
t�|��t|d�r�|j}|�d	tj�d}t�	|�}n
t�|�}||_d|_d|_d|_d|_dS)
N�__file__zModule {0} has no file)z.pycz.pyorz	$py.classi����z.py�__name__�.)�coverage�hasattrr8�
isinstance�types�
ModuleTyper�formatrZunicode_filename�endswith�superr7�__init__Zcanonical_filenamer9rr r,�relative_filename�relname�_source�_parserZ_statementsZ	_excluded)�selfZmorfr;r�name)�	__class__rrrCas,





zPythonFileReporter.__init__r)rcCs|jS)N)rE)rHrrrrD�sz$PythonFileReporter.relative_filenamecCs2|jdkr,t|j|j�d�d�|_|j��|jS)z&Lazily create a :class:`PythonParser`.N�exclude)rrK)rGr
rr;Z_exclude_regexZparse_source)rHrrr�parser�s

zPythonFileReporter.parsercCs|jjS)z2Return the line numbers of statements in the file.)rLZ
statements)rHrrr�lines�szPythonFileReporter.linescCs|jjS)z2Return the line numbers of statements in the file.)rLZexcluded)rHrrr�excluded_lines�sz!PythonFileReporter.excluded_linescCs|j�|�S)N)rL�translate_lines)rHrMrrrrO�sz"PythonFileReporter.translate_linescCs|j�|�S)N)rL�translate_arcs)rH�arcsrrrrP�sz!PythonFileReporter.translate_arcscCs&|j�t|jjj�t|jjj��}|S)N)rLZlines_matchingrr;�configZpartial_listZpartial_always_list)rHZ	no_branchrrr�no_branch_lines�sz"PythonFileReporter.no_branch_linescCs
|j��S)N)rLrQ)rHrrrrQ�szPythonFileReporter.arcscCs
|j��S)N)rL�exit_counts)rHrrrrT�szPythonFileReporter.exit_countscCs|j�|||�S)N)rL�missing_arc_description)rH�start�endZ
executed_arcsrrrrU�sz*PythonFileReporter.missing_arc_descriptioncCs|jdkrt|j�|_|jS)N)rFr*r)rHrrrr(�s
zPythonFileReporter.sourcecCs,tj�|j�\}}|�d�r dS|s(dSdS)z�Does it seem like this file should contain Python?

        This is used to decide if a file reported as part of the execution of
        a program was really likely to have contained Python in the first
        place.

        z.pyTF)r r!r"r�
startswith)rH�_r'rrr�should_be_python�s	
z#PythonFileReporter.should_be_pythoncCst|���S)N)rr()rHrrrr�sz%PythonFileReporter.source_token_lines)N)N)r9�
__module__�__qualname__�__doc__rCrrD�propertyrLrMrNrOrPrrSrQrTrUr(rZr�
__classcell__rr)rJrr7^s#
r7)r]�os.pathr r>r.r;rrZ
coverage.miscrrrrrr	Zcoverage.parserr
Zcoverage.phystokensrrZcoverage.pluginr
rr*r$r7rrrr�<module>s %