ok

Mini Shell

Direktori : /opt/imunify360/venv/lib64/python3.11/site-packages/click/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/click/__pycache__/parser.cpython-311.pyc

�

3�Dg{J���dZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZej
rddlZddlmZddlmZdd
lmZddlmZejd��Ze��Zdejedejedejejej eejej!edfej"effd�Z#dedejeeffd�Z$dedej!ddefd�Z%dedej"efd�Z&Gd�d��ZGd�d��ZGd�d ��Z'Gd!�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�returnc������t����t|��}g}d�dddtjtf�fd��|r��|��}|��|dkr|�������n�|dkrU��fd�t|��D��}��|���|�t|����n;|dkr5��td	���t|���|�d��|�ˉ�6t���|�<g�t|�dzd���|�dzd�<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]rc�|��	��|���S|���S#t$rYdSwxYw�N)�popleft�pop�
IndexError)r�sposs ��l/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib/python3.11/site-packages/click/parser.py�_fetchz_unpack_args.<locals>._fetchBsJ���	��|��y�y�{�{�"��u�u�w�w����	�	�	��4�4�	���s�-�-�
;�;rc�&��g|]
}������S�r)�.0�_rrs  ��r�
<listcomp>z _unpack_args.<locals>.<listcomp>Ts!���4�4�4�!������4�4�4�rzCannot have two nargs < 0)r�t�Optionalr�append�range�reverse�tuple�	TypeError�len�reversed�list)rr�rv�nargs�xrrs`    @@r�_unpack_argsr01s��������;�;�D��z�"�"�J�DF�B� �D��-��A�J�q�M�����������z�"�"���=���A�:�:��I�I�f�f�T�l�l�#�#�#�#�
�Q�Y�Y�4�4�4�4�4�u�U�|�|�4�4�4�A����	�	�����I�I�e�A�h�h�����
�Q�Y�Y���� ;�<�<�<��r�7�7�D��I�I�d�O�O�O�-��4����;�;��4����!�"�T�A�X�Z�Z�.�1�1��4�!�8�:�:����9�9�d�4�j�j� � r"�optc��|dd�}|���rd|fS|dd�|kr|dd�|dd�fS||dd�fS)Nr��)�isalnum)r1�firsts  r�	split_optr7msh������G�E��}�}�����3�w��
�1�Q�3�x�5����2�A�2�w��A�B�B�����#�a�b�b�'�>�r"�ctxrc�n�|�|j�|St|��\}}|�|�|����Sr)�token_normalize_funcr7)r1r8�prefixs   r�
normalize_optr<vsB��
�{�c�.�6��
��C�.�.�K�F�C��5�c�.�.�s�3�3�5�5�5r"�stringc���ddl}|�|d���}d|_d|_g}	|D]}|�|���n*#t$r|�|j��YnwxYw|S)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)�posixr3)�shlex�whitespace_split�
commentersr%�
ValueError�token)r=r@�lex�outrDs     r�split_arg_stringrG}s����L�L�L�
�+�+�f�D�+�
)�
)�C��C���C�N�
�C���	�	�E��J�J�u�����	������	�
�
�3�9������	�����Js�A�$A/�.A/c���eZdZ			ddddejedejedejeded	ejejfd
�Z	e
defd���Zd
ejddddfd�Z
dS)r
Nr�obj�
CoreOption�opts�dest�actionr.�constc��g|_g|_t��|_|D]�}t	|��\}}	|std|�d����|j�|d��t|��dkr.t|	��dkr|j�|����|j�|��|j�|����|�d}||_	||_
||_||_||_
dS)Nz$Invalid start character for option (�)rr�store)�_short_opts�
_long_opts�set�prefixesr7rC�addr*r%rLrMr.rNrI)
�selfrIrKrLrMr.rNr1r;�values
          r�__init__zOption.__init__�s��������$'�E�E��
��		*�		*�C�%�c�N�N�M�F�E��
P� �!N��!N�!N�!N�O�O�O��M���f�Q�i�(�(�(��6�{�{�a���C��J�J�!�O�O�� �'�'��,�,�,�,���&�&�s�+�+�+��
�!�!�&�)�)�)�)��>��F���	������
���
�����r"rc��|jdvS)N)rQr%)rM)rWs r�takes_valuezOption.takes_value�s���{�1�1�1r"rX�state�ParsingStatec�h�|jdkr||j|j<n�|jdkr|j|j|j<n�|jdkr4|j�|jg���|��n�|jdkr9|j�|jg���|j��nT|jdkr1|j�|jd��dz|j|j<ntd|j�d	����|j�|j	��dS)
NrQ�store_constr%�append_const�countrrzunknown action '�')
rMrKrLrN�
setdefaultr%�getrC�orderrI)rWrXr\s   r�processzOption.process�s!���;�'�!�!�$)�E�J�t�y�!�!�
�[�M�
)�
)�$(�J�E�J�t�y�!�!�
�[�H�
$�
$��J�!�!�$�)�R�0�0�7�7��>�>�>�>�
�[�N�
*�
*��J�!�!�$�)�R�0�0�7�7��
�C�C�C�C�
�[�G�
#�
#�$)�J�N�N�4�9�a�$@�$@�1�$D�E�J�t�y�!�!��>���>�>�>�?�?�?�
����4�8�$�$�$�$�$r"�NrN)�__name__�
__module__�__qualname__r#�Sequence�strr$�int�AnyrY�property�boolr[rfrr"rr
r
�s�������#'��#'���
���j��o���j��o�	�
�
�3����
��z�!�%� �����B�2�T�2�2�2��X�2�
%�Q�U�
%�>�
%�d�
%�
%�
%�
%�
%�
%r"r
c��eZdZd
dddejedefd�Zdejejeej	ejefdd	d
dfd�Z
dS)rrrI�CoreArgumentrLr.c�0�||_||_||_dSr)rLr.rI�rWrIrLr.s    rrYzArgument.__init__�s����	���
�����r"rXr\r]rNc��|jdkrt|�J�td�|D����}|t|��krd}nA|dkr;tt	d���|j|j������|jdkr|jj�|dkrd}||j	|j<|j
�|j��dS)Nrc3�K�|]}|�dV��	dS)Nrr�rr/s  r�	<genexpr>z#Argument.process.<locals>.<genexpr>�s"����6�6�a�A�I��I�I�I�I�6�6r"rz'Argument {name!r} takes {nargs} values.��namer.���r)r.�sumr*rr �formatrLrI�envvarrKrer%)rWrXr\�holess    rrfzArgument.process�s���
�:��>�>��$�$�$��6�6�5�6�6�6�6�6�E���E�
�
�"�"�����!���&��?�@�@�G�G�!�Y�d�j�H�������:������� ;������E� %��
�4�9��
����4�8�$�$�$�$�$r"�r)rhrirjr#r$rlrmrY�Unionrkrfrr"rrr�s���������N��!�*�S�/��#�����
%��w�q�z�#���
�1�:�c�?�(C�C�D�%��%�
�	%�%�%�%�%�%r"rc�4�eZdZdejeddfd�ZdS)r]�rargsrNc�>�i|_g|_||_g|_dSr)rK�largsr�re)rWr�s  rrYzParsingState.__init__�s"��(*��	�"$��
���
�.0��
�
�
r")rhrirjr#�ListrlrYrr"rr]r]�s<������1�a�f�S�k�1�d�1�1�1�1�1�1r"r]c�$�eZdZdZd!dejdddfd�Z			d"dd	d
ejedejedejed
e	dejej
ddfd�Z	d#dddejed
e	ddfd�Zdej
edejejeej
fej
eej
dffd�Zdeddfd�Zdeddfd�Zdedejededdfd�Zdededdfd�Zdedededej
fd�Zdededdfd �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.
    Nr8rrc��||_d|_d|_|�|j|_|j|_i|_i|_ddh|_g|_dS)NTF�-�--)r8�allow_interspersed_args�ignore_unknown_options�
_short_opt�	_long_opt�
_opt_prefixes�_args)rWr8s  rrYzOptionParser.__init__s_�����
.2��$�
-2��#��?�+.�+F�D�(�*-�*D�D�'�/1���.0���!�4�[���')��
�
�
r"rrIrJrKrLrMr.rNc�����fd�|D��}t||||||���}�j�|j��|jD]}|�j|<�
|jD]}|�j|<�
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.
        c�:��g|]}t|�j����Sr)r<r8)rr1rWs  �rr!z+OptionParser.add_option.<locals>.<listcomp>4s%���=�=�=��
�c�4�8�,�,�=�=�=r")rMr.rNN)r
r��updaterUrRr�rSr�)	rWrIrKrLrMr.rN�optionr1s	`        r�
add_optionzOptionParser.add_option#s����">�=�=�=��=�=�=����T�4��e�5�Q�Q�Q����!�!�&�/�2�2�2��%�	*�	*�C�#)�D�O�C� � ��$�	)�	)�C�"(�D�N�3���	)�	)r"rrc�Z�|j�t|||�����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.
        )rLr.N)r�r%rrts    r�add_argumentzOptionParser.add_argument<s/��	
