403Webshell
Server IP : 127.0.0.1  /  Your IP : 216.73.216.109
Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64
User : SERVERWEB ( 0)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  C:/cygwin64/lib/python3.9/site-packages/_pytest/config/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.9/site-packages/_pytest/config/__pycache__/argparsing.cpython-39.pyc
a

05d�R�@s�ddlZddlZddlZddlZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
ddlmZddlmZdd
lmZddlmZddlZddlmZddlmZddlmZddlmZddlmZddlmZe�rddlmZdZeGdd�d��Z Gdd�de!�Z"Gdd�d�Z#Gdd�d�Z$Gdd �d ej%�Z&Gd!d"�d"ej'�Z(dS)#�N)�gettext)�Any)�Callable)�cast)�Dict)�List)�Mapping)�NoReturn)�Optional)�Sequence)�Tuple)�
TYPE_CHECKING)�Union)�final)�
UsageError)�ARGUMENT_PERCENT_DEFAULT)�ARGUMENT_TYPE_STR)�ARGUMENT_TYPE_STR_CHOICE)�check_ispytest)�LiteralZfile_or_dirc@sheZdZUdZdZeeed<d(dd�eeeedgdfe	dd�dd	�Z
ddd
�dd�Zd)eeeedd�dd�Zee
dd�dd�Zd*eeedfeejejd�dd�Zdd�dd�Zd+eeedfejeejeed�dd�Zd,eeedfeejejd�d d!�Zd-eeedfeejeejeefd�d"d#�Zd.eeed$e
dd%�d&d'�ZdS)/�Parserz�Parser for command line arguments and ini-file values.

    :ivar extra_info: Dict of generic param -> value to display in case
        there's an error processing the command line arguments.
    N�progF��	_ispytest�Argument)�usage�
processoptr�returncCs@t|�td|dd�|_g|_||_||_i|_g|_i|_dS)NzCustom optionsT��parserr)	r�OptionGroup�
_anonymous�_groups�_processopt�_usage�_inidict�	_ininames�
extra_info)�selfrrr�r)�=/usr/lib/python3.9/site-packages/_pytest/config/argparsing.py�__init__+szParser.__init__)�optionrcCs|jr|jr|�|�dS�N)r#�dest)r(r,r)r)r*�
processoption;szParser.processoption�r )�name�description�afterrcCsj|jD]}|j|kr|Sqt|||dd�}d}t|j�D]\}}|j|kr<qTq<|j�|d|�|S)aGet (or create) a named option Group.

        :param name: Name of the option group.
        :param description: Long description for --help output.
        :param after: Name of another group, used for ordering --help output.
        :returns: The option group.

        The returned group object has an ``addoption`` method with the same
        signature as :func:`parser.addoption <pytest.Parser.addoption>` but
        will be shown in the respective group in the output of
        ``pytest --help``.
        Trr�)r"r1r �	enumerate�insert)r(r1r2r3�group�i�grpr)r)r*�getgroup@s



