ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/guppy/etc/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/guppy/etc/__pycache__/cmd.cpython-311.pyc

�

�܋f�:��Z�dZddlZdgZdZejejzdzZGd�d��ZdS)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.

These interpreters use raw_input; thus, if the readline module is loaded,
they automatically support Emacs-like command history and editing features.
�N�Cmdz(Cmd) �_c��eZdZdZeZeZdZdZ	dZ
dZdZdZ
dZdZd	Zd d�Zd!d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d"d�Z$dS)#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��tabc��ddl}|�||_n|j|_|�||_n|j|_g|_||_dS)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.

        rN)�sys�stdin�stdout�cmdqueue�completekey)�selfrrr
rs     �`/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/guppy/etc/cmd.py�__init__zCmd.__init__PsR��	�
�
�
����D�J�J���D�J��� �D�K�K��*�D�K���
�&�����c�(�|���|jrm|jrf	ddl}|���|_|�|j��|�|jdz��n#t$rYnwxYw	|�||_
|j
r/|j�t|j
��dz��d}|�s*|jr|j�d��}n�|���|jr(	t#|j��}n#t&$rd}YnqwxYw|j�|j��|j���|j���}t-|��sd}n
|dd�}|�|��}|�|��}|�|��}|�||��}|��*|���|jr9|jr4	ddl}|�|j��dS#t$rYdSwxYwdSdS#|jr7|jr1	ddl}|�|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�
�EOF���)�preloop�use_rawinputr�readline�
get_completer�
old_completer�
set_completer�complete�parse_and_bind�ImportError�intror
�write�strr�pop�preinput�input�prompt�EOFError�flushr�len�	postinput�precmd�onecmd�postcmd�postloop)rr!r�stop�lines     r�cmdloopzCmd.cmdloopgs���	
��������	��!1�	�
�����%-�%;�%;�%=�%=��"��&�&�t�}�5�5�5��'�'��(8��(E�F�F�F�F���
�
�
���
����#	�� �"��
��z�
8���!�!�#�d�j�/�/�$�"6�7�7�7��D��
0��=�0��=�,�,�Q�/�/�D�D��M�M�O�O�O��(�-�)�#(���#5�#5�D�D��'�)�)�)�#(�D�D�D�)������)�)�$�+�6�6�6���)�)�+�+�+�#�z�2�2�4�4��"�4�y�y�-�#(�D�D�#'����9�D��>�>�$�/�/�D��{�{�4�(�(���{�{�4�(�(���|�|�D�$�/�/��+�
0�,
�M�M�O�O�O�� �
�T�%5�
��#�O�O�O��*�*�4�+=�>�>�>�>�>��"�����D�D�����	
�
�
�
��t� �
�T�%5�
��#�O�O�O��*�*�4�+=�>�>�>�>��"�����D�����	
�
���sz�AA9�9
B�B�
BI�D!� I�!D0�-I�/D0�0CI�H;�;
I	�I	�J� I?�>J�?
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.

        ��rr1s  rr,z
Cmd.precmd�s	��
�rc��|S)z?Hook method executed just after a command dispatch is finished.r4)rr0r1s   rr.zCmd.postcmd�����rc��dS)z7Hook method executed just before an input line is read.Nr4�rs rr%zCmd.preinput�s���rc��|S)z6Hook method executed just after an input line is read.r4r5s  rr+z
Cmd.postinput�r7rc��dS)z>Hook method executed once when the cmdloop() method is called.Nr4r9s rrzCmd.preloop�s���rc��dS)zYHook method executed once when the cmdloop() method is about to
        return.

        Nr4r9s rr/zCmd.postloop�s	��
	
�rc��|���}|sdd|fS|ddkrd|dd�z}n/|ddkr#t|d��rd|dd�z}ndd|fSdt|��}}||kr)|||jvr|dz}||kr|||jv�|d|�||d����}}|||fS)Nr�?zhelp r�!�do_shellzshell )�strip�hasattrr*�
identchars)rr1�i�n�cmd�args      r�	parselinez
Cmd.parseline�s���z�z�|�|���	(���t�#�#�
�!�W��^�^��T�!�"�"�X�%�D�D�
�!�W��^�^��t�Z�(�(�
(��$�q�r�r�(�*����T�4�'�'��#�d�)�)�1���!�e�e��Q��4�?�2�2��!��A��!�e�e��Q��4�?�2�2�����8�T�!�"�"�X�^�^�-�-�S���C��~�rc�\�|�|��\}}}|s|���S|�|�|��S||_|dkr|�|��S	t	|d|z��}n%#t
$r|�|��cYSwxYw||��S)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.

        Nr�do_)rH�	emptyline�default�lastcmd�getattr�AttributeError)rr1rFrG�funcs     rr-z
Cmd.onecmd�s�������-�-���S�$��	$��>�>�#�#�#��;��<�<��%�%�%�����"�9�9��<�<��%�%�%�
*��t�U�S�[�1�1����!�
*�
*�
*��|�|�D�)�)�)�)�)�
*�����4��9�9�s�*A>�>B �B c�H�|jr|�|j��SdS)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)rMr-r9s rrKz
Cmd.emptyline�s,���<�	-��;�;�t�|�,�,�,�	-�	-rc�@�|j�d|z��dS)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"r5s  rrLzCmd.default�s&��	
����4�t�;�<�<�<�<�<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.

        r4)r�ignoreds  r�completedefaultzCmd.completedefault�s	���	rc�N��d|z��fd�|���D��S)NrJc�N��g|]!}|�����|dd���"S)�N)�
startswith)�.0�a�dotexts  �r�
<listcomp>z%Cmd.completenames.<locals>.<listcomp>s2���H�H�H�!�1�<�<��3G�3G�H��!�"�"��H�H�Hr)�	get_names)r�textrTr\s   @r�
completenameszCmd.completenames�s0����t���H�H�H�H�t�~�~�/�/�H�H�H�Hrc�$�|dkr�ddl}|���}|���}t|��t|��z
}|���|z
}|���|z
}|dkrS|�|��\}	}
}|	dkr|j}n3	t|d|	z��}n#t$r
|j}YnwxYw|j
}|||||��|_	|j|S#t$rYdSwxYw)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_endidxrHrUrNrOr`�completion_matches�
IndexError)
rr_�stater�origliner1�stripped�begidx�endidxrF�args�foo�compfuncs
             rrzCmd.completesD���A�:�:��O�O�O��/�/�1�1�H��?�?�$�$�D��8�}�}�s�4�y�y�0�H��(�(�*�*�X�5�F��(�(�*�*�X�5�F���z�z�!%����!5�!5���T�3��"�9�9�#�3�H�H�8�#*�4��s�1B�#C�#C����)�8�8�8�#'�#7����8���� �-��&.�h�t�T�6�6�&J�&J�D�#�	��*�5�1�1���	�	�	��4�4�	���s$�.C�C�C�4D�
D�Dc��g}|jg}|rG|�d��}|jr|t|j��z}|t	|��z}|�G|S)Nr)�	__class__r$�	__bases__�list�dir)r�names�classes�aclasss    rr^z
Cmd.get_names!sk�����>�"���	(��[�[��^�^�F���
;�!�D��)9�$:�$:�:���C��K�K�'�E�	�	(�
�rc��|j|�S�N)r`)rrns  r�
complete_helpzCmd.complete_help-s��!�t�!�4�(�(rc�v�|r�	t|d|z��}n�#t$r�	t|d|z��j}|r-|j�dt|��z��YdSn#t$rYnwxYw|j�dt|j|fz��z��YdSwxYw|��dS|���}g}g}i}|D]}|dd�dkr
d||dd�<�|���d}	|D]�}|dd�dkrp||	kr�|}	|dd�}
|
|vr|�	|
��||
=�@t||��jr|�	|
���k|�	|
����|j�dt|j
��z��|�|j|dd	��|�|j
t|�����dd	��|�|j|dd	��dS)
N�help_rJ�%s
�rrrX��P)rNrO�__doc__r
r"r#�nohelpr^�sort�append�
doc_leader�print_topics�
doc_header�misc_headerrt�keys�undoc_header)rrGrP�docrv�cmds_doc�
cmds_undoc�help�name�prevnamerFs           r�do_helpzCmd.do_help0s����*	E�
��t�W�s�]�3�3����!�	
�	
�	
��!�$����4�4�<�C�����)�)�&�3�s�8�8�*;�<�<�<������&�����D�������!�!�&�3�t�{�c�V�/C�+D�+D�"D�E�E�E����	
����
�D�F�F�F�F�F��N�N�$�$�E��H��J��D��
'�
'������8�w�&�&�%&�D��a�b�b��N���J�J�L�L�L��H��
/�
/������8�u�$�$��x�'�'� �#�H��q�r�r�(�C��d�{�{� ����,�,�,� ��I�I� ��t�,�,�4�/� ����,�,�,�,�"�)�)�#�.�.�.���K���f�s�4�?�';�';�;�<�<�<����d�o��R��D�D�D����d�.��d�i�i�k�k�1B�1B�B��K�K�K����d�/��R��D�D�D�D�Ds3��
B2�AA+�*B2�+
A8�5B2�7A8�86B2�1B2c	�T�|r�|j�dt|��z��|jr?|j�dt|jt	|��z��z��|�||dz
��|j�d��dSdS)Nr~rr)r
r"r#�rulerr*�	columnize)r�header�cmds�cmdlen�maxcols     rr�zCmd.print_topics]s����	$��K���f�s�6�{�{�2�3�3�3��z�
J���!�!�&�3�t�z�C��K�K�/G�+H�+H�"H�I�I�I��N�N�4����*�*�*��K���d�#�#�#�#�#�	$�	$rr�c	����s|j�d��dS�fd�tt�����D��}|r8t	dd�t
t|����z���t���}|dkr2|j�dt�d��z��dStdt�����D]�}||zdz
|z}g}d	}t|��D]p}	d}
t|��D]7}|||	zz}||krn&�|}
t|
t|
����}
�8|�	|
��||
d
zz
}||krn�q||krn��t���}d}dg}t|��D]�}g}t|��D]0}	|||	zz}||krd}
n�|}
|�	|
���1|r|ds
|d=|r|d�
tt|����D]&}	||	�
||	��||	<�'|j�dtd
�|����z����dS)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>
Nc�J��g|]}t�|t���|�� Sr4)�
isinstancer#)rZrDrts  �rr]z!Cmd.columnize.<locals>.<listcomp>ns;���7�7�7�A�'��Q���5�5�7�a�7�7�7rz list[i] not a string for i in %sz, rr~r����rrz  )r
r"�ranger*�	TypeError�join�mapr#�maxr��ljust)rrt�displaywidth�
nonstrings�size�nrows�ncols�	colwidths�totwidth�col�colwidth�rowrD�x�textss `             rr�z
Cmd.columnizees�����	��K���k�*�*�*��F�7�7�7�7��s�4�y�y�!1�!1�7�7�7�
��	=��>� �I�I�c�#�z�&:�&:�;�;�<�=�=�
=��4�y�y���1�9�9��K���f�s�4��7�|�|�3�4�4�4��F��1�c�$�i�i�(�(�	�	�E��%�Z��\�e�+�E��I��H��U�|�|�
�
���� ��<�<�5�5�C��e�C�i��A��D�y�y����Q��A�"�8�S��V�V�4�4�H�H�� � ��*�*�*��H�q�L�(���l�*�*��E�+��<�'�'���(���I�I�E��E���I���<�<�
	>�
	>�C��E��U�|�|�
 �
 ���%��)�O����9�9��A�A��Q��A����Q������
��b�	�
��"�I��
��b�	�
��S��Z�Z�(�(�
>�
>��"�3�Z�-�-�i��n�=�=��c�
�
��K���f�s�4�9�9�U�+;�+;�'<�'<�<�=�=�=�=�
	>�
	>r)r	NNrz)r�)%�__name__�
__module__�__qualname__r��PROMPTr'�
IDENTCHARSrCr�rMr!r�r�r�r�r�rrr2r,r.r%r+rr/rHr-rKrLrUr`rr^r{r�r�r�r4rrrr8s�������
�
��F��J��E��G��E��J�;�J�.�K�+�L�
 �F��L�'�'�'�'�.3�3�3�3�j������F�F�F����
�
�
�
�
�
����"���2-�-�-�=�=�=����I�I�I����<
�
�
�)�)�)�+E�+E�+E�Z$�$�$�6>�6>�6>�6>�6>�6>r)r��string�__all__r��
ascii_letters�digitsr�rr4rr�<module>r�sw��-�-�^�
�
�
��'��	��
�
!�F�M�
1�C�
7�
�c>�c>�c>�c>�c>�c>�c>�c>�c>�c>r

Zerion Mini Shell 1.0