Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/click/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/click/__pycache__/parser.cpython-310.pyc
o

�+cadJ�@s�dZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZej
rOddlZddlmZddlmZdd
lmZddlmZe�d�Ze�Zdejedejedejejej eejej!edfej"effdd�Z#dedejeeffdd�Z$dedej!ddefdd�Z%dedej"efdd�Z&Gdd �d �ZGd!d"�d"�ZGd#d$�d$�Z'Gd%d&�d&�Z(dS)'a;
This module started out as largely a copy paste from the stdlib's
optparse module with the features removed that we do not need from
optparse because we implement them in Click on a higher level (for
instance type handling, help formatting and a lot more).

The plan is to remove more and more from here over time.

The reason this is a different module and not optparse from the stdlib
is that there are differences in 2.x and 3.x about the error messages
generated and optparse in the stdlib uses gettext for no good reason
and might cause us issues.

Click uses parts of optparse written by Gregory P. Ward and maintained
by the Python Software Foundation. This is limited to code in parser.py.

Copyright 2001-2006 Gregory P. Ward. All rights reserved.
Copyright 2002-2006 Python Software Foundation. All rights reserved.
�N)�deque)�gettext)�ngettext�)�BadArgumentUsage)�BadOptionUsage)�NoSuchOption)�
UsageError)�Argument)�Context)�Option)�	Parameter�V�args�
nargs_spec�returncst���t|�}g}d�dddtjtf�fdd��|rh�|�}|dur%q|dkr1|�����n5|dkrQ��fdd	�t|�D�}�durI|��|�t|��n|d
krf�dur]td��t	|��|�d�|s�dur�t��|�<g�t
|�dd��|�dd�<t|�t��fS)a�Given an iterable of arguments and an iterable of nargs specifications,
    it returns a tuple with all the unpacked arguments at the first index
    and all remaining arguments as the second.

    The nargs specification is the number of arguments that should be consumed
    or `-1` to indicate that this position should eat up all the remainders.

    Missing items are filled with `None`.
    N�czte.Deque[V]rcs2z�dur
|��WS|��WStyYdSw�N)�popleft�pop�
IndexError)r)�spos��./usr/lib/python3/dist-packages/click/parser.py�_fetchBs

�z_unpack_args.<locals>._fetchrcsg|]}����qSrr)�.0�_)rrrr�
<listcomp>Tsz _unpack_args.<locals>.<listcomp>rzCannot have two nargs < 0)r�t�Optionalr�append�range�reverse�tuple�	TypeError�len�reversed�list)rr�rv�nargs�xr)rrrr�_unpack_args1s6	
� r+�optcCsT|dd�}|��rd|fS|dd�|kr"|dd�|dd�fS||dd�fS)Nr��)�isalnum)r,�firstrrr�	split_optmsr1�ctxrcCs4|dus	|jdur|St|�\}}|�|�|���Sr)�token_normalize_funcr1)r,r2�prefixrrr�
normalize_optvsr5�stringcCsbddl}|j|dd�}d|_d|_g}z
|D]}|�|�qW|Sty0|�|j�Y|Sw)a�Split an argument string as with :func:`shlex.split`, but don't
    fail if the string is incomplete. Ignores a missing closing quote or
    incomplete escape sequence and uses the partial token as-is.

    .. code-block:: python

        split_arg_string("example 'my file")
        ["example", "my file"]

        split_arg_string("example my\")
        ["example", "my"]

    :param string: String to split.
    rNT)�posixr-)�shlex�whitespace_split�
