HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/cherrypy/lib/__pycache__/covercp.cpython-310.pyc
o

�N�g.-�@sLdZddlZddlZddlZddlZddlZddlZddlZej	�
ej	�e�d�Z
dZzddlmZee
d�Zdd�ZWneyTdZddlZe�d�d	d�ZYnwd
e_dZdZd
ZdZdZdZdZdZdd�Zdddefdd�Zdd�Zdd�Z efdd�Z!Gdd �d e"�Z#e
d!dfd"d#�Z$e%d$kr�e$e&ej'd%d���dSdS)&a�Code-coverage tools for CherryPy.

To use this module, or the coverage tools in the test suite,
you need to download 'coverage.py', either Gareth Rees' `original
implementation <http://www.garethrees.org/2001/12/04/python-coverage/>`_
or Ned Batchelder's `enhanced version:
<http://www.nedbatchelder.com/code/modules/coverage.html>`_

To turn on coverage tracing, use the following code::

    cherrypy.engine.subscribe('start', covercp.start)

DO NOT subscribe anything on the 'start_thread' channel, as previously
recommended. Calling start once in the main thread should be sufficient
to start coverage on all threads. Calling start again in each thread
effectively clears any coverage data gathered up to that point.

Run your code, then use the ``covercp.serve()`` function to browse the
results in a web browser. If you run this module from the command line,
it will call ``serve()`` for you.
�Nzcoverage.cache��coverage�Z	data_filecCst��dS�N)�the_coverage�start�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/cherrypy/lib/covercp.pyr(srzFNo code coverage will be performed; coverage.py could not be imported.cCsdSrrrrrr	r4s�a�<html>
<head>
    <title>CherryPy Coverage Menu</title>
    <style>
        body {font: 9pt Arial, serif;}
        #tree {
            font-size: 8pt;
            font-family: Andale Mono, monospace;
            white-space: pre;
            }
        #tree a:active, a:focus {
            background-color: black;
            padding: 1px;
            color: white;
            border: 0px solid #9999FF;
            -moz-outline-style: none;
            }
        .fail { color: red;}
        .pass { color: #888;}
        #pct { text-align: right;}
        h3 {
            font-size: small;
            font-weight: bold;
            font-style: italic;
            margin-top: 5px;
            }
        input { border: 1px solid #ccc; padding: 2px; }
        .directory {
            color: #933;
            font-style: italic;
            font-weight: bold;
            font-size: 10pt;
            }
        .file {
            color: #400;
            }
        a { text-decoration: none; }
        #crumbs {
            color: white;
            font-size: 8pt;
            font-family: Andale Mono, monospace;
            width: 100%;
            background-color: black;
            }
        #crumbs a {
            color: #f88;
            }
        #options {
            line-height: 2.3em;
            border: 1px solid black;
            background-color: #eee;
            padding: 4px;
            }
        #exclude {
            width: 100%;
            margin-bottom: 3px;
            border: 1px solid #999;
            }
        #submit {
            background-color: black;
            color: white;
            border: 0;
            margin-bottom: -9px;
            }
    </style>
</head>
<body>
<h2>CherryPy Coverage</h2>a
<div id="options">
<form action='menu' method=GET>
    <input type='hidden' name='base' value='%(base)s' />
    Show percentages
    <input type='checkbox' %(showpct)s name='showpct' value='checked' /><br />
    Hide files over
    <input type='text' id='pct' name='pct' value='%(pct)s' size='3' />%%<br />
    Exclude files matching<br />
    <input type='text' id='exclude' name='exclude'
     value='%(exclude)s' size='20' />
    <br />

    <input type='submit' value='Change view' id="submit"/>
</form>
</div>z�<html>
<head><title>CherryPy coverage data</title></head>
<frameset cols='250, 1*'>
    <frame src='menu?base=%s' />
    <frame name='main' src='' />
