AlkantarClanX12

Your IP : 3.145.10.68


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/cmd.cpython-312.pyc

�

�Q�f:��n�dZddlZddlZdgZdZej
ejzdzZGd�d�Zy)a	A generic class to build line-oriented command interpreters.

Interpreters constructed with this class obey the following conventions:

1. End of file on input is processed as the command 'EOF'.
2. A command is parsed out of each line by collecting the prefix composed
   of characters in the identchars member.
3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method
   is passed a single argument consisting of the remainder of the line.
4. Typing an empty line repeats the last command.  (Actually, it calls the
   method `emptyline', which may be overridden in a subclass.)
5. There is a predefined `help' method.  Given an argument `topic', it
   calls the command `help_topic'.  With no arguments, it lists all topics
   with defined help_ functions, broken into up to three topics; documented
   commands, miscellaneous help topics, and undocumented commands.
6. The command '?' is a synonym for `help'.  The command '!' is a synonym
   for `shell', if a do_shell method exists.
7. If completion is enabled, completing commands will be done automatically,
   and completing of commands args is done by calling complete_foo() with
   arguments text, line, begidx, endidx.  text is string we are matching
   against, all returned matches must begin with it.  line is the current
   input line (lstripped), begidx and endidx are the beginning and end
   indexes of the text being matched, which could be used to provide
   different completion depending upon which position the argument is in.

The `default' method may be overridden to intercept commands for which there
is no do_ method.

The `completedefault' method may be overridden to intercept completions for
commands that have no complete_ method.

The data member `self.ruler' sets the character used to draw separator lines
in the help messages.  If empty, no ruler line is drawn.  It defaults to "=".

If the value of `self.intro' is nonempty when the cmdloop method is called,
it is printed out on interpreter startup.  This value may be overridden
via an optional argument to the cmdloop() method.

The data members `self.doc_header', `self.misc_header', and
`self.undoc_header' set the headers used for the help function's
listings of documented functions, miscellaneous topics, and undocumented
functions respectively.
�N�Cmdz(Cmd) �_c��eZdZdZeZeZdZdZ	dZ
dZdZdZ
dZdZd	Zdd
�Zdd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!dd�Z"y)raA simple framework for writing line-oriented command interpreters.

    These are often useful for test harnesses, administrative tools, and
    prototypes that will later be wrapped in a more sophisticated interface.

    A Cmd instance or subclass instance is a line-oriented interpreter
    framework.  There is no good reason to instantiate Cmd itself; rather,
    it's useful as a superclass of an interpreter class you define yourself
    in order to inherit Cmd's methods and encapsulate action methods.

    �=�Nz(Documented commands (type help <topic>):zMiscellaneous help topics:zUndocumented commands:z*** No help on %s�c��|�||_ntj|_|�||_ntj|_g|_||_y)a�Instantiate a line-oriented interpreter framework.

        The optional argument 'completekey' is the readline name of a
        completion key; it defaults to the Tab key. If completekey is
        not None and the readline module is available, command completion
        is done automatically. The optional arguments stdin and stdout
        specify alternate input and output file objects; if not specified,
        sys.stdin and sys.stdout are used.

        N)�stdin�sys�stdout�cmdqueue�completekey)�selfrr
rs    �*/opt/alt/python312/lib64/python3.12/cmd.py�__init__zCmd.__init__LsC�����D�J����D�J��� �D�K��*�*�D�K���
�&���c��|j�|jr_|jrS	ddl}|j	�|_|j
|j�|j|jdz�	|�||_
|jr1|jjt|j�dz�d}|s�|jr|jjd�}n�|jr	t!|j"�}nx|jj|j"�|jj'�|j(j�}t+|�sd}n|j-d�}|j/|�}|j1|�}|j3||�}|s��|j5�|jr.|jr!	ddl}|j
|j
�yyy#t$rY���wxYw#t$$rd}Y��wxYw#t$rYywxYw#|jr=|jr0	ddl}|j
|j
�w#t$rYwwxYwwwxYw)z�Repeatedly issue a prompt, accept input, parse an initial prefix
        off the received input, and dispatch to action methods, passing them
        the remainder of the line as argument.

        rNz
: complete�
�EOFz
)�preloop�use_rawinputr�readline�
get_completer�
old_completer�
set_completer�complete�parse_and_bind�ImportError�intror�write�strr
�pop�input�prompt�EOFError�flushr
�len�rstrip�precmd�onecmd�postcmd�postloop)rrr�stop�lines     r�cmdloopzCmd.cmdloopbs$��	
��������!1�!1�
��%-�%;�%;�%=��"��&�&�t�}�}�5��'�'��(8�(8��(E�F�!	�� �"��
��z�z����!�!�#�d�j�j�/�$�"6�7��D���=�=��=�=�,�,�Q�/�D��(�(�)�#(����#5�D����)�)�$�+�+�6����)�)�+�#�z�z�2�2�4��"�4�y�#(�D�#'�;�;�v�#6�D��{�{�4�(���{�{�4�(���|�|�D�$�/��'�(
�M�M�O�� � �T�%5�%5��#��*�*�4�+=�+=�>�&6� ��=�
��
�� (�)�#(�D�)��&#�����	� � �T�%5�%5��#��*�*�4�+=�+=�>��"�����	&6� �s��AH�=A>H<�<H�B/H<�H<�*H-�	H�H�H*�'H<�)H*�*H<�-	H9�8H9�<J�I6�5J�6	J�?J�J�Jc��|S)z�Hook method executed just before the command line is
        interpreted, but after the input prompt is generated and issued.

        ��rr.s  rr)z
Cmd.precmd�s	��
�rc��|S)z?Hook method executed just after a command dispatch is finished.r1)rr-r.s   rr+zCmd.postcmd�s���rc��y)z>Hook method executed once when the cmdloop() method is called.Nr1�rs rrzCmd.preloop�s��rc��y)zYHook method executed once when the cmdloop() method is about to
        return.

        Nr1r5s rr,zCmd.postloop�s��
	
rc�N�|j�}|sdd|fS|ddk(r	d|ddz}n"|ddk(rt|d�r	d|ddz}ndd|fSdt|�}}||kr-|||jvr|dz}||kr|||jvr�|d|||dj�}}|||fS)	z�Parse the line into a command name and a string containing
        the arguments.  Returns a tuple containing (command, args, line).
        'command' and 'args' may be None if the line couldn't be parsed.
        Nr�?zhelp r�!�do_shellzshell )�strip�hasattrr'�
identchars)rr.�i�n�cmd�args      r�	parselinez
Cmd.parseline�s���
�z�z�|�����t�#�#�
�!�W��^��T�!�"�X�%�D�
�!�W��^��t�Z�(��$�q�r�(�*���T�4�'�'��#�d�)�1���!�e��Q��4�?�?�2��!��A�a�!�e��Q��4�?�?�2����8�T�!�"�X�^�^�-�S���C��~�rc�8�|j|�\}}}|s|j�S|�|j|�S||_|dk(rd|_|dk(r|j|�S	t	|d|z�}||�S#t
$r|j|�cYSwxYw)ahInterpret the argument as though it had been typed in response
        to the prompt.

        This may be overridden, but should not normally need to be;
        see the precmd() and postcmd() methods for useful execution hooks.
        The return value is a flag indicating whether interpretation of
        commands by the interpreter should stop.

        rr�do_)rB�	emptyline�default�lastcmd�getattr�AttributeError)rr.r@rA�funcs     rr*z
Cmd.onecmd�s�������-���S�$���>�>�#�#��;��<�<��%�%�����5�=��D�L��"�9��<�<��%�%�
*��t�U�S�[�1����9���"�
*��|�|�D�)�)�
*�s�%A<�<B�Bc�R�|jr|j|j�Sy)z�Called when an empty line is entered in response to the prompt.

        If this method is not overridden, it repeats the last nonempty
        command entered.

        N)rGr*r5s rrEz
Cmd.emptyline�s#���<�<��;�;�t�|�|�,�,�rc�@�|jjd|z�y)z�Called on an input line when the command prefix is not recognized.

        If this method is not overridden, it prints an error message and
        returns.

        z*** Unknown syntax: %s
N)rr r2s  rrFzCmd.default�s��	
�����4�T�9�:rc��gS)z�Method called to complete an input line when no command-specific
        complete_*() method is available.

        By default, it returns an empty list.

        r1)r�ignoreds  r�completedefaultzCmd.completedefault�s	���	rc�|�d|z}|j�D�cgc]}|j|�s�|dd��c}Scc}w)NrD�)�	get_names�
startswith)r�textrN�dotext�as     r�
completenameszCmd.completenames�s=���t���#�~�~�/�H�/�!�1�<�<��3G��!�"��/�H�H��Hs�9�9c���|dk(r�ddl}|j�}|j�}t|�t|�z
}|j	�|z
}|j�|z
}|dkDr8|j
|�\}	}
}|	dk(r
|j}n	t|d|	z�}n|j}|||||�|_	|j|S#t$r|j}Y�7wxYw#t$rYywxYw)z�Return the next possible completion for 'text'.

        If a command has not been entered, then complete against command list.
        Otherwise try to call complete_<command> to get list of completions.
        rNr�	complete_)
r�get_line_buffer�lstripr'�
get_begidx�
get_endidxrBrOrHrIrW�completion_matches�
IndexError)
rrT�stater�origliner.�stripped�begidx�endidxr@�args�foo�compfuncs
             rrzCmd.complete�s���A�:���/�/�1�H��?�?�$�D��8�}�s�4�y�0�H��(�(�*�X�5�F��(�(�*�X�5�F��a�x�!%����!5���T�3��"�9�#�3�3�H�8�#*�4��s�1B�#C�� �-�-��&.�t�T�6�6�&J�D�#�	��*�*�5�1�1��
*�8�#'�#7�#7��8���	��	�s$�C�C+�C(�'C(�+	C7�6C7c�,�t|j�S�N)�dir�	__class__r5s rrRz
Cmd.get_namess���4�>�>�"�"rc���t|j���}t�fd�|j�D��}t||z�S)Nc3�V�K�|] }|jd�dz�r|dd���"y�w)�help_r�N)rS)�.0rVres  �r�	<genexpr>z$Cmd.complete_help.<locals>.<genexpr> s4�����9�$4�q����W�t�A�w�%6�7��q�r�U�$4�s�&))�setrWrR�list)rre�commands�topicss `  r�
complete_helpzCmd.complete_helpsH����)�t�)�)�4�0�1���9�D�N�N�$4�9�9���H�v�%�&�&rc�4�|r	t|d|z�}|�y|j�}g}g}t�}|D]}|dddk(s�|j|dd��!|j�d}	|D]x}|dddk(s�||	k(r�|}	|dd}
|
|vr#|j|
�|j|
��@t||�jr|j|
��h|j|
��z|jj	dt|j�z�|j|j|dd	�|j|j t#|�dd	�|j|j$|dd	�y#t$r�	t|d|z�j}|r)|jj	dt|�z�Yyn#t$rYnwxYw|jj	dt|j|fz�z�YywxYw)
zEList available commands with "help" or detailed help with "help cmd".rnrD�%s
NrorrQ��P)rHrI�__doc__rr r!�nohelprRrr�add�sort�append�remove�
doc_leader�print_topics�
doc_header�misc_header�sorted�undoc_header)rrArJ�doc�names�cmds_doc�
cmds_undocru�name�prevnamer@s           r�do_helpzCmd.do_help$s����
��t�W�s�]�3��
�F��N�N�$�E��H��J��U�F������8�w�&��J�J�t�A�B�x�(��
�J�J�L��H������8�u�$��x�'� �#�H��Q�R��C��f�}� ����,��
�
�c�*� ��t�,�4�4� ����,�"�)�)�#�.��
�K�K���f�S����%9�9�:����d�o�o��R��C����d�.�.�����2�F����d�/�/��R��C��M"�	
����e�c�k�2�:�:�C�����)�)�&��S��/�:����&��������!�!�&��T�[�[�C�6�-A�)B�"B�C��	
�s6�F�	H�AG�H�	G�H�G�8H�Hc	�J�|r�|jjdt|�z�|jr=|jjdt|jt	|�z�z�|j||dz
�|jjd�yy)Nrxrr)rr r!�rulerr'�	columnize)r�header�cmds�cmdlen�maxcols     rr�zCmd.print_topicsRsy����K�K���f�S��[�0�1��z�z����!�!�&��T�Z�Z�#�f�+�-E�)F�"F�G��N�N�4����*��K�K���d�#�rc	�^�|s|jjd�ytt|��D�cgc]}t	||t
�s|��}}|r+t
ddjtt
|��z��t|�}|dk(r+|jjdt|d�z�ytdt|��D]�}||zdz
|z}g}d}	t|�D]]}
d}t|�D]+}|||
zz}||k\rn||}
t|t|
��}�-|j|�|	|d	zz
}	|	|kDs�]n|	|ks��nt|�}d}dg}t|�D]�}g}t|�D](}
|||
zz}||k\rd
}
n||}
|j|
��*|r|ds|d=|r|ds�tt|��D]}
||
j||
�||
<�|jjdtdj|��z���ycc}w)
z�Display a list of strings as a compact set of columns.

        Each column is only as wide as necessary.
        Columns are separated by two spaces (one was not legible enough).
        z<empty>
