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

B

P}�Wyd�@s2dZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
mZddlmZmZmZddlmZmZGdd	�d	e�ZGd
d�deje�ZGdd
�d
e�ZGdd�de�ZejejejgZedej ej!ej"ej#geddd�edej$geddd�ededdd�ededd�ededdd�ed ej ej%ej!ej"ej#ej&gedd!d�ed"ej%ej!ej"ej#ej'ej(gedd#d�ed$ej$ej)ej*ej"ej+ej#ej,ej-ej.ej/g
ed%d&d�ed'ej%ej!ej"ej#ej0gedd(d�d)�	Z1d*\Z2Z3Z4Gd+d,�d,e�Z5d-d.�Z6d/d0�Z7d1d2d3d4�Z8d7d5d6�Z9dS)8z%Command-line support for coverage.py.�N)�env)�CTracer)�run_python_file�run_python_module)�CoverageException�ExceptionDuringRun�NoSource)�info_formatter�info_headerc
@s�eZdZdZejddddd�Zejdddd	d�Zd
ddd
dgZejddddedd�	e�d�Z
ejdddddd�Zejdddddd�Zejdddddd d!�Z
ejd"d#dd$d�Zejd%d&dd'd�Zejdd(dd)d*d�Zejd+d,dd-d�Zejd.d/dd0d�Zejd1dd2d�Zejdd3dd)d4d�Zejd5ddd6d7d8d9�Zejd:d;dd<d�Zejd.d=dd>d�Zejdd?dd@d�ZejddAddBdCd�ZejddDddEd�ZejddFddGdHd�ZejddIddJd�ZdKS)L�OptszBA namespace class for individual options we'll build parsers from.z-az--append�
store_truezGAppend coverage data to .coverage, otherwise it starts clean each time.)�action�help�z--branchz:Measure branch coverage in addition to statement coverage.�threadZgeventZgreenletZeventlet�multiprocessingz
--concurrency�storeZLIBzHProperly measure code using a concurrency library. Valid values are: %s.z, )r
�metavar�choicesrz--debugZOPTSz"Debug options, separated by commas)r
rrz-dz--directoryZDIRzWrite the output files to DIR.z--fail-underZMIN�intz?Exit with a status of 2 if the total coverage is less than MIN.)r
r�typerz-hz--helpzGet help on this command.z-iz--ignore-errorsz)Ignore errors while reading source files.z	--includez
PAT1,PAT2,...zpInclude only files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.z-Lz--pylibzWMeasure coverage even inside the Python installed library, which isn't done by default.z-mz--show-missingzEShow line numbers of statements in each module that weren't executed.z--skip-coveredzSkip files with 100% coverage.z--omitzhOmit files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.z-o�outfileZOUTFILEz=Write the XML report to this file. Defaults to 'coverage.xml')r
�destrrz-pz--parallel-modez�Append the machine name, process id and random number to the .coverage data file name to simplify collecting data from many processes.z--modulezb<pyfile> is an importable Python module, not a script path, to be run as 'python -m' would run it.z--rcfilez6Specify configuration file.  Defaults to '.coveragerc'z--sourcez
SRC1,SRC2,...z9A list of packages or directories of code to be measured.z--timidzYUse a simpler but slower trace method.  Try this if you get seemingly impossible results!z--titleZTITLEz.A text string to use as the title on the HTML.z	--versionz%Display version information and exit.N)�__name__�
__module__�__qualname__�__doc__�optparseZmake_option�append�branchZCONCURRENCY_CHOICES�join�concurrency�debug�	directory�
fail_underr�
ignore_errors�include�pylib�show_missing�skip_covered�omit�
output_xml�
parallel_mode�module�rcfile�source�timid�title�version�r3r3�C/opt/alt/python37/lib64/python3.7/site-packages/coverage/cmdline.pyrs�
rcsPeZdZdZ�fdd�Zd
dd�ZGdd�de�Zd�fd	d
�	Zdd�Z	�Z
S)�CoverageOptionParserz|Base OptionParser for coverage.py.

    Problems don't exit the program.
    Defaults are initialized for all options.

    csbtt|�j|ddi|��|jdddddddddddddddddddddd�|��|j|_dS)NZadd_help_optionFT)r
