o
    à¡dZUe  ã                   @   sN  d Z ddlmZ ddlZddlZddlZddlZddlZddl	Z	ddl
mZ ddlmZ ddlmZmZ ddlmZmZ ddlmZmZmZ dd	lmZ G d
d„ deƒZG dd„ dejeƒZG dd„ deƒZG dd„ deƒZej ej!ej"gZ#edej$ej%ej&ej'ge# ddd�edej(ge# ddd�ede#ddd�ede#dd�ede#d d!d�ed"ej$ej)ej%ej&ej'ej*ej+ge# dd#d�ed$ej)ej%ej&ej'ej,ej+ge# dd%d�ed&ej(ej-ej.ej&ej/ej'ej0ej1ej2ej3g
e# d'd(d�ed)ej)ej%ej&ej'ej4ge# dd*d�d+œ	Z5d,\Z6Z7Z8G d-d.„ d.eƒZ9d/d0„ Z:d1d2„ Z;d3d4d5d6œZ<d9d7d8„Z=dS ):z%Command-line support for coverage.py.é    )Úprint_functionN)Úenv)ÚCTracer)Úinfo_formatterÚinfo_header)Úrun_python_fileÚrun_python_module)ÚBaseCoverageExceptionÚExceptionDuringRunÚNoSource)Úshould_fail_underc                
   @   s²  e Zd ZdZejddddd�Zejdddd	d�Zg d
¢Zejddddedd 	e¡ d�Z
ejdddddd�Zejdddddd�Zejddddddd�Zejdddd d�Zejd!d"dd#d�Zejdd$dd%d&d�Zejd'd(dd)d�Zejd*d+dd,d�Zejd-dd.d�Zejdd/dd%d0d�Zejd1ddd2d3d4d5�Zejd6d7dd8d�Zejd*d9dd:d�Zejdd;dd<d�Zejdd=dd>d?d�Zejdd@ddAd�ZejddBddCdDd�ZejddEddFd�ZdGS )HÚ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.)ÚthreadÚgeventÚgreenletÚeventletÚmultiprocessingz--concurrencyÚstoreÚLIBzHProperly measure code using a concurrency library. Valid values are: %s.z, )r   ÚmetavarÚchoicesr   z--debugÚOPTSz"Debug options, separated by commas)r   r   r   z-dz--directoryÚDIRzWrite the output files to DIR.z--fail-underÚMINÚfloatz?Exit with a status of 2 if the total coverage is less than MIN.)r   r   Útyper   z-hz--helpzGet 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-coveredzSkip files with 100% coverage.z--omitzhOmit files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.z-oÚoutfileÚOUTFILEz=Write the XML report to this file. Defaults to 'coverage.xml')r   Údestr   r   z-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--titleÚTITLEz.A text string to use as the title on the HTML.z	--versionz%Display version information and exit.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚoptparseÚmake_optionÚappendÚbranchÚCONCURRENCY_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© r@   r@   úB/var/www/html/env/lib/python3.10/site-packages/coverage/cmdline.pyr      sº    þþýýþþ
þþþüýþþüýýýþþýþ
þr   c                       sP   e Zd ZdZ‡ fdd„Zddd„ZG dd„ deƒZd‡ fd	d
„	Zdd„ Z	‡  Z
S )ÚCoverageOptionParserz|Base OptionParser for coverage.py.

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

    c                    s¸   t t| ƒj|ddi|¤Ž | jdi dd “dd “dd “dd “dd “dd “d	d “d
d “dd “dd “dd “dd “dd “dd “dd“dd “dd “dd “dd “dd “dd “Ž |  ¡  | j| _d S )NÚadd_help_optionFr   r*   r+   r.   r/   r0   r1   r   r2   r3   r:   r7   r9   r4   r;   Tr5   r6   r<   r=   r>   r?   r@   )ÚsuperrB   Ú__init__Úset_defaultsÚdisable_interspersed_argsÚ	help_noopÚhelp_fn)ÚselfÚargsÚkwargs©Ú	__class__r@   rA   rE   •   sh   
ÿÿÿ
ÿþýüûúùø	÷
öõôóòñðïîíìëzCoverageOptionParser.__init__Nc                 C   s   dS )zNo-op help function.Nr@   )rJ   ÚerrorÚtopicÚparserr@   r@   rA   rH   ´   s   zCoverageOptionParser.help_noopc                   @   s   e Zd ZdZdS )z&CoverageOptionParser.OptionParserErrorz;Used to stop the optparse error handler ending the process.N)r$   r%   r&   r'   r@   r@   r@   rA   ÚOptionParserError¸   s    rR   c                    s<   zt t| ƒ ||¡\}}W n | jy   Y dS w d||fS )zUCall optparse.parse_args, but return a triple:

        (ok, options, args)

        )FNNT)rD   rB   Ú