Nz list[i] not a string for i in %sz, rrxr����r���z  )rr �ranger'�
isinstancer!�	TypeError�join�map�maxr�ljust)rrs�displaywidthr>�
nonstrings�size�nrows�ncols�	colwidths�totwidth�col�colwidth�row�x�textss               rr�z
Cmd.columnizeZsA����K�K���k�*��!&�s�4�y�!1�9�!1�A�)�$�q�'�3�7��!1�
�9���>�"�i�i��C��(<�=�>�?�
?��4�y���1�9��K�K���f�S��a��\�1�2���1�c�$�i�(�E��%�Z��\�e�+�E��I��H��U�|���� ��<�C��e�C�i��A��D�y���Q��A�"�8�S��V�4�H�(�� � ��*��H�q�L�(���l�*��$��<�'��#)�&��I�E��E���I���<�C��E��U�|���%��)�O����9��A��Q��A����Q��
$���b�	��"�I���b�	��S��Z�(��"�3�Z�-�-�i��n�=��c�
�)��K�K���f�S����5�)9�%:�:�;� ��A9s�H*)�tabNNri)rz)#�__name__�
__module__�__qualname__r{�PROMPTr$�
IDENTCHARSr=r�rGrr�r�r�r�r|rrr/r)r+rr,rBr*rErFrOrWrrRrvr�r�r�r1rrrr4s���
��F��J��E��G��E��J�;�J�.�K�+�L�
 �F��L�'�,1�h��
�
��(�6-�;��I��<#�
'�,D�\$�7<r)	r{�stringr�__all__r��
ascii_letters�digitsr�rr1rr�<module>r�sA��*�X��'��	��
�
!�
!�F�M�M�
1�C�
7�
�]<�]<r