zParser.getgroup��opts�attrsrcOs|jj|i|��dS)a!Register a command line option.

        :param opts:
            Option names, can be short or long options.
        :param attrs:
            Same attributes as the argparse library's :py:func:`add_argument()
            <argparse.ArgumentParser.add_argument>` function accepts.

        After command line parsing, options are available on the pytest config
        object via ``config.option.NAME`` where ``NAME`` is usually set
        by passing a ``dest`` attribute, for example
        ``addoption("--long", dest="NAME", ...)``.
        N)r!�	addoption)r(r<r=r)r)r*r>ZszParser.addoptionzos.PathLike[str]��args�	namespacercCs>ddlm}|��|_||j�dd�|D�}|jj||d�S)Nr)�try_argcompletecSsg|]}t�|��qSr)��os�fspath��.0�xr)r)r*�
<listcomp>s�z Parser.parse.<locals>.<listcomp>�rA)�_pytest._argcompleterB�
_getparser�	optparser�
parse_args)r(r@rArB�strargsr)r)r*�parsejs


zParser.parse�MyOptionParser�rcCs�ddlm}t||j|jd�}|j|jg}|D]L}|jr0|jpD|j	}|�
|�}|jD]$}|��}|��}	|j
|i|	��qVq0|j
tdd�}
||
_|S)Nr)�filescompleter)r�*)�nargs)rLrTrRr'rr"r!�optionsr2r1�add_argument_group�namesr=�add_argument�FILE_OR_DIRZ	completer)r(rTrN�groupsr7ZdescZarggroupr,�n�aZfile_or_dir_argr)r)r*rMvs

zParser._getparser)r@r,rArcCsB|j||d�}|j��D]\}}t|||�qtttt|t��S)NrK)	rQ�__dict__�items�setattrrr�str�getattrr[)r(r@r,rAZparsedoptionr1�valuer)r)r*�parse_setoption�szParser.parse_setoptioncCs|j||d�dS)zbParse the known arguments at this point.

        :returns: An argparse namespace object.
        rKr)�parse_known_and_unknown_args)r(r@rAr)r)r*�parse_known_args�s	zParser.parse_known_argscCs$|��}dd�|D�}|j||d�S)aParse the known arguments at this point, and also return the
        remaining unknown arguments.

        :returns:
            A tuple containing an argparse namespace object for the known
            arguments, and a list of the unknown arguments.
        cSsg|]}t�|��qSr)rCrFr)r)r*rI�rJz7Parser.parse_known_and_unknown_args.<locals>.<listcomp>rK)rMrg)r(r@rArNrPr)r)r*rf�sz#Parser.parse_known_and_unknown_argszBLiteral['string', 'paths', 'pathlist', 'args', 'linelist', 'bool'])r1�help�type�defaultrcCs,|dvsJ�|||f|j|<|j�|�dS)a�Register an ini-file option.

        :param name:
            Name of the ini-variable.
        :param type:
            Type of the variable. Can be:

                * ``string``: a string
                * ``bool``: a boolean
                * ``args``: a list of strings, separated as in a shell
                * ``linelist``: a list of strings, separated by line breaks
                * ``paths``: a list of :class:`pathlib.Path`, separated as in a shell
                * ``pathlist``: a list of ``py.path``, separated as in a shell

            .. versionadded:: 7.0
                The ``paths`` variable type.

            Defaults to ``string`` if ``None`` or not passed.
        :param default:
            Default value if no ini-file option exists but is queried.

        The value of ini-variables can be retrieved via a call to
        :py:func:`config.getini(name) <pytest.Config.getini>`.
        )N�string�pathsZpathlistr@Zlinelist�boolN)r%r&�append)r(r1rhrirjr)r)r*�addini�s!z
Parser.addini)NN)r0N)N)N)N)N)NN)�__name__�
__module__�__qualname__�__doc__rr
rb�__annotations__rrmr+r/r:rr>rr�argparse�	NamespacerQrMrrergrrfror)r)r)r*r!sp
����
������������rc@s8eZdZdZeedefdd�dd�Zed�dd	�ZdS)
�
ArgumentErrorzURaised if an Argument instance is created with invalid or
    inconsistent arguments.rN)�msgr,rcCs||_t|�|_dSr-)rxrb�	option_id)r(rxr,r)r)r*r+�szArgumentError.__init__rScCs$|jrd|j�d|j��S|jSdS)Nzoption �: )ryrx�r(r)r)r*�__str__�szArgumentError.__str__)rprqrrrsrbrr+r|r)r)r)r*rw�srwc@szeZdZdZeeeed�Zee	dd�dd�Z
eed�dd	�Ze
ee	fd�d
d�Zeedd�d
d�Zed�dd�ZdS)rz�Class that mimics the necessary behaviour of optparse.Option.

    It's currently a least effort implementation and ignoring choices
    and integer prefixes.

    https://docs.python.org/3/library/optparse.html#optparse-standard-option-types
    )�intrk�float�complexN)rYr=rc
Os�||_g|_g|_d|�d�p dvr2tjtdd�z|d}WntyPYnz0t|t	�r�|dkr�tjt
j||d�d	d�t|d
d�|d<n&tjt
j||d�d	d�tj||d<|d|_n||_z|d|_Wnty�Yn0|�|�|�d
�}|�r||_nx|j�r4|jddd��dd�|_nRz|jddd�|_Wn8t�y�}zd|_td|�|�WYd}~n
d}~00dS)z5Store params in private vars for use in add_argument.�%defaultrhr0�)�
stacklevelri�choice)�typrY��choicesrrjr.�N�-�_r4z???zneed a long or short option)�_attrs�_short_opts�
_long_opts�get�warnings�warnr�KeyError�
isinstancerbr�formatrirr�_typ_maprj�_set_opt_stringsr.�replace�
IndexErrorrw)r(rYr=r�r.�er)r)r*r+�sJ
��

zArgument.__init__rScCs|j|jSr-)r�r�r{r)r)r*rY szArgument.namesc	Csxd��}|�|j�|D],}zt||�|j|<WqtyBYq0q|j�d�rr|jd}|�dd�}||jd<|jS)Nzdefault dest helprhr�z%(default)s)�splitrnr.rcr��AttributeErrorr�r�)r(r=�attrr^r)r)r*r=#s

zArgument.attrs)r<rcCs�|D]�}t|�dkr$td||��qt|�dkrd|ddkrH|ddksVtd||��|j�|�q|dd�dkr�|ddks�td||��|j�|�qd	S)
zhDirectly from optparse.

        Might not be necessary as this is passed to argparse later on.
        r�z>invalid option string %r: must be at least two characters longrr�r4zMinvalid short option string %r: must be of the form -x, (x any non-dash char)�--zGinvalid long option string %r: must start with --, followed by non-dashN)�lenrwr�rnr�)r(r<�optr)r)r*r�3s2������zArgument._set_opt_stringscCs�g}|jr|dt|j�g7}|jr8|dt|j�g7}|dt|j�g7}t|d�rj|dt|j�g7}t|d�r�|dt|j�g7}d�d	�|��S)
Nz
_short_opts: z_long_opts: zdest: riztype: rjz	default: zArgument({})�, )	r��reprr�r.�hasattrrirjr��join)r(r@r)r)r*�__repr__Ps

zArgument.__repr__)rprqrrrsr}rbr~rr�rr+rrYrr=rr�r�r)r)r)r*r�s1rc@sjeZdZdZddd�eeeeedd�dd�Zee	dd	�d
d�Z
ee	dd	�dd
�Zddedd�dd�ZdS)r z,A group of options shown in its own section.r0NFr)r1r2rrrcCs$t|�||_||_g|_||_dSr-)rr1r2rWr)r(r1r2rrr)r)r*r+as
zOptionGroup.__init__r;cOsJt|��dd�|jD��}|r*td|��t|i|��}|j|dd�dS)aMAdd an option to this group.

        If a shortened version of a long option is specified, it will
        be suppressed in the help. ``addoption('--twowords', '--two-words')``
        results in help showing ``--two-words`` only, but ``--twowords`` gets
        accepted **and** the automatic destination is in ``args.twowords``.

        :param opts:
            Option names, can be short or long options.
        :param attrs:
            Same attributes as the argparse library's :py:func:`add_argument()
            <argparse.ArgumentParser.add_argument>` function accepts.
        css |]}|��D]
}|VqqdSr-)rY)rGr�r1r)r)r*�	<genexpr>}sz(OptionGroup.addoption.<locals>.<genexpr>zoption names %s already addedF��
shortupperN)�set�intersectionrW�
ValueErrorr�_addoption_instance)r(r<r=Zconflictr,r)r)r*r>os�zOptionGroup.addoptioncOs t|i|��}|j|dd�dS)NTr�)rr�)r(r<r=r,r)r)r*�
_addoption�szOptionGroup._addoptionr)r,r�rcCsR|s0|jD]$}|ddkr
|d��r
td��q
|jrB|j�|�|j�|�dS)Nrr�r4zlowercase shortoptions reserved)r��islowerr�rr/rWrn)r(r,r�r�r)r)r*r��s

zOptionGroup._addoption_instance)r0N)F)
rprqrrrsrbr
rrmr+rr>r�r�r)r)r)r*r ^s���r cs�eZdZdeeeeefeedd��fdd�
Zee	d�dd�Z
deeeeej
ej
d�d	d
�Zejdd�dkr�eeeeejeeefd
�dd�Z�ZS)rRN)rr'rrcs0||_t�j||jdtdd�|r&|ni|_dS)NF)rr�add_help�formatter_class�allow_abbrev)�_parser�superr+r$�DropShorterLongHelpFormatterr')r(rr'r��	__class__r)r*r+�s�	zMyOptionParser.__init__)�messagercCsD|j�d|��}t|jd�r0|�d|jj�d�}t|��|��dS)z1Transform argparse error message into UsageError.z	: error: �_config_source_hintz (�)N)rr�r�r�r�format_usage)r(r�rxr)r)r*�error�szMyOptionParser.errorr?c	Cs�|�||�\}}|r�|D]b}|r|ddkrdd�|�g}t|j���D]\}}|�d|�d|���qJ|�d�|��qt|t��	|�|S)z(Allow splitting of positional arguments.rr�zunrecognized arguments: %s� z  rz�
)
rgr��sortedr'r`rnr�rcr[�extend)	r(r@rA�parsedZunrecognized�arg�lines�k�vr)r)r*rO�szMyOptionParser.parse_argsr�)r��	)�
arg_stringrc	Cs|sdS|d|jvrdS||jvr8|j|}||dfSt|�dkrHdSd|vr~|�dd�\}}||jvr~|j|}|||fS|js�|�d�s�|�|�}t|�dkr�td�}d�dd�|D��}|�	|||d	��nt|�dkr�|\}|S|j
�|��r|j�sdSd
|v�rdSd|dfS)Nrr4�=r�z4ambiguous option: %(option)s could match %(matches)sr�css|]\}}}|VqdSr-r))rGr�r,r)r)r*r��rJz1MyOptionParser._parse_optional.<locals>.<genexpr>)r,�matchesr�)
�prefix_chars�_option_string_actionsr�r�r��
startswith�_get_option_tuplesrr�r��_negative_number_matcher�match�_has_negative_number_optionals)	r(r��action�
option_string�explicit_arg�
option_tuplesrxrW�option_tupler)r)r*�_parse_optional�s>