rrr!r"r#r$rr%r&r-r*r,r'r.r(r)r/r0r1r2)�superr5�__init__�set_defaultsZdisable_interspersed_args�	help_noop�help_fn)�self�args�kwargs)�	__class__r3r4r7�s4
zCoverageOptionParser.__init__NcCsdS)zNo-op help function.Nr3)r;�error�topic�parserr3r3r4r9�szCoverageOptionParser.help_noopc@seZdZdZdS)z&CoverageOptionParser.OptionParserErrorz;Used to stop the optparse error handler ending the process.N)rrrrr3r3r3r4�OptionParserError�srBcs<ytt|��||�\}}Wn|jk
r0dSXd||fS)zUCall optparse.parse_args, but return a triple:

        (ok, options, args)

        )FNNT)r6r5�
parse_argsrB)r;r<�options)r>r3r4�
parse_args_ok�s
z"CoverageOptionParser.parse_args_okcCs|�|�|j�dS)z7Override optparse.error so sys.exit doesn't get called.N)r:rB)r;�msgr3r3r4r?�s
zCoverageOptionParser.error)NNN)NN)rrrrr7r9�	ExceptionrBrEr?�
__classcell__r3r3)r>r4r5�s

r5cs eZdZdZ�fdd�Z�ZS)�GlobalOptionParserz<Command-line parser for coverage.py global option arguments.cs$tt|���|�tjtjg�dS)N)r6rIr7�add_optionsrrr2)r;)r>r3r4r7�szGlobalOptionParser.__init__)rrrrr7rHr3r3)r>r4rI�srIcs6eZdZdZd	�fdd�	Zdd�Z�fdd�Z�ZS)
�CmdOptionParserz4Parse one of the new-style commands for coverage.py.NcsL|rd|}tt|�j||d�|jfd|i|p2i��|�|�||_dS)aoCreate an OptionParser for a coverage.py command.

        `action` is the slug to put into `options.action`.
        `options` is a list of Option's for the command.
        `defaults` is a dict of default value for options.
        `usage` is the usage string to display in help.
        `description` is the description of the command, for the help text.

        z%prog )�usage�descriptionr
N)r6rKr7r8rJ�cmd)r;r
rD�defaultsrLrM)r>r3r4r7�s


zCmdOptionParser.__init__cCs|d|jkS)Nz<CmdOptionParser:%s>)rN)r;�otherr3r3r4�__eq__�szCmdOptionParser.__eq__cstt|���}d||jd�S)z>Override of an undocumented function in optparse.OptionParser.z%(command)s %(subcommand)s)�commandZ
subcommand)r6rK�
get_prog_namerN)r;�program_name)r>r3r4rS�szCmdOptionParser.get_prog_name)NNN)rrrrr7rQrSrHr3r3)r>r4rK�srK�annotatez[options] [modules]z|Make annotated copies of the given files, marking statements that are executed with > and statements that are missed with !.)rLrM�combinez%[options] <path1> <path2> ... <pathN>a?Combine data from multiple coverage files collected with 'run -p'.  The combined results are written to a single file representing the union of the data. The positional arguments are data files or directories containing data files. If no paths are provided, data files in the default data file's directory are combined.r"z<topic>z�Display information on the internals of coverage.py, for diagnosing problems. Topics are 'data' to show a summary of the collected data, or 'sys' to show installation information.�erasez)Erase previously collected coverage data.)rMrz	[command]zDescribe how to use coverage.py�htmlz�Create an HTML report of the coverage of the files.  Each file gets its own page, with the source decorated to show executed, excluded, and missed lines.�reportz&Report coverage statistics on modules.�runz$[options] <pyfile> [program options]z/Run a Python program, measuring code execution.�xmlz+Generate an XML report of coverage results.)	rUrVr"rWrrXrYrZr[)r��c@sDeZdZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�Z	dS)�CoverageScriptz*The command-line interface to coverage.py.NcCs�|r||_nddl}||_|p t|_|p*t|_|p6|j|_|pDtjj|_	d|_
d|_tj�tj
d�|_|jdkrxd|_tjr�d}|j�|�r�|jdt|��|_dS)NrFz__main__.py�coveragez
-script.py)�covpkgr_rrrr:�os�path�exists�path_exists�
global_option�basename�sys�argvrTr�WINDOWS�endswith�len)r;Z_covpkgZ_run_python_fileZ_run_python_moduleZ_help_fnZ_path_existsr_Zauto_suffixr3r3r4r7s"


