%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.12/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.12/__pycache__/getopt.cpython-312.pyc

�

���f@����dZgd�ZddlZ	ddlmZGd�de�ZeZgfd�Z	gfd	�Z
d
�Zd�Zd�Z
d
�Zedk(r$ddlZee	ej$dddddg��yy#e$rd�ZY�WwxYw)a�Parser for command line options.

This module helps scripts to parse the command line arguments in
sys.argv.  It supports the same conventions as the Unix getopt()
function (including the special meanings of arguments of the form `-'
and `--').  Long options similar to those supported by GNU software
may be used as well via an optional third argument.  This module
provides two functions and an exception:

getopt() -- Parse command line options
gnu_getopt() -- Like getopt(), but allow option and non-option arguments
to be intermixed.
GetoptError -- exception (class) raised with 'opt' attribute, which is the
option involved with the exception.
)�GetoptError�error�getopt�
gnu_getopt�N)�gettextc��|S�N�)�ss �/usr/lib/python3.12/getopt.py�_r
)s��Q�h�c�"�eZdZdZdZdd�Zd�Zy)r�c�N�||_||_tj|||�yr	)�msg�opt�	Exception�__init__)�selfrrs   rrzGetoptError.__init__.s"�����������4��c�*rc��|jSr	)r)rs r�__str__zGetoptError.__str__3s���x�x�rN)r)�__name__�
__module__�__qualname__rrrrr
rrrr+s��
�C�
�C�+�
rrc�|�g}t|t�r|g}nt|�}|r�|djd�r�|ddk7rz|ddk(r
|dd}	||fS|djd�rt	||ddd||dd�\}}nt||ddd||dd�\}}|r|djd�r	|ddk7r�z||fS)a@getopt(args, options[, long_options]) -> opts, args

    Parses command line options and parameter list.  args is the
    argument list to be parsed, without the leading reference to the
    running program.  Typically, this means "sys.argv[1:]".  shortopts
    is the string of option letters that the script wants to
    recognize, with options that require an argument followed by a
    colon (i.e., the same format that Unix getopt() uses).  If
    specified, longopts is a list of strings with the names of the
    long options which should be supported.  The leading '--'
    characters should not be included in the option name.  Options
    which require an argument should be followed by an equal sign
    ('=').

    The return value consists of two elements: the first is a list of
    (option, value) pairs; the second is the list of program arguments
    left after the option list was stripped (this is a trailing slice
    of the first argument).  Each option-and-value pair returned has
    the option as its first element, prefixed with a hyphen (e.g.,
    '-x'), and the option argument as its second element, or an empty
    string if the option has no argument.  The options occur in the
    list in the same order in which they were found, thus allowing
    multiple occurrences.  Long and short options may be mixed.

    r�-�--�N�)�
isinstance�str�list�
startswith�do_longs�	do_shorts)�args�	shortopts�longopts�optss    rrr8s���6�D��(�C� ��:����>��
�4��7�%�%�c�*�t�A�w�#�~���7�d�?����8�D����:����7���d�#�!�$��Q�����X�t�A�B�x�H�J�D�$�"�4��a�����i��a�b��J�J�D�$��4��7�%�%�c�*�t�A�w�#�~���:�rc���g}g}t|t�r|g}nt|�}|jd�r|dd}d}n$tj
j
d�rd}nd}|r�|ddk(r
||ddz
}	||fS|ddd	dk(rt||dd	d||dd�\}}nS|dddd
k(r#|dd
k7rt||ddd||dd�\}}n%|r
||z
}	||fS|j|d�|dd}|r��||fS)agetopt(args, options[, long_options]) -> opts, args

    This function works like getopt(), except that GNU style scanning
    mode is used by default. This means that option and non-option
    arguments may be intermixed. The getopt() function stops
    processing options as soon as a non-option argument is
    encountered.

    If the first character of the option string is `+', or if the
    environment variable POSIXLY_CORRECT is set, then option
    processing stops as soon as a non-option argument is encountered.

    �+rNT�POSIXLY_CORRECTFrrr r)
r!r"r#r$�os�environ�getr%r&�append)r'r(r)r*�	prog_args�all_options_firsts      rrrcsW���D��I��(�C� ��:����>�����C� ��a�b�M�	� ��	�����)�	*� ��!��
���7�d�?���a�b��!�I����?����7�2�A�;�$��!�$��Q�����X�t�A�B�x�H�J�D�$�
�!�W�R�a�[�C�
�D��G�s�N�"�4��a�����i��a�b��J�J�D�$� ��T�!�	��
��?��� � ��a��)��A�B�x���"��?�rc�B�	|jd�}|d|||dzd}}t||�\}}|r'|�?|stt	d�|z|��|d|dd}}n|�tt	d�|z|��|jd|z|xsdf�||fS#t$rd}Y�}wxYw)N�=rzoption --%s requires argumentrz%option --%s must not have an argumentrr)�index�
ValueError�
long_has_argsrr
r1)r*rr)r'�i�optarg�has_args       rr%r%�s���)��I�I�c�N���"�1�g�s�1�Q�3�4�y�V�� ��h�/�L�G�S���>��!�!�$C�"D�s�"J�C�P�P���7�D���H�D�F�	�	��!�C�D�s�J�C�P�P��K�K����V�\�r�*�+���:��������s�B�B�Bc�V�|D�cgc]}|j|�s�|��}}|sttd�|z|��||vrd|fS|dz|vrd|fSt|�dkDrttd�|z|��t|�dk(sJ�|d}|j	d�}|r|dd}||fScc}w)	Nzoption --%s not recognizedFr5Trzoption --%s not a unique prefixr���)r$rr
�len�endswith)rr)�o�
possibilities�unique_matchr;s      rr8r8�s��� (�>�1�A�L�L��,=�Q�>�M�>���!�8�9�C�?��E�E�
�m���c�z��	�s��m�	#��S�y��
�=��A���!�=�>��D�c�J�J��}���"�"�"� ��#�L��#�#�C�(�G��#�C�R�(���L� � ��%?s
�B&�B&c���|dk7rb|d|dd}}t||�r.|dk(r$|sttd�|z|��|d|dd}}|d}}nd}|jd|z|f�|dk7r�b||fS)Nrrrzoption -%s requires argumentr)�
short_has_argrr
r1)r*�	optstringr(r'rr:s      rr&r&�s���
�r�/�"�1��y���}�Y����i�(��B���%�a�(F�&G�#�&M�&)�+�+�"&�q�'�4���8�4�	� )�2�I�F��F����S�3�Y��'�(��r�/���:�rc��tt|��D]*}|||cxk(rdk7s�n�|jd|dz�cStt	d�|z|��)N�:rzoption -%s not recognized)�ranger>r$rr
)rr(r9s   rrDrD�s\��
�3�y�>�
"�2���)�A�,�%�#�%��'�'��Q�q�S�1�1�2��a�3�4�s�:�C�
@�@r�__main__rza:bzalpha=�beta)�__doc__�__all__r.rr
�ImportErrorrrrrrr%r8r&rDr�sys�print�argvr
rr�<module>rQs����B8��	��$�
	�)�	�	��')�)�V,.�0�d�,!�*
�A��z���	�&����!�"��u�x��&8�
9�:���]����s�A�A*�)A*

Zerion Mini Shell 1.0