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

B

E�W��@s�dZddlZddlZddlZddlmZmZddlmZm	Z	m
Z
ee�ZGdd�de�ZGdd�de�Z
Gd	d
�d
e�ZGdd�de	�ZGd
d�de
�ZdS)zSupport for plugins.�N)�CoverageException�isolate_module)�CoveragePlugin�
FileTracer�FileReporterc@sZeZdZdZdd�Zeddd��Zdd�Zd	d
�Zdd�Z	d
d�Z
e
Zdd�Zdd�Z
dS)�Pluginsz7The currently loaded collection of coverage.py plugins.cCs"g|_i|_g|_d|_d|_dS)N)�order�names�file_tracers�current_module�debug)�self�r�J/opt/alt/python37/lib64/python3.7/site-packages/coverage/plugin_support.py�__init__s
zPlugins.__init__Nc	Csl|�}||_xT|D]L}||_t|�tj|}t|dd�}|sJtd|��|�|�}|||�qWd|_|S)z`Load plugins from `modules`.

        Returns a list of loaded and configured plugins.

        �
coverage_initNz7Plugin module %r didn't define a coverage_init function)rr�
__import__�sys�modules�getattrrZget_plugin_options)	�clsr�configrZplugins�module�modr�optionsrrr�load_pluginss



zPlugins.load_pluginscCs|�||j�dS)z�Add a file tracer plugin.

        `plugin` is an instance of a third-party plugin class.  It must
        implement the :meth:`CoveragePlugin.file_tracer` method.

        N)�_add_pluginr
)r
�pluginrrr�add_file_tracer6szPlugins.add_file_tracercCs|�|d�dS)zfAdd a plugin that does nothing.

        This is only useful for testing the plugin support.

        N)r)r
rrrr�add_noop?szPlugins.add_noopcCs�d|j|jjf}|jrX|j�d�rX|j�d|j|f�td|jf|j�}t||�}||_d|_	|j
�|�||j|<|dk	r�|�|�dS)z�Add a plugin object.

        `plugin` is a :class:`CoveragePlugin` instance to add.  `specialized`
        is a list to append the plugin to.

        z%s.%srzLoaded plugin %r: %rz	plugin %rTN)
r�	__class__�__name__rZshould�write�
LabelledDebug�DebugPluginWrapperZ_coverage_plugin_nameZ_coverage_enabledr�appendr	)r
rZspecialized�plugin_nameZlabelledrrrrGs

zPlugins._add_plugincCs
t|j�S)N)�boolr)r
rrr�__nonzero__\szPlugins.__nonzero__cCs
t|j�S)N)�iterr)r
rrr�__iter__aszPlugins.__iter__cCs
|j|S)zReturn a plugin by name.)r	)r
r&rrr�getdszPlugins.get)N)r!�
__module__�__qualname__�__doc__r�classmethodrrrrr(�__bool__r*r+rrrrrs	rc@s2eZdZdZddd�Zdd�Zdd�Zd	d
�ZdS)
r#z?A Debug writer, but with labels for prepending to the messages.rcCst|�|g|_||_dS)N)�list�labelsr)r
�labelrZprev_labelsrrrrlszLabelledDebug.__init__cCst||j|j�S)z<Add a label to the writer, and return a new `LabelledDebug`.)r#rr2)r
r3rrr�	add_labelpszLabelledDebug.add_labelcCs$|jdg}d�dd�t|�D��S)z4The prefix to use on messages, combining the labels.�z:
css|]\}}d||VqdS)z  Nr)�.0�ir3rrr�	<genexpr>wsz/LabelledDebug.message_prefix.<locals>.<genexpr>)r2�join�	enumerate)r
�prefixesrrr�message_prefixtszLabelledDebug.message_prefixcCs|j�d|��|f�dS)z/Write `message`, but with the labels prepended.z%s%sN)rr"r<)r
�messagerrrr"yszLabelledDebug.writeN)r)r!r,r-r.rr4r<r"rrrrr#is

r#cs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
r$z:Wrap a plugin, and use debug to report on what it's doing.cstt|���||_||_dS)N)�superr$rrr)r
rr)r rrr�szDebugPluginWrapper.__init__cCsD|j�|�}|j�d||f�|r@|j�d|f�}t||�}|S)Nzfile_tracer(%r) --> %rzfile %r)r�file_tracerrr"r4�DebugFileTracerWrapper)r
�filename�tracerrrrrr?�s
zDebugPluginWrapper.file_tracercCsF|j�|�}|j�d||f�|rB|j�d|f�}t|||�}|S)Nzfile_reporter(%r) --> %rzfile %r)r�
file_reporterrr"r4�DebugFileReporterWrapper)r
rA�reporterrrrrrC�sz DebugPluginWrapper.file_reportercCs
|j��S)N)r�sys_info)r
rrrrF�szDebugPluginWrapper.sys_info)	r!r,r-r.rr?rCrF�
__classcell__rr)r rr$~s
r$c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)r@zA debugging `FileTracer`.cCs||_||_dS)N)rBr)r
rBrrrrr�szDebugFileTracerWrapper.__init__cCsdtj�|jj�|jfS)z7A short string identifying a frame, for debug messages.z%s@%d)�os�path�basename�f_code�co_filename�f_lineno)r
�framerrr�_show_frame�sz"DebugFileTracerWrapper._show_framecCs |j��}|j�d|f�|S)Nzsource_filename() --> %r)rB�source_filenamerr")r
Z	sfilenamerrrrP�s
z&DebugFileTracerWrapper.source_filenamecCs |j��}|j�d|f�|S)Nz$has_dynamic_source_filename() --> %r)rB�has_dynamic_source_filenamerr")r
ZhasrrrrQ�s
z2DebugFileTracerWrapper.has_dynamic_source_filenamecCs.|j�||�}|j�d||�|�|f�|S)Nz&dynamic_source_filename(%r, %s) --> %r)rB�dynamic_source_filenamerr"rO)r
rArNZdynrrrrR�sz.DebugFileTracerWrapper.dynamic_source_filenamecCs*|j�|�}|j�d|�|�|f�|S)Nzline_number_range(%s) --> %r)rB�line_number_rangerr"rO)r
rN�pairrrrrS�sz(DebugFileTracerWrapper.line_number_rangeN)
r!r,r-r.rrOrPrQrRrSrrrrr@�sr@cspeZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Z�ZS)rDzA debugging `FileReporter`.cs tt|��|�||_||_dS)N)r>rDrrEr)r
rArEr)r rrr�sz!DebugFileReporterWrapper.__init__cCs |j��}|j�d|f�|S)Nzrelative_filename() --> %r)rE�relative_filenamerr")r
�retrrrrU�s
z*DebugFileReporterWrapper.relative_filenamecCs |j��}|j�d|f�|S)Nzlines() --> %r)rE�linesrr")r
rVrrrrW�s
zDebugFileReporterWrapper.linescCs |j��}|j�d|f�|S)Nzexcluded_lines() --> %r)rE�excluded_linesrr")r
rVrrrrX�s
z'DebugFileReporterWrapper.excluded_linescCs$|j�|�}|j�d||f�|S)Nztranslate_lines(%r) --> %r)rE�translate_linesrr")r
rWrVrrrrY�sz(DebugFileReporterWrapper.translate_linescCs$|j�|�}|j�d||f�|S)Nztranslate_arcs(%r) --> %r)rE�translate_arcsrr")r
�arcsrVrrrrZ�sz'DebugFileReporterWrapper.translate_arcscCs |j��}|j�d|f�|S)Nzno_branch_lines() --> %r)rE�no_branch_linesrr")r
rVrrrr\�s
z(DebugFileReporterWrapper.no_branch_linescCs |j��}|j�d|f�|S)Nzexit_counts() --> %r)rE�exit_countsrr")r
rVrrrr]�s
z$DebugFileReporterWrapper.exit_countscCs |j��}|j�d|f�|S)Nz
arcs() --> %r)rEr[rr")r
rVrrrr[�s
zDebugFileReporterWrapper.arcscCs$|j��}|j�dt|�f�|S)Nzsource() --> %d chars)rE�sourcerr"�len)r
rVrrrr^�s
zDebugFileReporterWrapper.sourcecCs(t|j���}|j�dt|�f�|S)Nz"source_token_lines() --> %d tokens)r1rE�source_token_linesrr"r_)r
rVrrrr`�sz+DebugFileReporterWrapper.source_token_lines)r!r,r-r.rrUrWrXrYrZr\r]r[r^r`rGrr)r rrD�srD)r.rH�os.pathrZ
coverage.miscrrZcoverage.pluginrrr�objectrr#r$r@rDrrrr�<module>sY%