zCoverageScript.__init__cCs�|s|jdd�tS|d�d�|_|jr2t�}n4t�|d�}|sZ|�d|d�tS|dd�}|j|_|�|�\}}}|s�tS|�	|||�r�tSdt
jd<t|j
�}t|j�}t|j�}t|j�}	|jj|j|j|j|j|j||||	|jd	�
|_|jd
k�r|�|�S|jdk�r(|j��tS|jdk�r@|�||�S|jd
k�r�|j�r^|j��|�pfd}
|j�|
�|j� �tSt!t"|�|j#||d�}|j��d}|jdk�r�|jj$f|j%|j&d�|��}nx|jdk�r�|jj'fd|j(i|��nR|jdk�r |jj)f|j(|j*d�|��}n(|jdk�rH|j+}
|jj,fd|
i|��}|dk	�r�|j-dk	�rn|j�.d|j-�|j�/d��r�d|k�r�dk�r�nnd}nt0|�}||j�/d�k�r�tSt1StS)z�The bulk of the command line interface to coverage.py.

        `argv` is the argument list to process.

        Returns 0 if all is well, 1 if something went wrong.

        �minimum_help)r@r�-zUnknown command: '%s'r\Nr)
Zdata_suffixZcover_pylibr0r�config_filer/r*r&r"r!r"rWrZrV)Zmorfsr%r*r&rY)r(r)rUr#rX)r#r1r[rzreport:fail_under�c�d)2r:�OK�
startswithrerI�CMDS�get�ERRrE�do_helprgrb�unshell_listr/r*r&r"r`r_r,r'r0rr.r!r
�do_debugrW�do_runr�loadrV�save�dict�unglob_argsr%rYr(r)rUr#Zhtml_reportr1rZ
xml_reportr$Z
set_option�
get_option�round�
FAIL_UNDER)r;rhrA�okrDr<r/r*r&r"Z	data_dirsZreport_args�totalrr3r3r4�command_line�s�	













zCoverageScript.command_linecCs�|s|s|st�|r.t|�td|jf�n~|rDt|�����nht|jj�}|j|d<tdk	rld|d<nd|d<t	�
t�|d����}|r�t|j
f|��ntd|�dS)	z-Display an error message, or the named topic.zUse '%s help' for help.rTNzwith C extensionZextension_modifierzwithout C extensionrzDon't know topic %r)�AssertionError�printrTZformat_help�stripr|r`�__dict__r�textwrap�dedent�HELP_TOPICSrt�format)r;r?r@rAZhelp_paramsZhelp_msgr3r3r4rs