commentersr �
ValueError�token)r6r8�lex�outr<rrr�split_arg_string}s���r?c@sxeZdZ			ddddejedejedejeded	ejejfd
d�Z	e
defd
d��Zdeddddfdd�Z
dS)rNr�obj�
CoreOption�opts�dest�actionr)�constc
Cs�g|_g|_t�|_|D]9}t|�\}}	|std|�d���|j�|d�t|�dkr9t|	�dkr9|j�|�q|j�|�|j�|�q|durLd}||_	||_
||_||_||_
dS)Nz$Invalid start character for option (�)rr�store)�_short_opts�
_long_opts�set�prefixesr1r;�addr%r rCrDr)rEr@)
�selfr@rBrCrDr)rEr,r4�valuerrr�__init__�s&	
zOption.__init__rcCs
|jdvS)N)rGr )rD�rMrrr�takes_value�s
zOption.takes_valuerN�state�ParsingStatecCs�|jdkr||j|j<nM|jdkr|j|j|j<n@|jdkr*|j�|jg��|�n/|jdkr<|j�|jg��|j�n|jdkrP|j�|jd�d|j|j<n	td|j�d	���|j�|j	�dS)
NrG�store_constr �append_const�countrrzunknown action '�')
rDrBrCrE�
setdefaultr �getr;�orderr@)rMrNrRrrr�process�s




