Yohohohohohooho | Sanrei Aya
Sanrei Aya


Server : LiteSpeed
System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : elvh3918 ( 1528)
PHP Version : 8.2.31
Disable Function : mail
Directory :  /usr/local/lib/python3.9/site-packages/click_repl/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/lib/python3.9/site-packages/click_repl/__pycache__/utils.cpython-39.pyc
a

��Sh��@s�ddlZddlZddlZddlZddlmZddlmZmZgd�Z	ej
dkr`ddlmZm
Z
nddlmZm
Z
d!dd	�ZiZd"dd�Zd#d
d�Zd$dd�Zdd�Zdd�Zegd�ed�egd�ed�d%dd�Zdd�Zdd�Zdd �ZdS)&�N)�defaultdict�)�CommandLineParserError�ExitReplException)
�_execute_internal_and_sys_cmds�_exit_internal�_get_registered_target�_help_internal�_resolve_context�_register_internal_command�dispatch_repl_commands�handle_internal_commands�split_arg_string�exit)�r)�Iterable�MappingcCs�|r�|j}t|tj�r�|jsZ|�||�\}}}|dur:|S|j|||dd�}|j|j}q�|r�|�||�\}}}|dur||S|j|||dddd�}|j}qZ|}g|j�|j�}qq�q|S)a;Produce the context hierarchy starting with the command and
    traversing the complete arguments. This only follows the commands,
    it doesn't trigger input prompts or callbacks.

    :param args: List of complete args before the incomplete value.
    :param cli_ctx: `click.Context` object of the CLI group
    NT)�parent�resilient_parsingF)rZallow_extra_args�allow_interspersed_argsr)	�command�
isinstance�clickZMultiCommand�chainZresolve_commandZmake_contextZprotected_args�args)r�ctxr�name�cmdZsub_ctx�r�:/usr/local/lib/python3.9/site-packages/click_repl/utils.pyr
 s4	�r
TcCsZtj||d�}d|_d|_g}z|D]}|�|�q$WntyT|�|j�Yn0|S)a�Split an argument string as with :func:`shlex.split`, but don't
    fail if the string is incomplete. Ignores a missing closing quote or
    incomplete escape sequence and uses the partial token as-is.
    .. code-block:: python
        split_arg_string("example 'my file")
        ["example", "my file"]
        split_arg_string("example my\")
        ["example", "my"]
    :param string: String to split.
    )�posixT�)�shlex�whitespace_split�
commenters�append�
ValueError�token)�stringr �lex�outr'rrrrQsrcCsft|d�std��t|t�r$|g}n(t|t�s8t|t�sLtd�t|�j���|D]}||ft	|<qPdS)N�__call__z#Internal command must be a callablez="names" must be a string, or an iterable object, but got "{}")
�hasattrr&r�strrr�format�type�__name__�_internal_commands)�names�target�descriptionrrrrrns

��rcCst�|�}|r|dS|S)Nr)r1�get)r�default�target_inforrrr�s
rcCs
t��dS)N)rrrrrr�srcCs�t��}|�d�|��|�d��|�d�Wd�n1sD0Y|�d��^|�d�tt�}t�	�D]\}}||d�
|�qt|�dd�|�	�D��Wd�n1s�0Y|��}|S)	Nz	REPL helpzExternal Commandsz!prefix external commands with "!"zInternal Commandsz!prefix internal commands with ":"rcss,|]$\}}d�tdjt|���|fVqdS)z, z:{}N)�join�mapr.�sorted)�.0r4Z	mnemonicsrrr�	<genexpr>�s��z!_help_internal.<locals>.<genexpr>)
r�
HelpFormatterZ
write_heading�indent�section�
write_textr�listr1�itemsr%Zwrite_dl�getvalue)�	formatterZ
info_tableZmnemonicr7�valrrrr	�s
(

�&r	)�q�quitrzexits the repl)�?�h�helpz!displays general help informationc
Csv|rt|�rdS|r4t|�}t|t�r4t�|�dSz
t|�WStyp}ztd�	|���WYd}~n
d}~00dS)z_
    Executes internal, system, and all the other registered click commands from the input
    Nz{})
rr
rr-rZechorr&rr.)rZallow_internal_commandsZallow_system_commands�result�errrr�s


rcCs
t�dS)z
Exit the replN)rrrrrr�srcCs$|�d�r t�|dd��dSdS)zo
    Execute system commands entered in the repl.

    System commands are all commands starting with "!".
    �!rNTF)�
startswith�os�system)rrrrr�s
rcCs,|�d�r(t|dd�dd�}|r(|�SdS)ze
    Run repl-internal commands.

    Repl-internal commands are all commands starting with ":".
    �:rN)r6)rNr)rr3rrrr
�s
r
)N)T)N)N)TT)rrOr"�sys�collectionsr�
exceptionsrr�__all__�version_info�collections.abcrrr
r1rrrrr	rrrr
rrrr�<module>s4

.



��


Yohohohohohooho | Sanrei Aya