parse_argsrR   )rJ   rK   ÚoptionsrM   r@   rA   Úparse_args_ok¼   s   
ÿÿ
z"CoverageOptionParser.parse_args_okc                 C   s   |   |¡ | j‚)z7Override optparse.error so sys.exit doesn't get called.)rI   rR   )rJ   Úmsgr@   r@   rA   rO   É   s   
zCoverageOptionParser.error©NNN)NN)r$   r%   r&   r'   rE   rH   Ú	ExceptionrR   rU   rO   Ú__classcell__r@   r@   rM   rA   rB   �   s    
rB   c                       s    e Zd ZdZ‡ fdd„Z‡  ZS )ÚGlobalOptionParserz<Command-line parser for coverage.py global option arguments.c                    s$   t t| ƒ ¡  |  tjtjg¡ d S ©N)rD   rZ   rE   Úadd_optionsr   r   r?   )rJ   rM   r@   rA   rE   Ò   s
   
þzGlobalOptionParser.__init__)r$   r%   r&   r'   rE   rY   r@   r@   rM   rA   rZ   Ï   s    rZ   c                       s:   e Zd ZdZd	‡ fdd„	Zdd„ ZdZ‡ fdd„Z‡  ZS )
ÚCmdOptionParserz4Parse one of the new-style commands for coverage.py.Nc                    sL   |rd| }t t| ƒj||d� | jdd|i|pi ¤Ž |  |¡ || _dS )ao  Create 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   Nr@   )rD   r]   rE   rF   r\   Úcmd)rJ   r   rT   Údefaultsr_   r`   rM   r@   rA   rE   Þ   s   

þ

zCmdOptionParser.__init__c                 C   s   |d| j  kS )Nz<CmdOptionParser:%s>)ra   )rJ   Úotherr@   r@   rA   Ú__eq__ò   s   zCmdOptionParser.__eq__c                    s   t t| ƒ ¡ }dj|| jd�S )z>Override of an undocumented function in optparse.OptionParser.z{command} {subcommand})ÚcommandÚ
subcommand)rD   r]   Úget_prog_nameÚformatra   )rJ   Úprogram_namerM   r@   rA   rg   ù   s   zCmdOptionParser.get_prog_namerW   )	r$   r%   r&   r'   rE   rd   Ú__hash__rg   rY   r@   r@   rM   rA   r]   Û   s    r]   Úannotatez[options] [modules]z|Make annotated copies of the given files, marking statements that are executed with > and statements that are missed with !.r^   Ú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.)r`   r   z	[command]zDescribe 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.)	rk   rl   r/   rm   r   rn   ro   rp   rq   )r   é   é   c                   @   sH   e Zd ZdZ		ddd„Zdd„ Zddd„Zd	d
„ Zdd„ Zdd„ Z	dS )ÚCoverageScriptz*The command-line interface to coverage.py.Nc           	      C   sÂ   |r|| _ ndd l}|| _ |pt| _|pt| _|p| j| _|p"tjj| _	d| _
d | _tjd }| tjjd ¡r>tj |¡}tj |¡| _tjr]d}| j |¡r_| jd t|ƒ … | _d S d S d S )Nr   Fz__main__.pyz
-script.py)ÚcovpkgÚcoverager   r   r   rI   ÚosÚpathÚexistsÚpath_existsÚglobal_optionÚsysÚargvÚendswithÚsepÚdirnameÚbasenameri   r   ÚWINDOWSÚlen)	rJ   Ú_covpkgÚ_run_python_fileÚ_run_python_moduleÚ_help_fnÚ_path_existsrv   Úprogram_pathÚauto_suffixr@   r@   rA   rE   …  s(   


øzCoverageScript.__init__c                 C   s”  |s
| j dd� tS |d  d¡| _| jrtƒ }nt |d ¡}|s-|   d|d  ¡ tS |dd… }| j |_ | |¡\}}}|sCtS |  	|||¡rLtS dt
jd< t|jƒ}t|jƒ}t|jƒ}t|jƒ}	| jj|j|j|j|j|j||||	|jd	�
| _|jd
kr†|  |¡S |jdkr’| j ¡  tS |jdkr�|  ||¡S |jdkr½|jrª| j ¡  |p­d}
| jj |
dd� | j !¡  tS t"t#|ƒ|j$||d�}| j ¡  d}|jdkrã| jj%d|j&|j'dœ|¤Ž}n=|jdkrõ| jj(dd|j)i|¤Ž n+|jdk�r| jj*d|j)|j+|j'dœ|¤Ž}n|jdk�r |j,}| jj-dd|i|¤Ž}|du�rH|j.du�r3| j /d|j.¡ | j 0d¡}| j 0d¡}t1|||ƒ�rHt2S tS )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©rP   r   ú-zUnknown command: '%s'rr   Nr   )
Údata_suffixÚcover_pylibr=   r+   Úconfig_filer<   r7   r3   r/   r.   r/   rm   rp   rl   T)Ústrict)Úmorfsr2   r7   r3   ro   )r5   r6   rk   r0   rn   )r0   r>   r6   rq   r    zreport:fail_underzreport:precisionr@   )3rI   ÚOKÚ
startswithr{   rZ   ÚCMDSÚgetÚERRrU   Údo_helpr|   rx   Úunshell_listr<   r7   r3   r/   ru   ÚCoverager9   r4   r=   r+   r;   r.   rv   r   Údo_debugrm   Údo_runr*   Úloadrl   ÚsaveÚdictÚunglob_argsr2   ro   r5   r6   rk   r0   Úhtml_reportr>   r    Ú
xml_reportr1   Ú
set_optionÚ
get_optionr   Ú
FAIL_UNDER)rJ   r}   rQ   ÚokrT   rK   r<   r7   r3   r/   Ú	data_dirsÚreport_argsÚtotalr    r1   Ú	precisionr@   r@   rA   Úcommand_line¦  s®   	