</frameset>
</html>
a�<html>
<head>
    <title>Coverage for %(name)s</title>
    <style>
        h2 { margin-bottom: .25em; }
        p { margin: .25em; }
        .covered { color: #000; background-color: #fff; }
        .notcovered { color: #fee; background-color: #500; }
        .excluded { color: #00f; background-color: #fff; }
         table .covered, table .notcovered, table .excluded
             { font-family: Andale Mono, monospace;
               font-size: 10pt; white-space: pre; }

         .lineno { background-color: #eee;}
         .notcovered .lineno { background-color: #000;}
         table { border-collapse: collapse;
    </style>
</head>
<body>
<h2>%(name)s</h2>
<p>%(fullpath)s</p>
<p>Coverage: %(pc)s%%</p>zP<tr class="covered">
    <td class="lineno">%s&nbsp;</td>
    <td>%s</td>
</tr>
zS<tr class="notcovered">
    <td class="lineno">%s&nbsp;</td>
    <td>%s</td>
</tr>
zQ<tr class="excluded">
    <td class="lineno">%s&nbsp;</td>
    <td>%s</td>
</tr>
z?%s%s<a class='file' href='report?name=%s' target='main'>%s</a>
cCs4t|�}|t|�}|dkrttd||��SdS)NrgY@)�len�int�round)�
statements�missing�s�errr	�_percent�s
rF�c
cs��dd�|��D�}|��|D]@}tj�||�}	|	���|�r=|	t|�d�}
d|
�tj	�Vd|	t
j�|�|fVt
||||	||||d�D]}|VqJq|���|�r�|t|�d�}
dd�|��D�}|��|D]V}tj�||�}	d}
|r�z|�|	�\}}}}}Wn	ty�Yn!wt||�}d|�d	d
�}
|t|�ks�|dkr�d|
}
nd
|
}
td|
�tj	�d|
|	|fVqodSdS)NcSsg|]\}}|r|�qSrr��.0�k�vrrr	�
<listcomp>��z _show_branch.<locals>.<listcomp>z| z;<a class='directory' href='menu?base=%s&exclude=%s'>%s</a>
rcSsg|]\}}|s|�qSrrrrrr	r�rrz%3d%% � z&nbsp;���z<span class='fail'>%s</span>z<span class='pass'>%s</span>�)�items�sort�os�path�join�lower�
startswithr�count�sep�urllib�parse�
quote_plus�_show_branch�	analysis2�	Exceptionr�replace�float�
TEMPLATE_ITEM)�root�baser �pct�showpct�excluder�dirs�name�newpath�relpath�chunk�filesZpc_str�_rr�pcrrr	r)�sR���
���


��r)cCs|r
tt�||��SdSr)�bool�re�search)r r3rrr	�
_skip_file�s�r?cCsr|}|}g}	tj�|�\}}|sn|�|�q|�|�|dkr&|�d�|��|D]
}|r6|�|i�}q,dS)NT�/)rr �split�append�reverse�
setdefault)r �tree�d�p�atoms�tail�noderrr	�_grafts$
�

��rKcCs<i}|j��}|D]}t||�stj�|�st||�q	|S)z-Return covered module names as a nested dict.)�dataZexecuted_filesr?rr �isdirrK)r0r3rrE�runsr rrr	�get_trees

�rOc@sNeZdZddd�Zejdd��Zej			dd
d��Zdd
�Zejdd��Z	dS)�
CoverStatsNcCs&||_|durtj�tj�}||_dSr)rrr �dirname�cherrypy�__file__r/)�selfrr/rrr	�__init__ s
zCoverStats.__init__cCst|j��Sr)�TEMPLATE_FRAMESETr/r")rTrrr	�index(szCoverStats.indexr@�50r� python\d\.\d|test|tut\d|tutorialc
	cs��|���tj�}tVtt�VdVd}|�tj�}|��|D]}||tj7}d|t	j
�|�|tjfVq#dVdVt|||j
�}|sNdVnt||d||dk||j
d	�D]}	|	Vq\dVd
VdS)Nz<div id='crumbs'>rz+<a href='menu?base=%s&exclude=%s'>%s</a> %sz</div>z<div id='tree'>z<p>No modules covered.</p>r@�checkedrz</body></html>)r"�rstriprr%�
TEMPLATE_MENU�
TEMPLATE_FORM�localsrA�popr&r'r(rOrr))
rTr0r1r2r3r rHZatomrEr8rrr	�menu,s2��

�
zCoverStats.menuc
cs��t|d�}g}t|���D]L\}}|d7}|�d�}d}	||vr$t}
n||vr+t}
n||vr2t}
n	d}	|�||f�|	rZ|D]\}}|
|t�	|�fVq?g}|
|t�	|�fVqdS)N�rrz

TF)
�open�	enumerate�	readlines�strip�TEMPLATE_LOC_EXCLUDED�TEMPLATE_LOC_NOT_COVERED�TEMPLATE_LOC_COVEREDrB�cgi�escape)
rT�filenamer�excludedr�source�buffer�lineno�lineZempty_the_buffer�template�lnoZpastlinerrr	�annotated_filePs,�

��zCoverStats.annotated_filec	csv�|j�|�\}}}}}t||�}tttj�|�||d�VdV|�||||�D]}|Vq*dVdVdVdS)N)r5�fullpathr;z<table>
z</table>z</body>z</html>)	rr*r�TEMPLATE_COVERAGE�dictrr �basenamers)	rTr5rkrrlrr:r;rprrr	�reportfs"��

�
�
zCoverStats.reportr)r@rXrrY)
�__name__�
__module__�__qualname__rUrRZexposerWr`rsrxrrrr	rPs

�#rPi�cCsZ|durtd��ddlm}||d�}|��tj�t|�ddd��t�t||��dS)Nz*The coverage module could not be imported.rrr�
�
production)zserver.socket_portzserver.thread_poolZenvironment)	�ImportErrorr�loadrRZconfig�updaterZ
quickstartrP)r �portr/rZcovrrr	�servews
�r��__main__r)(�__doc__r=�sysrirZos.path�urllib.parser&rRr r!rQrSZ	localFilerrrr~�warnings�warn�priorityr\r]rVrurhrgrfr.rr)r?rKrO�objectrPr�ry�tuple�argvrrrr	�<module>sX
��E	�
�3
Y