ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/cmd.cpython-38.opt-2.pyc

U

.��c:�@s<ddlZddlZdgZdZejejdZGdd�d�ZdS)�N�Cmdz(Cmd) �_c@s�eZdZeZeZdZdZdZ	dZ
dZdZdZ
dZdZd/d
d�Zd0dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Z d1d-d.�Z!dS)2r�=�Nz(Documented commands (type help <topic>):zMiscellaneous help topics:zUndocumented commands:z*** No help on %s��tabcCs@|dk	r||_ntj|_|dk	r(||_ntj|_g|_||_dS�N)�stdin�sys�stdout�cmdqueue�completekey)�selfr
r	r�r�(/opt/alt/python38/lib64/python3.8/cmd.py�__init__LszCmd.__init__cCs�|��|jr\|jr\z2ddl}|��|_|�|j�|�|jd�Wnt	k
rZYnXz�|dk	rl||_
|j
r�|j�t
|j
�d�d}|�s4|jr�|j�d�}nl|jr�zt|j�}Wntk
r�d}YnXn<|j�|j�|j��|j��}t|��sd}n
|�d�}|�|�}|�|�}|�||�}q�|��W5|j�r�|j�r�zddl}|�|j�Wnt	k
�r~YnXXdS)Nrz
: complete�
�EOFz
)�preloop�use_rawinputr
�readlineZ
get_completerZ
old_completerZ
set_completer�complete�parse_and_bind�ImportError�intror�write�strr�pop�input�prompt�EOFError�flushr	�len�rstrip�precmd�onecmd�postcmd�postloop)rrr�stop�linerrr�cmdloopbsN






zCmd.cmdloopcCs|Srr�rr)rrrr$�sz
Cmd.precmdcCs|Srr)rr(r)rrrr&�szCmd.postcmdcCsdSrr�rrrrr�szCmd.preloopcCsdSrrr,rrrr'�szCmd.postloopcCs�|��}|sdd|fS|ddkr4d|dd�}n2|ddkrft|d�r\d|dd�}n
dd|fSdt|�}}||kr�|||jkr�|d}qt|d|�||d���}}|||fS)Nr�?zhelp r�!Zdo_shellzshell )�strip�hasattrr"�
identchars)rr)�i�n�cmd�argrrr�	parseline�s



z
Cmd.parselinecCs�|�|�\}}}|s|��S|dkr.|�|�S||_|dkrBd|_|dkrT|�|�Szt|d|�}Wntk
r�|�|�YSX||�SdS)Nrr�do_)r6�	emptyline�default�lastcmd�getattr�AttributeError)rr)r4r5�funcrrrr%�s


z
Cmd.onecmdcCs|jr|�|j�SdSr)r:r%r,rrrr8�sz
Cmd.emptylinecCs|j�d|�dS)Nz*** Unknown syntax: %s
)rrr+rrrr9�szCmd.defaultcGsgSrr)r�ignoredrrr�completedefault�szCmd.completedefaultcsd|��fdd�|��D�S)Nr7cs"g|]}|���r|dd��qS)�N��
startswith��.0�a�Zdotextrr�
<listcomp>�s
z%Cmd.completenames.<locals>.<listcomp>)�	get_names)r�textr>rrFr�
completenames�szCmd.completenamesc
Cs�|dkr�ddl}|��}|��}t|�t|�}|��|}|��|}|dkr�|�|�\}	}
}|	dkrp|j}q�zt|d|	�}Wq�t	k
r�|j}Yq�Xn|j
}|||||�|_z|j|WStk
r�YdSXdS)NrrZ	complete_)
rZget_line_buffer�lstripr"Z
get_begidxZ
get_endidxr6r?r;r<rJZcompletion_matches�
IndexError)
rrI�staterZorigliner)�strippedZbegidxZendidxr4�argsZfooZcompfuncrrrr�s*zCmd.completecCs
t|j�Sr)�dir�	__class__r,rrrrHsz
Cmd.get_namescs4t|j���}t�fdd�|��D��}t||B�S)Nc3s,|]$}|�d�d�r|dd�VqdS)�help_r�NrArC�rOrr�	<genexpr> s�z$Cmd.complete_help.<locals>.<genexpr>)�setrJrH�list)rrOZcommandsZtopicsrrTr�
complete_helpszCmd.complete_helpcCs�|r�zt|d|�}Wn|tk
r�z4t|d|�j}|rX|j�dt|��WYdSWntk
rnYnX|j�dt|j|f��YdSX|��n|��}g}g}i}|D]$}|dd�dkr�d||dd�<q�|��d}	|D]p}|dd�dkr�||	k�rq�|}	|dd�}
|
|k�r8|�	|
�||
=q�t||�j�rR|�	|
�q�|�	|
�q�|j�dt|j
��|�|j|dd	�|�|j
t|���dd	�|�|j|dd	�dS)
NrRr7�%s
rSrrr@��P)r;r<�__doc__rrr�nohelprH�sort�append�
doc_leader�print_topics�
doc_header�misc_headerrW�keys�undoc_header)rr5r=�doc�namesZcmds_docZ
cmds_undoc�help�nameZprevnamer4rrr�do_help$sN



zCmd.do_helpcCs\|rX|j�dt|��|jr<|j�dt|jt|���|�||d�|j�d�dS)NrYrr)rrr�rulerr"�	columnize)r�headerZcmdsZcmdlenZmaxcolrrrraRszCmd.print_topicsr[cs��s|j�d�dS�fdd�tt���D�}|rJtdd�tt|����t��}|dkrv|j�dt�d��dStdt���D]�}||d|}g}d	}t|�D]h}	d}
t|�D]2}|||	}||kr�q�|}
t|
t|
��}
q�|�	|
�||
d
7}||kr��qq�||kr��q4q�t��}d}dg}t|�D]�}g}t|�D]4}	|||	}||k�rld}
n�|}
|�	|
��qL|�r�|d�s�|d=�q�tt|��D]}	||	�
||	�||	<�q�|j�dtd
�|����q<dS)Nz<empty>
csg|]}t�|t�s|�qSr)�
isinstancer)rDr2�rWrrrGds�z!Cmd.columnize.<locals>.<listcomp>z list[i] not a string for i in %sz, rrYr����r���z  )rr�ranger"�	TypeError�join�mapr�maxr_�ljust)rrWZdisplaywidthZ
nonstrings�sizeZnrowsZncolsZ	colwidthsZtotwidth�colZcolwidth�rowr2�xZtextsrrorrlZs\�


z
Cmd.columnize)rNN)N)r[)"�__name__�
__module__�__qualname__�PROMPTr�
IDENTCHARSr1rkr:rr`rbrcrer]rrr*r$r&rr'r6r%r8r9r?rJrrHrXrjrarlrrrrr4s:

4
		.)�stringr
�__all__r�Z
ascii_lettersZdigitsr�rrrrr�<module>-s

Zerion Mini Shell 1.0