Repository URL to install this package:
|
Version:
1.0.11 ▾
|
wlanpi-profiler
/
opt
/
wlanpi-profiler
/
lib
/
python3.7
/
site-packages
/
coverage
/
__pycache__
/
sqldata.cpython-37.pyc
|
|---|
B
ü¡?ã6oÁã @ s d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl
Z
ddlZddlZddl
Z
ddlmZmZmZ ddlmZmZ ddlmZ ddlmZmZmZ ddlmZmZmZ ddlm Z eeZd Z!d
Z"G dd deZ#d
d Z$G dd deZ%dd Z&dS )zSqlite coverage data.é N)ÚNoDebuggingÚSimpleReprMixinÚclipped_repr)ÚCoverageExceptionÚ DataError)ÚPathAliases)ÚcontractÚfile_be_goneÚisolate_module)Únumbits_to_numsÚ
numbits_unionÚnums_to_numbits)Ú__version__é aË CREATE TABLE coverage_schema (
-- One row, to record the version of the schema in this db.
version integer
);
CREATE TABLE meta (
-- Key-value pairs, to record metadata about the data
key text,
value text,
unique (key)
-- Keys:
-- 'has_arcs' boolean -- Is this data recording branches?
-- 'sys_argv' text -- The coverage command line that recorded the data.
-- 'version' text -- The version of coverage.py that made the file.
-- 'when' text -- Datetime when the file was created.
);
CREATE TABLE file (
-- A row per file measured.
id integer primary key,
path text,
unique (path)
);
CREATE TABLE context (
-- A row per context measured.
id integer primary key,
context text,
unique (context)
);
CREATE TABLE line_bits (
-- If recording lines, a row per context per file executed.
-- All of the line numbers for that file/context are in one numbits.
file_id integer, -- foreign key to `file`.
context_id integer, -- foreign key to `context`.
numbits blob, -- see the numbits functions in coverage.numbits
foreign key (file_id) references file (id),
foreign key (context_id) references context (id),
unique (file_id, context_id)
);
CREATE TABLE arc (
-- If recording branches, a row per context per from/to line transition executed.
file_id integer, -- foreign key to `file`.
context_id integer, -- foreign key to `context`.
fromno integer, -- line number jumped from.
tono integer, -- line number jumped to.
foreign key (file_id) references file (id),
foreign key (context_id) references context (id),
unique (file_id, context_id, fromno, tono)
);
CREATE TABLE tracer (
-- A row per file indicating the tracer used for that file.
file_id integer primary key,
tracer text,
foreign key (file_id) references file (id)
);
c @ sv e Zd ZdZdTddZdd Zdd Zd
d Zdd
Zdd Z dd Z
dd Zdd Ze
dddd Ze
dddd ZdUddZdd Zed!d" Zd#d$ Zd%d& Zd'd( Zed)d* Zed+d, ZdVd-d.Zed/d0 ZdWd2d3ZdXd4d5ZdYd6d7ZdZd8d9Zd:d; Zd<d= Zd>d? Z d@dA Z!dBdC Z"dDdE Z#dFdG Z$dHdI Z%dJdK Z&dLdM Z'dNdO Z(dPdQ Z)e*dRdS Z+dS )[ÚCoverageDataa% Manages collected coverage data, including file storage.
This class is the public supported API to the data that coverage.py
collects during program execution. It includes information about what code
was executed. It does not include information from the analysis phase, to
determine what lines could have been executed, or what lines were not
executed.
.. note::
The data file is currently a SQLite database file, with a
:ref:`documented schema <dbschema>`. The schema is subject to change
though, so be careful about querying it directly. Use this API if you
can to isolate yourself from changes.
There are a number of kinds of data that can be collected:
* **lines**: the line numbers of source lines that were executed.
These are always available.
* **arcs**: pairs of source and destination line numbers for transitions
between source lines. These are only available if branch coverage was
used.
* **file tracer names**: the module names of the file tracer plugins that
handled each file in the data.
Lines, arcs, and file tracer names are stored for each source file. File
names in this API are case-sensitive, even on platforms with
case-insensitive file systems.
A data file either stores lines, or arcs, but not both.
A data file is associated with the data when the :class:`CoverageData`
is created, using the parameters `basename`, `suffix`, and `no_disk`. The
base name can be queried with :meth:`base_filename`, and the actual file
name being used is available from :meth:`data_filename`.
To read an existing coverage.py data file, use :meth:`read`. You can then
access the line, arc, or file tracer data with :meth:`lines`, :meth:`arcs`,
or :meth:`file_tracer`.
The :meth:`has_arcs` method indicates whether arc data is available. You
can get a set of the files in the data with :meth:`measured_files`. As
with most Python containers, you can determine if there is any data at all
by using this object as a boolean value.
The contexts for each line in a file can be read with
:meth:`contexts_by_lineno`.
To limit querying to certain contexts, use :meth:`set_query_context` or
:meth:`set_query_contexts`. These will narrow the focus of subsequent
:meth:`lines`, :meth:`arcs`, and :meth:`contexts_by_lineno` calls. The set
of all measured context names can be retrieved with
:meth:`measured_contexts`.
Most data files will be created by coverage.py itself, but you can use
methods here to create data files if you like. The :meth:`add_lines`,
:meth:`add_arcs`, and :meth:`add_file_tracers` methods add data, in ways
that are convenient for coverage.py.
To record data for contexts, use :meth:`set_context` to set a context to
be used for subsequent :meth:`add_lines` and :meth:`add_arcs` calls.
To add a source file without any measured data, use :meth:`touch_file`,
or :meth:`touch_files` for a list of such files.
Write the data to its file with :meth:`write`.
You can clear the data in memory with :meth:`erase`. Two data collections
can be combined by using :meth:`update` on one :class:`CoverageData`,
passing it the other.
Data in a :class:`CoverageData` can be serialized and deserialized with
:meth:`dumps` and :meth:`loads`.
The methods used during the coverage.py collection phase
(:meth:`add_lines`, :meth:`add_arcs`, :meth:`set_context`, and
:meth:`add_file_tracers`) are thread-safe. Other methods may not be.
NFc C s || _ tj |pd¡| _|| _|| _|p,t | _| ¡ i | _
i | _t ¡ | _
t ¡ | _d| _d| _d| _d| _d| _d| _dS )a Create a :class:`CoverageData` object to hold coverage-measured data.
Arguments:
basename (str): the base name of the data file, defaulting to
".coverage". This can be a path to a file in another directory.
suffix (str or bool): has the same meaning as the `data_suffix`
argument to :class:`coverage.Coverage`.
no_disk (bool): if True, keep all data in memory, and don't
write any disk file.
warn: a warning callback function, accepting a warning message
argument.
debug: a `DebugControl` object (optional)
z .coverageFN)Ú_no_diskÚosÚpathÚabspathÚ _basenameÚ_suffixÚ_warnr Ú_debugÚ_choose_filenameÚ _file_mapÚ_dbsÚgetpidÚ_pidÚ threadingÚLockÚ_lockÚ
_have_usedÚ
_has_linesÚ _has_arcsÚ_current_contextÚ_current_context_idÚ_query_context_ids)ÚselfÚbasenameÚsuffixZno_diskÚwarnÚdebug© r, ú/build/wlanpi-profiler-7IIg1Q/wlanpi-profiler-1.0.11/debian/wlanpi-profiler/opt/wlanpi-profiler/lib/python3.7/site-packages/coverage/sqldata.pyÚ__init__¿ s
zCoverageData.__init__c s t ¡ fdd}|S )z4A decorator for methods that should hold self._lock.c s" | j | f||S Q R X d S )N)r )r' ÚargsÚkwargs)Úmethodr, r- Ú_wrappedè s z&CoverageData._locked.<locals>._wrapped)Ú functoolsÚwraps)r1 r2 r, )r1 r- Ú_lockedæ s zCoverageData._lockedc C s: | j rd| _n(| j| _t| j}|r6| jd| 7 _dS )z.Set self._filename based on inited attributes.z:memory:Ú.N)r Ú _filenamer Úfilename_suffixr )r' r) r, r, r- r ï s
zCoverageData._choose_filenamec C s>