zCoverageScript.helpcCs�|jr*|jr|jdd�n|j|d�dS|jdkr�|rpxB|D],}t�|�}|r^|j|d�q>|j|d�q>Wn|jdd�dS|jr�|jdd�dSdS)z`Deal with help requests.

        Return True if it handled the request, False if not.

        r)r@)rATr2F)rrer:r
rsrtr2)r;rDr<rA�ar3r3r4rv.s$


zCoverageScript.do_helpc	Cs2|s|�d�tS|jr2|j�d�r2|�d�tS|jdkrfx(dD] }t||�dk	rB|�d�tSqBW|j�d�s�|js�|j��|j��d}zPy0|j	r�|�
|d	|�n|d	}|�||�Wntk
r�d
}�YnXWd|j�
�|�r,|j�r"|j�d�}|�|��r"|jj|gd�|j��XtS)
z!Implementation of 'coverage run'.zNothing to do.zrun:parallelz,Can't append to data files in parallel mode.r)rr&r*r'r/r0NzLOptions affecting multiprocessing must be specified in a configuration file.TrFz
run:data_file)Z
data_paths)r:rurr_r~r!�getattrrW�startr-rrr�stoprdrVr{rq)r;rDr<�opt_nameZcode_ran�filenameZ	data_filer3r3r4ryOsB






zCoverageScript.do_runcCs�|s|�d�tS�xj|D�]`}|dkr^|j��}ttd��xt|�D]}td|�qHWq|dk�r$|j��|jj}ttd��td|jj	j
�|�rtd|���|jdd�}t
|���}td	t|��xJ|D]8}d
|||f}|�|�}	|	�r|d|	7}t|�q�Wntd�q|d
k�rjttd
��|jjj��}
x2t|
�D]}td|��qRWq|�d|�tSqWtS)z#Implementation of 'coverage debug'.z3What information would you like: config, data, sys?rgz %s�datazpath: %szhas_arcs: %rT)�fullpathz

%d files:z%s: %d linesz [%s]zNo data collected�configzDon't know what you mean by %r)r:rur_�sys_infor�r
r	rzr��
data_filesr�Zhas_arcsZline_counts�sorted�keysrkZfile_tracerr�r��itemsrq)r;r<�infor��liner��summary�	filenames�fZpluginZconfig_infor3r3r4rx�sD







zCoverageScript.do_debug)NNNNN)NNN)
rrrrr7r�rrvryrxr3r3r3r4r^|s
{
!3r^cCs"|sdStjr|�d�}|�d�S)z)Turn a command-line argument into a list.N�'�,)rrir��split)�sr3r3r4rw�s

rwcCsLtjrHg}x8|D]0}d|ks$d|kr6|�t�|��q|�|�qW|}|S)z5Interpret shell wildcards for platforms that need it.�?�*)rri�extend�globr)r<Zglobbed�argr3r3r4r}�s
r}aG        Coverage.py, version {__version__} {extension_modifier}
        Measure, collect, and report on code coverage in Python programs.

        usage: {program_name} <command> [options] [args]

        Commands:
            annotate    Annotate source files with execution information.
            combine     Combine a number of data files.
            erase       Erase previously collected coverage data.
            help        Get help on using coverage.py.
            html        Create an HTML report.
            report      Report coverage stats on modules.
            run         Run a Python program and measure code execution.
            xml         Create an XML report of coverage results.

        Use "{program_name} help <command>" for detailed help on any command.
        For full documentation, see {__url__}
    zK        Code coverage for Python.  Use '{program_name} help' for help.
    zg        Coverage.py, version {__version__} {extension_modifier}
        Documentation at {__url__}
    )rrlr2c
Cs�|dkrtjdd�}yt��|�}Wn�tk
rX}ztj|j�t}Wdd}~XYndt	k
r�}zt
|�t}Wdd}~XYn8tk
r�}z|jr�|jd}nd}Wdd}~XYnX|S)z\The main entry point to coverage.py.

    This is installed as the script entry point.

    Nr\r)rgrhr^r�r�	traceback�print_exceptionr<rurr��
SystemExit)rh�status�errr3r3r4�main�sr�)N):rr�r�os.pathrargr�r�r_rZcoverage.collectorrZcoverage.execfilerrZ
coverage.miscrrrZcoverage.debugr	r
�objectr�OptionParserr5rIrKr"rr.ZGLOBAL_ARGSr#r%r&r*rr$r1r(r)rr!r-r'r,r/r0r+rsrqrur�r^rwr}r�r�r3r3r3r4�<module>s�vB%	
3