�
���(�3�T��?�?�?�@�@�@�@�@r"r�
CoreParameterc���t|��}	|�|��|�|��n$#t$r|j�|jjs�YnwxYw|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.
        )	r]�_process_args_for_options�_process_args_for_argsr
r8�resilient_parsingrKr�re)rWrr\s   r�
parse_argszOptionParser.parse_argsFs����T�"�"��	��*�*�5�1�1�1��'�'��.�.�.�.���	�	�	��x��t�x�'A��� ��	�����z�5�;���3�3s�*<�A�Ar\c���t|j|jzd�|jD����\}}t	|j��D]!\}}|�|||���"||_g|_dS)Nc��g|]	}|j��
Sr)r.rws  rr!z7OptionParser._process_args_for_args.<locals>.<listcomp>Zs��'D�'D�'D�A���'D�'D�'Dr")r0r�r�r��	enumeraterf)rWr\�pargsr�idx�args      rr�z#OptionParser._process_args_for_argsXs���"��K�%�+�%�'D�'D���'D�'D�'D�
�
���t�"�$�*�-�-�	+�	+�H�C���K�K��c�
�E�*�*�*�*��������r"c�b�|jr�|j�d��}t|��}|dkrdS|dd�|jvr|dkr|�||��n?|jr|j�|��n|j�d|��dS|j��dSdS)Nrr�r)	r�rr*r��
_process_optsr�r�r%�insert)rWr\r��arglens    rr�z&OptionParser._process_args_for_optionscs����k�
	��+�/�/�!�$�$�C���X�X�F��d�{�{����R�a�R��D�.�.�.�6�A�:�:��"�"�3��.�.�.�.��-�
���"�"�3�'�'�'�'���"�"�1�c�*�*�*����k�
	�
	�
	�
	�
	r"r1�explicit_valuec��||jvr.ddlm}|||j��}t|||j����|j|}|jr5|�|j�d|��|�|||��}n5|�1t|td���|������d}|�||��dS)Nr)�get_close_matches)�
possibilitiesr8z&Option {name!r} does not take a value.)rz)
r��difflibr�r	r8r[r�r��_get_value_from_staterr r}rf)rWr1r�r\r�r�r�rXs        r�_match_long_optzOptionParser._match_long_opt�s����d�n�$�$�1�1�1�1�1�1�-�-�c�4�>�B�B�M��s�-�T�X�N�N�N�N����$����	�
�)���"�"�1�n�5�5�5��.�.�s�F�E�B�B�E�E�
�
'� ��Q�?�@�@�G�G�S�G�Q�Q���
�
�E����u�e�$�$�$�$�$r"r�c�x�d}d}|d}g}|dd�D]�}t|�|��|j��}|j�|��}	|dz
}|	s3|jr|�|���Yt
||j����|	jrP|t|��kr%|j	�
d||d���d}|�||	|��}
nd}
|	�|
|��|rn��|jr5|r5|j
�|�d�|������dSdSdS)NFrr)r8Tr3)r<r8r�rdr�r%r	r[r*r�r�r�rfr��join)rWr�r\�stop�ir;�unknown_options�chr1r�rXs           r�_match_short_optzOptionParser._match_short_opt�s�����
���Q������a�b�b�'�	�	�B��6��2�����:�:�C��_�(�(��-�-�F�
��F�A��
6��.��#�*�*�2�.�.�.��"�3�D�H�5�5�5�5��!�

��s�3�x�x�<�<��K�&�&�q�#�a�b�b�'�2�2�2��D��2�2�3���F�F������N�N�5�%�(�(�(��
���
��&�	F�?�	F��K���&�D�"�'�'�/�*B�*B�D�D�E�E�E�E�E�	F�	F�	F�	Fr"�option_namer�c��|j}t|j��|krH|jjrt}n�t|t
dd|���||������|dkru|jd}|jjrAt|t��r,|dd�|j
vrt|��dkrt}nA|j�d��}n&t|jd|���}|jd|�=|S)Nz%Option {name!r} requires an argument.z+Option {name!r} requires {nargs} arguments.ryrr)
r.r*r�rI�_flag_needs_valuerrr}�
isinstancerlr�rr()rWr�r�r\r.rX�	next_rargs       rr�z"OptionParser._get_value_from_state�s������u�{���e�#�#��z�+�
�)���$���?�E�����f�+�U�f�;�;�
����a�Z�Z���A��I��
�,�

+��y�#�.�.�

+��b�q�b�M�T�%7�7�7��	�N�N�Q�&�&�*��������*�*����%�+�f�u�f�-�.�.�E���F�U�F�#��r"c�^�d}d|vr|�dd��\}}n|}t||j��}	|�|||��dS#t$rP|dd�|jvr|�||��YdS|js�|j�	|��YdSwxYw)N�=rr4)
�splitr<r8r�r	r�r�r�r�r%)rWr�r\r��long_opt�
norm_long_opts      rr�zOptionParser._process_opts�s������#�:�:�'*�y�y��a�'8�'8�$�H�n�n��H�%�h���9�9�
�
	$�� � ����F�F�F�F�F���	$�	$�	$��2�A�2�w�d�0�0�0��%�%�c�5�1�1�1�����.�
���K���s�#�#�#�#�#�#�	$���s�A�1B,�"B,�+B,rrgr�)rhrirj�__doc__r#r$rYrkrlrmrnr�r�r��Tuple�Dictr�r]r�r�r�r�r
r�r�rr"rr�r��s���������*�*�A�J�y�1�*�T�*�*�*�*�:#'��#'�)�)�
�)��j��o�)��j��o�	)�
�
�3��)��
)��z�!�%� �)�
�)�)�)�)�4HI�A�A�!�A�)*��C��A�AD�A�	
�A�A�A�A�4��F�3�K�4�	
�����Q�U�
�#�Q�V�C�[�!�&��2I�I�	J�4�4�4�4�$	�L�	�T�	�	�	�	��|�������H%��%�()�
�3��%�@L�%�	
�%�%�%�%�<&F�C�&F��&F��&F�&F�&F�&F�P$��$�(.�$�7C�$�	
��$�$�$�$�L$��$�\�$�d�$�$�$�$�$�$r"r�))r��typingr#�collectionsrrr r�
exceptionsrrr	r
�
TYPE_CHECKING�typing_extensions�te�corerrrrr
rJrr��TypeVarr�objectr�rkrlrmr�r�r$r�r0r7r<rGr]r�rr"r�<module>r�s�����.���������� � � � � � �������(�(�(�(�(�(�&�&�&�&�&�&�$�$�$�$�$�$�"�"�"�"�"�"��?�1�"�"�"�"�.�.�.�.�.�.�������*�*�*�*�*�*�0�0�0�0�0�0�
�A�I�c�N�N��
�F�H�H��9!�
�*�S�/�9!�'(�z�#��9!��W�Q�Z����Q�Z��
�3��%@�$� F�G�
H�!�&�QT�+�
U�V�9!�9!�9!�9!�x�3��1�7�3��8�,�����6�s�6���I�!6�6�3�6�6�6�6��S��Q�V�C�[�����D3%�3%�3%�3%�3%�3%�3%�3%�l%�%�%�%�%�%�%�%�@1�1�1�1�1�1�1�1�T$�T$�T$�T$�T$�T$�T$�T$�T$�T$r"

Zerion Mini Shell 1.0