�
zMyOptionParser._parse_optional)NN)NN)rprqrrrr
rrbrr+r	r�rrurvrO�sys�version_infor�Actionr��
__classcell__r)r)r�r*rR�s(��
�
��rRcsHeZdZdZeedd��fdd�Zejed��fdd�Z	d	d
�Z
�ZS)r�a+Shorten help for long options that differ only in extra hyphens.

    - Collapse **long** options that are the same except for extra hyphens.
    - Shortcut if there are only two options and one of them is a short one.
    - Cache result on the action object as this is called at least 2 times.
    N)r@�kwargsrcs,d|vrtj��|d<t�j|i|��dS)N�width)�_pytest�_ioZget_terminal_widthr�r+)r(r@r�r�r)r*r+�sz%DropShorterLongHelpFormatter.__init__)r�rcsjt��|�}|r |ddkr |St|dd�}|r4|S|�d�}t|�dkrtt|d�dksjt|d�dkrt||_|Sg}i}|D]r}t|�dks�|ddkr�q�|�d�s�td	||��|dd�}|�dd
�}	|	|vs�t||	�t|�kr�|||	<q�|D]\}t|�dk�s|ddk�r"|�	|�|dd�|�
|�dd
��kr�|�	|�ddd��q�d�|�}
|
|_|
S)Nrr��_formatted_action_invocationr�r�r4r�r�z)long optional argument without "--": [%s]r0r�)r��_format_action_invocationrcr�r�r�r�rwr�rnr�r�)r(r�Zorgstr�resrWZreturn_listZ
short_longr,ZxxoptionZ	shortenedZformatted_action_invocationr�r)r*r��sB
,
��


z6DropShorterLongHelpFormatter._format_action_invocationcCs4ddl}g}|��D]}|�|�|��|��q|S)z}Wrap lines after splitting on original newlines.

        This allows to have explicit line breaks in the help text.
        rN)�textwrap�
splitlinesr��wrap�strip)r(�textr�r�r��liner)r)r*�_split_liness
z)DropShorterLongHelpFormatter._split_lines)rprqrrrsrr+rur�rbr�r�r�r)r)r�r*r��s&r�))rurDr�r�r�typingrrrrrrr	r
rrr
rZ_pytest._ior�Z_pytest.compatrZ_pytest.config.exceptionsrZ_pytest.deprecatedrrrrZtyping_extensionsrr[r�	Exceptionrwrr �ArgumentParserrR�
HelpFormatterr�r)r)r)r*�<module>sD4z5V

Youez - 2016 - github.com/yon3zu
LinuXploit