Your IP : 216.73.216.196
B
;��Yh � @ s� d Z ddlZddlZddlZddlmZmZ ddlmZ ddl m
Z
ddlmZm
Z
ddlmZmZ d d
� ZG dd� de�Zed
d�ZG dd� de�Zedd�ZdS )z)Configuration file parsing and utilities.� N)�Set�
namedtuple)�compile)�RawConfigParser� )�__version__�log)�
ErrorRegistry�conventionsc s � fdd�}|S )z4Check that the configuration object was initialized.c s, | j d ks| jd krtd��� | f|�|�S )Nz$using an uninitialized configuration)�
_arguments�_options�RuntimeError)�self�args�kwargs)�method� �B/opt/alt/python37/lib/python3.7/site-packages/pydocstyle/config.py�
_decorator s z%check_initialized.<locals>._decoratorr )r r r )r r �check_initialized s r c @ s* e Zd ZdZdZdZdZdZdZe j
ZdZdZ
d d
� Zdd� Zd
d� Zedd� �Zedd� �Zdd� Zdd� Zedd� �Zdd� Zdd� Zd9dd�Zed d!� �Zed:d#d$��Zed%d&� �Zed'd(� �Zed)d*� �Z ed+d,� �Z!ed-d.� �Z"ed/d0� �Z#ed1d2� �Z$ed3d4� �Z%ed5d6� �Z&ed7d8� �Z'dS );�ConfigurationParsera Responsible for parsing configuration from files and CLI.
There are 2 types of configurations: Run configurations and Check
configurations.
Run Configurations:
------------------
Responsible for deciding things that are related to the user interface and
configuration discovery, e.g. verbosity, debug options, etc.
All run configurations default to `False` or `None` and are decided only
by CLI.
Check Configurations:
--------------------
Configurations that are related to which files and errors will be checked.
These are configurable in 2 ways: using the CLI, and using configuration
files.
Configuration files are nested within the file system, meaning that the
closer a configuration file is to a checked file, the more relevant it will
be. For instance, imagine this directory structure:
A
+-- tox.ini: sets `select=D100`
+-- B
+-- foo.py
+-- tox.ini: sets `add-ignore=D100`
Then `foo.py` will not be checked for `D100`.
The configuration build algorithm is described in `self._get_config`.
Note: If any of `BASE_ERROR_SELECTION_OPTIONS` was selected in the CLI, all
configuration files will be ignored and each file will be checked for
the error codes supplied in the CLI.
)�
convention�select�ignorez
add-selectz
add-ignore�matchz match-dirzignore-decorators)r r r z(?!test_).*\.pyz[^\.].*� )z setup.cfgztox.iniz.pydocstylez.pydocstyle.iniz
.pydocstylercz.pydocstylerc.iniz.pep257)�
pydocstyle�pep257c C s, i | _ d| _d | _ | _| _| �� | _dS )zCreate a configuration parser.N)�_cache�_override_by_clir r � _run_conf�_create_option_parser�_parser)r r r r �__init__W s zConfigurationParser.__init__c C s | � g �\}}| �|�S )z;Return a `RunConfiguration` object set with default values.)�_parse_args�_create_run_config)r �options�_r r r �get_default_run_configuration` s z1ConfigurationParser.get_default_run_configurationc C sX | � � \| _| _| jpdg| _| �| j�s0t� �| �| j�| _| j| jdd�}|| _dS )z�Parse the configuration.
If one of `BASE_ERROR_SELECTION_OPTIONS` was selected, overrides all
error codes to check and disregards any error code related
configurations from the configuration files.
�.F)�use_defaultsN) r$ r r �_validate_options�IllegalConfigurationr% r �_create_check_configr )r �configr r r �parsee s zConfigurationParser.parsec C s | j S )z,Return the run configuration for the script.)r )r r r r �get_user_run_configurationx s z.ConfigurationParser.get_user_run_configurationc
# s dd� }dd� }x�| j D ]�}tj�|�r�x�t�|�D ]�\}}}| �tj�|��}||�\}� ||�} � fdd�|D �|dd�<