zOption.process�NrN)�__name__�
__module__�__qualname__r�Sequence�strr�int�AnyrO�property�boolrQr[rrrrr�s(������

�!rc@s\eZdZddddejedefdd�Zdejejeej	ejefd	d
ddfd
d�Z
dS)r
rr@�CoreArgumentrCr)cCs||_||_||_dSr)rCr)r@�rMr@rCr)rrrrO�s
zArgument.__init__rNrRrSrNcCs�|jdkr.|dusJ�tdd�|D��}|t|�krd}n|dkr.ttd�j|j|jd���|jdkr?|jjdur?|dkr?d}||j	|j<|j
�|j�dS)	Nrcss�|]	}|durdVqdS)Nrr�rr*rrr�	<genexpr>�s�z#Argument.process.<locals>.<genexpr>rz'Argument {name!r} takes {nargs} values.��namer)���r)r)�sumr%rr�formatrCr@�envvarrBrZr )rMrNrR�holesrrrr[�s
��zArgument.process�r)r]r^r_rrrarbrO�Unionr`r[rrrrr
�s���r
c@s$eZdZdejeddfdd�ZdS)rS�rargsrNcCsi|_g|_||_g|_dSr)rB�largsrsrZ)rMrsrrrrO�s
zParsingState.__init__)r]r^r_r�ListrarOrrrrrS�srSc@s^eZdZdZd+dejdddfdd�Z			d,d	d
dejedejed
ejede	dejej
ddfdd�Z	d-d	ddejede	ddfdd�Zdej
edejejeej
fej
eej
dffdd�Zdeddfdd�Zdeddfdd�Zdedejededdfd d!�Zd"ededdfd#d$�Zd%ed&ededej
fd'd(�Zd"ededdfd)d*�ZdS).�OptionParsera+The option parser is an internal class that is ultimately used to
    parse options and arguments.  It's modelled after optparse and brings
    a similar but vastly simplified API.  It should generally not be used
    directly as the high level Click classes wrap it for you.

    It's not nearly as extensible as optparse or argparse as it does not
    implement features that are implemented on a higher level (such as
    types or defaults).

    :param ctx: optionally the :class:`~click.Context` where this parser
                should go with.
    Nr2rrcCsJ||_d|_d|_|dur|j|_|j|_i|_i|_ddh|_g|_dS)NTF�-�--)r2�allow_interspersed_args�ignore_unknown_options�
_short_opt�	_long_opt�
_opt_prefixes�_args)rMr2rrrrOs

zOptionParser.__init__rr@rArBrCrDr)rEc	sd�fdd�|D�}t||||||d�}�j�|j�|jD]}|�j|<q|jD]}|�j|<q(dS)azAdds a new option named `dest` to the parser.  The destination
        is not inferred (unlike with optparse) and needs to be explicitly
        provided.  Action can be any of ``store``, ``store_const``,
        ``append``, ``append_const`` or ``count``.

        The `obj` can be used to identify the option in the order list
        that is returned from the parser.
        csg|]}t|�j��qSr)r5r2)rr,rPrrr4sz+OptionParser.add_option.<locals>.<listcomp>)rDr)rEN)rr}�updaterKrHr{rIr|)	rMr@rBrCrDr)rE�optionr,rrPr�
add_option#s

�zOptionParser.add_optionrfcCs|j�t|||d��dS)z�Adds a positional argument named `dest` to the parser.

        The `obj` can be used to identify the option in the order list
        that is returned from the parser.
        )rCr)N)r~r r
rgrrr�add_argument<szOptionParser.add_argumentr�
CoreParametercCsXt|�}z|�|�|�|�Wnty#|jdus |jjs!�Ynw|j|j|jfS)aZParses positional arguments and returns ``(values, args, order)``
        for the parsed options and arguments as well as the leftover
        arguments if there are any.  The order is a list of objects as they
        appear on the command line.  If arguments appear multiple times they
        will be memorized multiple times as well.
        N)	rS�_process_args_for_options�_process_args_for_argsr	r2�resilient_parsingrBrtrZ)rMrrRrrr�
parse_argsFs	
��zOptionParser.parse_argsrRcCsVt|j|jdd�|jD��\}}t|j�D]\}}|�|||�q||_g|_dS)NcSsg|]}|j�qSr)r)rhrrrrZsz7OptionParser._process_args_for_args.<locals>.<listcomp>)r+rtrsr~�	enumerater[)rMrR�pargsr�idx�argrrrr�Xs�
z#OptionParser._process_args_for_argscCs�|jr?|j�d�}t|�}|dkrdS|dd�|jvr'|dkr'|�||�n|jr1|j�|�n	|j�d|�dS|jsdSdS)Nrrxr)	rsrr%r}�
_process_optsryrtr �insert)rMrRr��arglenrrrr�cs�z&OptionParser._process_args_for_optionsr,�explicit_valuecCs�||jvrddlm}|||j�}t|||jd��|j|}|jr4|dur,|j�d|�|�|||�}n|durCt	|t
d�j|d���d}|�||�dS)Nr)�get_close_matches)�
possibilitiesr2z&Option {name!r} does not take a value.)rk)
r|�difflibr�rr2rQrsr��_get_value_from_staterrrnr[)rMr,r�rRr�r�r�rNrrr�_match_long_opt�s

�zOptionParser._match_long_optr�cCs�d}d}|d}g}|dd�D]R}t|�|��|j�}|j�|�}	|d7}|	s8|jr1|�|�qt||jd��|	jrV|t|�krN|j	�
d||d��d}|�||	|�}
nd}
|	�|
|�|rbnq|jrw|ry|j
�|�d�|����dSdSdS)NFrr)r2Tr-)r5r2r{rYrzr rrQr%rsr�r�r[rt�join)rMr�rR�stop�ir4�unknown_options�chr,r�rNrrr�_match_short_opt�s4
�
�zOptionParser._match_short_opt�option_namer�cCs�|j}t|j�|kr |jjrt}|St|tdd|�j||d���|dkrM|jd}|jjrEt|t	�rE|dd�|j
vrEt|�dkrEt}|S|j�d�}|St|jd|��}|jd|�=|S)Nz%Option {name!r} requires an argument.z+Option {name!r} requires {nargs} arguments.rjrr)
r)r%rsr@�_flag_needs_valuerrrn�
isinstancerar}rr#)rMr�r�rRr)rN�	next_rargrrrr��s<����
����z"OptionParser._get_value_from_statecCs�d}d|vr|�dd�\}}n|}t||j�}z
|�|||�WdStyG|dd�|jvr:|�||�YdS|js>�|j�	|�YdSw)N�=rr.)
�splitr5r2r�rr}r�rzrtr )rMr�rRr��long_opt�
norm_long_optrrrr��s�zOptionParser._process_optsrr\rq)r]r^r_�__doc__rrrOr`rarbrcr�r�ru�Tuple�Dictr�rSr�r�r�r�rr�r�rrrrrv�st
������
�
�����
�
�&
�$���
�(���
�&rv))r��typingr�collectionsrrrr�
exceptionsrrrr	�
TYPE_CHECKING�typing_extensions�te�corer
rfrrrAr
r��TypeVarr�objectr�r`rarbr�rrrrur+r1r5r?rSrvrrrr�<module>s>
��0
�<	"6 

Spamworldpro Mini