Your IP : 216.73.216.213
B
���W� � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddlm Z m
Z
ddlmZ ddl
mZmZ ddlmZ ddlmZ ddlmZmZ dd lmZ dd
lmZmZ ddlmZmZmZ ddlmZm Z dd
l!m"Z" ddl#m$Z$m%Z%m&Z& ddl#m'Z'm(Z( ddl)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0 ddl1m2Z2m3Z3 ddl4m5Z5 ddl6m7Z7 e(e�Zyddl8Z8W n e9k
�r� dZ8Y nX G dd� de:�Z;dd� Z<dd� Z=dd� Z>dd � Z?dS )!z#Core control stuff for coverage.py.� N)�env�files)�AnnotateReporter)�string_class�iitems)� Collector)�CoverageConfig)�CoverageData�CoverageDataFiles)�DebugControl)�TreeMatcher�FnmatchMatcher)�PathAliases�find_python_files�
prep_patterns)�
ModuleMatcher�abs_file)�HtmlReporter)�CoverageException�bool_or_none�
join_regex)�file_be_gone�isolate_module)�patch_multiprocessing)�FileReporter)�Plugins)�PythonFileReporter)�Analysis�Numbers)�SummaryReporter)�XmlReporterc @ sD e Zd ZdZdNdd�Zdd� Zd d
� Zdd� Zd
d� Zdd� Z dd� Z
dd� Zdd� Zdd� Z
dd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� ZdOd*d+�ZdPd,d-�Zd.d/� Zd0d1� ZdQd2d3�Zd4d5� ZdRd6d7�Zd8d9� Zd:d;� Zd<d=� Zd>d?� Z d@dA� Z!dSdBdC�Z"dTdDdE�Z#dUdFdG�Z$dVdHdI�Z%dWdJdK�Z&dLdM� Z'dS )X�Coveragez�Programmatic access to coverage.py.
To use::
from coverage import Coverage
cov = Coverage()
cov.start()
#.. call your code ..
cov.stop()
cov.html_report(directory='covhtml')
NFTc
C s� t � | _|rbd}
|dkrd}|dk }|s,d}|| _| j�|�}
|
sb|rRtd| ��| jjddd� tj�d�}|rz|| j_tj�d �}|r�| jj �
|�d
�� | jj||||t
|�|| |
||d�
d| _|| _|| _d| _d| _d | _| _d | _| _d| _d| _g | _d | _ | _| _d| _d | _ | _| _ d| _!d | _"| _#d | _$| _%d| _&d| _ d| _'d| _(d| _)t*j+�s~t,� dS )
aL
`data_file` is the base name of the data file to use, defaulting to
".coverage". `data_suffix` is appended (with a dot) to `data_file` to
create the final file name. If `data_suffix` is simply True, then a
suffix is created with the machine and process identity included.
`cover_pylib` is a boolean determining whether Python code installed
with the Python interpreter is measured. This includes the Python
standard library and any packages installed with the interpreter.
If `auto_data` is true, then any existing data file will be read when
coverage measurement starts, and data will be saved automatically when
measurement stops.
If `timid` is true, then a slower and simpler trace function will be
used. This is important for some environments where manipulation of
tracing functions breaks the faster trace function.
If `branch` is true, then branch coverage will be measured in addition
to the usual statement coverage.
`config_file` determines what configuration file to read:
* If it is ".coveragerc", it is interpreted as if it were True,
for backward compatibility.
* If it is a string, it is the name of the file to read. If the
file can't be read, it is an error.
* If it is True, then a few standard files names are tried
(".coveragerc", "setup.cfg"). It is not an error for these files
to not be found.
* If it is False, then no configuration file is read.
`source` is a list of file paths or package names. Only code located
in the trees indicated by the file paths or package names will be
measured.
`include` and `omit` are lists of file name patterns. Files that match
`include` will be measured, files that match `omit` will not. Each
will also accept a single string argument.
`debug` is a list of strings indicating what debugging information is
desired.
`concurrency` is a string indicating the concurrency library being used
in the measured code. Without this, coverage.py will get incorrect
results if these libraries are in use. Valid strings are "greenlet",
"eventlet", "gevent", "multiprocessing", or "thread" (the default).
This can also be a list of these strings.
.. versionadded:: 4.0
The `concurrency` parameter.
.. versionadded:: 4.2
The `concurrency` parameter can now be a list of strings.
Fz.coveragercTz#Couldn't read '%s' as a config filez setup.cfgz coverage:)�section_prefixZ
COVERAGE_FILEZCOVERAGE_DEBUG�,)
� data_file�cover_pylib�timid�branch�parallel�source�omit�include�debug�concurrencyN)-r �config�config_file� from_filer �os�environ�getr$ r, �extend�split� from_argsr �_debug_file�
_auto_data�_data_suffix�source_match�source_pkgs_match�pylib_match�cover_match�
include_match�
omit_match�
_warn_no_data�_warn_unimported_source� _warningsr* r+ r) �source_pkgs�data�
data_files� collector�plugins�
pylib_dirs�
cover_dirs�data_suffix�
run_suffix�_exclude_re�_inited�_started� _measuredr ZMETACOV� _prevent_sub_process_measurement)�selfr$ rJ r% � auto_datar&