Your IP : 3.145.32.238


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/cmd.cpython-310.opt-2.pyc

o

6��f:�@s>	ddlZddlZdgZdZejejdZGdd�d�ZdS)�N�Cmdz(Cmd) �_c@s�eZdZ	eZeZdZdZdZ	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��tabcCsB	|dur	||_ntj|_|dur||_ntj|_g|_||_dS�N)�stdin�sys�stdout�cmdqueue�completekey)�selfr
r	r�r�*/opt/alt/python310/lib64/python3.10/cmd.py�__init__Ls

zCmd.__init__cCs�	|��|jr.|jr.zddl}|��|_|�|j�|�|jd�Wn	t	y-Ynwz�|dur6||_
|j
rD|j�t
|j
�d�d}|s�|jrR|j�d�}n3|jrhzt|j�}Wn(tygd}Ynw|j�|j�|j��|j��}t|�s�d}n|�d�}|�|�}|�|�}|�||�}|rH|��W|jr�|jr�z
ddl}|�|j�WdSt	y�YdSwdSdS|jr�|jr�zddl}|�|j�Wwt	y�Ywwww)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�cmdloopbsh
��




�
����zCmd.cmdloopcC�	|Srr�rr)rrrr$��z
Cmd.precmdcCr+rr)rr(r)rrrr&��zCmd.postcmdcC�	dSrr�rrrrr�r.zCmd.preloopcCr/rrr0rrrr'�r-zCmd.postloopcCs�	|��}|sdd|fS|ddkrd|dd�}n|ddkr4t|d�r/d|dd�}ndd|fSdt|�}}||krU|||jvrU|d}||krU|||jvsF|d|�||d���}}|||fS)Nr�?zhelp r�!Zdo_shellzshell )�strip�hasattrr"�
identchars)rr)�i�n�cmd�argrrr�	parseline�s


4
z
Cmd.parselinecCs�	|�|�\}}}|s|��S|dur|�|�S||_|dkr"d|_|dkr+|�|�Szt|d|�}W||�StyE|�|�YSw)Nrr�do_)r:�	emptyline�default�lastcmd�getattr�AttributeError)rr)r8r9�funcrrrr%�s"	

��z
Cmd.onecmdcCs	|jr
|�|j�SdSr)r>r%r0rrrr<�s�z
Cmd.emptylinecCs	|j�d|�dS)Nz*** Unknown syntax: %s
)rrr,rrrr=�szCmd.defaultcGs	gSrr)r�ignoredrrr�completedefault�szCmd.completedefaultcsd|��fdd�|��D�S)Nr;cs"g|]
}|���r|dd��qS)�N��
startswith��.0�a�Zdotextrr�
<listcomp>�s"z%Cmd.completenames.<locals>.<listcomp>)�	get_names)r�textrBrrJr�
completenames�szCmd.completenamesc
Cs�	|dkrZddl}|��}|��}t|�t|�}|��|}|��|}|dkrO|�|�\}	}
}|	dkr9|j}nz	t|d|	�}Wnt	yN|j}Ynw|j
}|||||�|_z|j|WStyjYdSw)NrrZ	complete_)
rZget_line_buffer�lstripr"Z
get_begidxZ
get_endidxr:rCr?r@rNZcompletion_matches�
IndexError)
rrM�staterZorigliner)�strippedZbegidxZendidxr8�argsZfooZcompfuncrrrr�s0
��zCmd.completecCs
t|j�Sr)�dir�	__class__r0rrrrLs
z
Cmd.get_namescs4t|j���}t�fdd�|��D��}t||B�S)Nc3s.�|]}|�d�d�r|dd�VqdS)�help_r�NrErG�rSrr�	<genexpr> s��z$Cmd.complete_help.<locals>.<genexpr>)�setrNrL�list)rrSZcommandsZtopicsrrXr�
complete_helpszCmd.complete_helpcCs�	|rNz	t|d|�}Wn<tyHzt|d|�j}|r,|j�dt|��WYdSWn	ty6Ynw|j�dt|j|f��YdSw|�dS|��}g}g}i}|D]}|dd�dkrld||dd�<qZ|��d}	|D]5}|dd�dkr�||	kr�qu|}	|dd�}
|
|vr�|�	|
�||
=qut||�jr�|�	|
�qu|�	|
�qu|j�dt|j
��|�|j|dd	�|�|j
t|���dd	�|�|j|dd	�dS)
NrVr;�%s
rWrrrD��P)r?r@�__doc__rrr�nohelprL�sort�append�
doc_leader�print_topics�
doc_header�misc_headerr[�keys�undoc_header)rr9rA�doc�namesZcmds_docZ
cmds_undoc�help�nameZprevnamer8rrr�do_help$sZ���

�

�zCmd.do_helpcCs`|r.|j�dt|��|jr|j�dt|jt|���|�||d�|j�d�dSdS)Nr]rr)rrr�rulerr"�	columnize)r�headerZcmdsZcmdlenZmaxcolrrrreRs�zCmd.print_topicsr_cs�	�s|j�d�dS�fdd�tt���D�}|r&tdd�tt|����t��}|dkr<|j�dt�d��dStdt���D]L}||d|}g}d	}t|�D]3}	d}
t|�D]}|||	}||krkn�|}
t|
t|
��}
q]|�	|
�||
d
7}||kr�nqU||kr�n
qCt��}d}dg}t|�D]Q}g}t|�D]}	|||	}||kr�d}
n�|}
|�	|
�q�|r�|ds�|d=|r�|dr�tt|��D]
}	||	�
||	�||	<q�|j�dtd
�|���q�dS)Nz<empty>
csg|]}t�|t�s|�qSr)�
isinstancer)rHr6�r[rrrKds
�z!Cmd.columnize.<locals>.<listcomp>z list[i] not a string for i in %sz, rr]r����r���z  )rr�ranger"�	TypeError�join�mapr�maxrc�ljust)rr[ZdisplaywidthZ
nonstrings�sizeZnrowsZncolsZ	colwidthsZtotwidth�colZcolwidth�rowr6�xZtextsrrsrrpZsf�
����z
Cmd.columnize)rNNr)r_)"�__name__�
__module__�__qualname__�PROMPTr�
IDENTCHARSr5ror>rrdrfrgrirarrr*r$r&rr'r:r%r<r=rCrNrrLr\rnrerprrrrr4s>

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

?>