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

B

���W�1�@s�dZddlZddlZddlZddlZddlmZmZmZddl	m
Z
mZmZee�ZGdd�dej
�ZdgZdgZd	d
gZGdd�de�ZdS)
zConfig file for coverage.py�N)�configparser�iitems�string_class)�contract�CoverageException�isolate_modulec@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�HandyConfigParserz#Our specialization of ConfigParser.cCstj�|�||_dS)N)r�RawConfigParser�__init__�section_prefix)�selfr�r
�B/opt/alt/python37/lib64/python3.7/site-packages/coverage/config.pyr
szHandyConfigParser.__init__cCs(i}tjdkrd|d<tjj||f|�S)z-Read a file name as UTF-8 configuration data.)��zutf-8�encoding)�sys�version_inforr	�read)r�filename�kwargsr
r
rrs
zHandyConfigParser.readcCs|j|}tj�|||�S)N)rrr	�
has_option)r�section�optionr
r
rrs
zHandyConfigParser.has_optioncCs|j|}tj�||�S)N)rrr	�has_section)rrr
r
rr#s
zHandyConfigParser.has_sectioncCs|j|}tj�||�S)N)rrr	�options)rrr
r
rr's
zHandyConfigParser.optionscCs,i}x"|�|�D]}|�||�||<qW|S)z/Get the contents of a section, as a dictionary.)r�get)rr�d�optr
r
r�get_section+szHandyConfigParser.get_sectioncOs>|j|}tjj||f|�|�}dd�}d}t�|||�}|S)a Get a value, replacing environment variables also.

        The arguments are the same as `RawConfigParser.get`, but in the found
        value, ``$WORD`` or ``${WORD}`` are replaced by the value of the
        environment variable ``WORD``.

        Returns the finished value.

        cSs4tdd�|��D��}|dkr"dStj�|d�SdS)zCalled for each $replacement.css|]}|dk	r|VqdS)Nr
)�.0�wr
r
r�	<genexpr>Asz@HandyConfigParser.get.<locals>.dollar_replace.<locals>.<genexpr>�$�N)�next�groups�os�environr)�m�wordr
r
r�dollar_replace>sz-HandyConfigParser.get.<locals>.dollar_replacea$(?x)   # Use extended regex syntax
            \$(?:                   # A dollar sign, then
            (?P<v1>\w+) |           #   a plain word,
            {(?P<v2>\w+)} |         #   or a {-wrapped word,
            (?P<char>[$])           #   or a dollar sign.
            )
            )rrr	r�re�sub)rr�argsr�vr+Zdollar_patternr
r
rr2s

zHandyConfigParser.getcCsR|�||�}g}x<|�d�D].}x(|�d�D]}|��}|r,|�|�q,WqW|S)z�Read a list of strings.

        The value of `section` and `option` is treated as a comma- and newline-
        separated list of strings.  Each value is stripped of whitespace.

        Returns the list of strings.

        �
�,)r�split�strip�append)rrr�
value_list�valuesZ
value_line�valuer
r
r�getlistQs	zHandyConfigParser.getlistcCs�|�||�}g}xn|��D]b}|��}yt�|�Wn8tjk
rl}ztd||||f��Wdd}~XYnX|r|�|�qW|S)z�Read a list of full-line regexes.

        The value of `section` and `option` is treated as a newline-separated
        list of regexes.  Each value is stripped of whitespace.

        Returns the list of strings.

        zInvalid [%s].%s value %r: %sN)r�
splitlinesr3r,�compile�errorrr4)rrrZ	line_listr5r7�er
r
r�getregexlistcs	$zHandyConfigParser.getregexlistN)
�__name__�
__module__�__qualname__�__doc__r
rrrrrrr8r=r
r
r
rrsrz!(?i)#\s*pragma[:\s]?\s*no\s*coverz"(?i)#\s*pragma[:\s]?\s*no\s*branchzwhile (True|1|False|0):zif (True|1|False|0):c@s�eZdZdZdd�ZdddddgZd	d
�Zeed�d4d
d��Z	dddddddddddddddddd d!d"d#d$d%d&d'd(d)d*gZ
d5d+d,�Zd-d.�Zd/d0�Z
d1d2�Zd3S)6�CoverageConfigz�Coverage.py configuration.

    The attributes of this class are the various settings that control the
    operation of coverage.py.

    cCs�g|_g|_d|_d|_d|_d|_g|_d|_d|_g|_	d|_