ö







ü

þþ

ÿÿþþ
zCoverageScript.command_linec                 C   sÆ   |s|s|sJ ‚|rt |tjd� t d| jf tjd� dS |r*t | ¡  ¡ ƒ dS t| jjƒ}| j|d< t	dur>d|d< nd|d< t
 t |d¡¡ ¡ }|r[t |jd
i |¤Žƒ dS t d	| ƒ dS )z-Display an error message, or the named topic.)ÚfilezUse '%s help' for help.ri   Nzwith C extensionÚextension_modifierzwithout C extensionr   zDon't know topic %rr@   )Úprintr|   Ústderrri   Úformat_helpÚstriprŸ   ru   Ú__dict__r   ÚtextwrapÚdedentÚHELP_TOPICSr–   rh   )rJ   rO   rP   rQ   Úhelp_paramsÚhelp_msgr@   r@   rA   r     s   

zCoverageScript.helpc                 C   sš   |j r| jr| jdd� dS | j|d� dS |jdkr@|r8|D ]}t |¡}|r/| j|d� q| j|d� qdS | jdd� dS |jrK| jdd� dS dS )z`Deal with help requests.

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

        r   rŒ   )rQ   Tr?   F)r   r{   rI   r   r•   r–   r?   )rJ   rT   rK   rQ   Úar@   r@   rA   r˜   .  s(   ÿ

ÿzCoverageScript.do_helpc              	   C   sj  |s	|   d¡ tS |jr| j d¡r|   d¡ tS |jdkr3dD ]}t||ƒdur2|   d¡ t  S q | j d¡sA|jsA| j ¡  | j ¡  d}zHz|j	rV|  
|d	 |¡ n
|d	 }|  ||¡ W n
 tyk   d
}‚ w W | j ¡  |r�|jrŠ| j d¡}|  |¡rŠ| jj|gd� | j ¡  tS | j ¡  |r´|jr®| j d¡}|  |¡r®| jj|gd� | j ¡  w w )z!Implementation of 'coverage run'.zNothing to do.zrun:parallelz,Can't append to data files in parallel mode.r   )r+   r3   r7   r4   r<   r=   NzLOptions affecting multiprocessing must be specified in a configuration file.Tr   Fzrun:data_file)Ú
data_paths)rI   r—   r*   rv   r¤   r.   Úgetattrrm   Ústartr:   r   r   r   Ústoprz   rl   rž   r“   )rJ   rT   rK   Úopt_nameÚcode_ranÚfilenameÚ	data_filer@   r@   rA   rœ   O  s\   


ÿû

€þ€



ø
ûzCoverageScript.do_runc                 C   sh  |s	|   d¡ tS |D ]¦}|dkr*| j ¡ }ttdƒƒ t|ƒD ]}td| ƒ q q|dkrˆ| j ¡  | jj}ttdƒƒ td| jj	j
 ƒ |rƒtd| ¡  ƒ |jdd�}t| ¡ ƒ}td	t|ƒ ƒ |D ]}d
||| f }| |¡}	|	r}|d|	 7 }t|ƒ qfqtdƒ q|dkr§ttdƒƒ | jjj ¡ }
t|
ƒD ]}td| ƒ q�q|   d| ¡ t  S tS )z#Implementation of 'coverage debug'.z3What information would you like: config, data, sys?r|   z %sÚdatazpath: %szhas_arcs: %rT)Úfullpathz

%d files:z%s: %d linesz [%s]zNo data collectedÚconfigzDon't know what you mean by %r)rI   r—   rv   Úsys_infor®   r   r   r�   rÁ   Ú
data_filesr¿   Úhas_arcsÚline_countsÚsortedÚkeysrƒ   Úfile_tracerrÃ   r²   Úitemsr“   )rJ   rK   ÚinforÄ   ÚlinerÁ   ÚsummaryÚ	filenamesÚfÚpluginÚconfig_infor@   r@   rA   r›   ‚  sJ   

ÿ


û
ÿzCoverageScript.do_debug)NNNNNrW   )
r$   r%   r&   r'   rE   r«   r   r˜   rœ   r›   r@   r@   r@   rA   rt   ‚  s    
ÿ!
s!3rt   c                 C   s"   | sdS t jr|  d¡} |  d¡S )z)Turn a command-line argument into a list.Nú'ú,)r   r‚   r±   Úsplit)Úsr@   r@   rA   r™   ­  s
   

r™   c                 C   sH   t jr"g }| D ]}d|v sd|v r| t |¡¡ q| |¡ q|} | S )z5Interpret shell wildcards for platforms that need it.ú?Ú*)r   r‚   ÚextendÚglobr*   )rK   ÚglobbedÚargr@   r@   rA   r    »  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__}
    )r   r‹   r?   c              
   C   sØ   | du rt jdd… } z	tƒ  | ¡}W |S  ty/ } ztj|jŽ  t}W Y d}~|S d}~w t	yG } zt
|ƒ t}W Y d}~|S d}~w tyk } z|jrW|jd }n	d}W Y d}~|S W Y d}~|S d}~ww )z\The main entry point to coverage.py.

    This is installed as the script entry point.

    Nrr   r   )r|   r}   rt   r«   r
   Ú	tracebackÚprint_exceptionrK   r—   r	   r®   Ú
SystemExit)r}   ÚstatusÚerrr@   r@   rA   Úmainè  s0   ð€ö€ú
ý€úrâ   r[   )>r'   Ú
__future__r   rÚ   r(   Úos.pathrw   r|   r³   rÝ   rv   r   Úcoverage.collectorr   Úcoverage.debugr   r   Úcoverage.execfiler   r   Úcoverage.miscr	   r
   r   Úcoverage.resultsr   Úobjectr   ÚOptionParserrB   rZ   r]   r/   r   r;   ÚGLOBAL_ARGSr0   r2   r3   r7   r*   r1   r>   r6   r5   r+   r.   r:   r4   r9   r<   r=   r8   r•   r“   r—   r¥   rt   r™   r    rµ   râ   r@   r@   r@   rA   Ú<module>   s  vB'ýüûöÿþùüþýùø	óúùõöõñûúö—
x  -ç 