d|_tdd�|_
d|_d|_d|_d|_tdd�|_tdd�|_d|_d|_d|_d|_d|_d|_d|_d|_i|_i|_dS)	z:Initialize the configuration attributes to their defaults.FNz	.coveragerZhtmlcovzCoverage reportzcoverage.xml�c) �attempted_config_files�config_files�branch�concurrency�cover_pylib�	data_file�debug�note�parallel�plugins�source�timid�DEFAULT_EXCLUDE�exclude_list�
fail_under�
ignore_errors�include�omit�DEFAULT_PARTIAL_ALWAYS�partial_always_list�DEFAULT_PARTIAL�partial_list�	precision�show_missing�skip_covered�	extra_css�html_dir�
html_title�
xml_output�xml_package_depth�paths�plugin_options)rr
r
rr
�s:zCoverageConfig.__init__rUrTrJrMrGcKsHxBt|�D]6\}}|dk	r
||jkr4t|t�r4|g}t|||�q
WdS)z!Read config values from `kwargs`.N)r�MUST_BE_LIST�
isinstancer�setattr)rr�kr/r
r
r�	from_args�s
zCoverageConfig.from_args)rr$c

Cs�|j�|�t|�}y|�|�}Wn4tjk
rV}ztd||f��Wdd}~XYnX|s`dS|j�|�y$x|j	D]}|j
|f|��qvWWn2tk
r�}ztd||f��Wdd}~XYnXt�
t�}x.|j	D]$}|d�d�\}}	||�|	�q�Wx`t|�D]T\}}
|�|��rx<t|�|��|
D]&}|�rB||}td|||f���q0W�qW|�d��r�x&|�d�D]}	|�d|	�|j|	<�qxWx,|jD]"}|�|��r�|�|�|j|<�q�WdS)	z�Read configuration from a .rc file.

        `filename` is a file name to read.

        Returns True or False, whether the file could be read.

        z Couldn't read config file %s: %sNF��:z0Unrecognized option '[%s] %s=' in config file %srbT)rDr4rrr�ErrorrrE�extend�CONFIG_FILE_OPTIONS�_set_attr_from_config_option�
ValueError�collections�defaultdict�setr2�addrrrr8rbrMrrc)
rrr�cpZ
files_read�err�option_specZall_optionsrrr�unknown�pluginr
r
r�	from_file�sB	""
zCoverageConfig.from_file)rFz
run:branch�boolean)rGzrun:concurrency�list)rHzrun:cover_pylibrz)rIz
run:data_file)rJz	run:debugr{)rTzrun:includer{)rKzrun:note)rUzrun:omitr{)rLzrun:parallelrz)rMzrun:pluginsr{)rNz
run:sourcer{)rOz	run:timidrz)rQzreport:exclude_lines�	regexlist)rRzreport:fail_under�int)rSzreport:ignore_errorsrz)rTzreport:includer{)rUzreport:omitr{)rWzreport:partial_branches_alwaysr|)rYzreport:partial_branchesr|)rZzreport:precisionr})r[zreport:show_missingrz)r\zreport:skip_coveredrz)�sortzreport:sort)r]zhtml:extra_css)r^zhtml:directory)r_z
html:title)r`z
xml:output)razxml:package_depthr}cCs>|�d�\}}|�||�r:t|d|�}t|||||��dS)z:Set an attribute on self if it exists in the ConfigParser.rjrN)r2r�getattrrf)rrt�attr�where�type_rr�methodr
r
rrn2sz+CoverageConfig._set_attr_from_config_optioncCs|j�|i�S)z:Get a dictionary of options for the plugin named `plugin`.)rcr)rrxr
r
r�get_plugin_options9sz!CoverageConfig.get_plugin_optionsc	Cs|x6|jD],}|dd�\}}||krt|||�dSqW|�d�\}}}|rl||jkrl||j�|i�|<dStd|��dS)aBSet an option in the configuration.

        `option_name` is a colon-separated string indicating the section and
        option name.  For example, the ``branch`` option in the ``[run]``
        section of the config file would be indicated with `"run:branch"`.

        `value` is the new value for the option.

        NrrjzNo such option: %r)rmrf�	partitionrMrc�
setdefaultr)	r�option_namer7rvr�r��plugin_name�_�keyr
r
r�
set_option=szCoverageConfig.set_optioncCstx0|jD]&}|dd�\}}||krt||�SqW|�d�\}}}|rd||jkrd|j�|i��|�Std|��dS)a<Get an option from the configuration.

        `option_name` is a colon-separated string indicating the section and
        option name.  For example, the ``branch`` option in the ``[run]``
        section of the config file would be indicated with `"run:branch"`.

        Returns the value of the option.

        NrrjzNo such option: %r)rmrr�rMrcrr)rr�rvr�r�r�r�r�r
r
r�
get_optionXszCoverageConfig.get_optionN)r$)r$)r>r?r@rAr
rdrhr�strryrmrnr�r�r�r
r
r
rrB�sL-A
rB)rArpr'r,rZcoverage.backwardrrrZ
coverage.miscrrrr	rrPrXrV�objectrBr
r
r
r�<module>sl