HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //proc/self/root/usr/lib/python3.6/site-packages/awscli/__pycache__/help.cpython-36.opt-1.pyc
3

�T_5�@s�ddlZddlZddlZddlZddlZddlmZmZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZej d�Z!Gdd�de"�Z#dd�Z$Gdd�de%�Z&Gdd�de&�Z'Gdd�de&�Z(Gdd�de%�Z)Gdd�de)�Z*Gd d!�d!e)�Z+Gd"d#�d#e)�Z,Gd$d%�d%e)�Z-Gd&d'�d'e)�Z.dS)(�N)�Popen�PIPE)�publish_string)�manpage)�ProviderDocumentEventHandler)�ServiceDocumentEventHandler)�OperationDocumentEventHandler)�TopicListerDocumentEventHandler)�TopicDocumentEventHandler)�	docevents)�ReSTDocument)�
TextWriter)�ParamShorthandParser)�ArgTableArgParser)�
TopicTagDB)�
ignore_ctrl_czawscli.helpcseZdZ�fdd�Z�ZS)�ExecutableNotFoundErrorcstt|�jd|�dS)Nz$Could not find executable named "%s")�superr�__init__)�selfZexecutable_name)�	__class__��/usr/lib/python3.6/help.pyr)s
z ExecutableNotFoundError.__init__)�__name__�
__module__�__qualname__r�
__classcell__rr)rrr(srcCstj�dkrt�St�SdS)zZ
    Return the appropriate HelpRenderer implementation for the
    current platform.
    ZWindowsN)�platform�system�WindowsHelpRenderer�PosixHelpRendererrrrr�get_renderer.sr!c@sJeZdZdZejfdd�ZdZdd�Zdd�Z	d	d
�Z
dd�Zd
d�ZdS)�PagingHelpRendererz�
    Interface for a help renderer.

    The renderer is responsible for displaying the help content on
    a particular platform.

    cCs
||_dS)N)�
output_stream)rr#rrrrAszPagingHelpRenderer.__init__NcCs:|j}dtjkrtjd}ndtjkr0tjd}tj|�S)NZMANPAGER�PAGER)r$�os�environ�shlex�split)rZpagerrrr�get_pager_cmdlineFs


z$PagingHelpRenderer.get_pager_cmdlinecCs|j|�}|j|�dS)z`
        Each implementation of HelpRenderer must implement this
        render method.
        N)�_convert_doc_content�_send_output_to_pager)r�contentsZconverted_contentrrr�renderNs
zPagingHelpRenderer.rendercCs2|j�}tjd|�|j|td�}|j|d�dS)NzRunning command: %s)�stdin)�input)r)�LOG�debug�_popenr�communicate)r�output�cmdline�prrrr+Vsz(PagingHelpRenderer._send_output_to_pagercOs
t||�S)N)r)r�args�kwargsrrrr2\szPagingHelpRenderer._popencCs|S)Nr)rr,rrrr*_sz'PagingHelpRenderer._convert_doc_content)
rrr�__doc__�sys�stdoutrr$r)r-r+r2r*rrrrr"9sr"c@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
r z[
    Render help content on a Posix-like system.  This includes
    Linux and MacOS X.
    zless -RcCsbt|tj�d�}|jd�s"td��dddddg}tjd|�|j|tttd�}|j	|d	�d
}|S)N)�writerZgroffz-m�manz-T�asciizRunning command: %s)r.r;�stderr)r/r)
rr�Writer�_exists_on_pathrr0r1r2rr3)rr,Zman_contentsr5Zp3Zgroff_outputrrrr*ks
z&PosixHelpRenderer._convert_doc_contentcCs�|j�}|j|d�sLtjd|d�|jj|jd�d�|jj�dStjd|�t�� |j	|t
d�}|j|d�WdQRXdS)Nrz0Pager '%s' not found in PATH, printing raw help.zutf-8�
zRunning command: %s)r.)r/)r)rAr0r1r#�write�decode�flushrr2rr3)rr4r5r6rrrr+us
z'PosixHelpRenderer._send_output_to_pagercs(t�fdd�tjjdd�jtj�D��S)Ncs"g|]}tjjtjj|����qSr)r%�path�exists�join)�.0r6)�namerr�
<listcomp>�sz5PosixHelpRenderer._exists_on_path.<locals>.<listcomp>�PATH�)�anyr%r&�getr(�pathsep)rrJr)rJrrA�sz!PosixHelpRenderer._exists_on_pathN)rrrr9r$r*r+rArrrrr cs

r c@s$eZdZdZdZdd�Zdd�ZdS)rz*Render help content on a Windows platform.ZmorecCst|t�d�}|S)N)r<)rr
)rr,Ztext_outputrrrr*�s
z(WindowsHelpRenderer._convert_doc_contentcOsd|d<t||�S)NT�shell)r)rr7r8rrrr2�szWindowsHelpRenderer._popenN)rrrr9r$r*r2rrrrr�src@sTeZdZdZdZdd�Zedd��Zedd��Zed	d
��Z	edd��Z
d
d�ZdS)�HelpCommandak
    HelpCommand Interface
    ---------------------
    A HelpCommand object acts as the interface between objects in the
    CLI (e.g. Providers, Services, Operations, etc.) and the documentation
    system (bcdoc).

    A HelpCommand object wraps the object from the CLI space and provides
    a consistent interface to critical information needed by the
    documentation pipeline such as the object's name, description, etc.

    The HelpCommand object is passed to the component of the
    documentation pipeline that fires documentation events.  It is
    then passed on to each document event handler that has registered
    for the events.

    All HelpCommand objects contain the following attributes:

        + ``session`` - A ``botocore`` ``Session`` object.
        + ``obj`` - The object that is being documented.
        + ``command_table`` - A dict mapping command names to
              callable objects.
        + ``arg_table`` - A dict mapping argument names to callable objects.
        + ``doc`` - A ``Document`` object that is used to collect the
              generated documentation.

    In addition, please note the `properties` defined below which are
    required to allow the object to be used in the document pipeline.

    Implementations of HelpCommand are provided here for Provider,
    Service and Operation objects.  Other implementations for other
    types of objects might be needed for customization in plugins.
    As long as the implementations conform to this basic interface
    it should be possible to pass them to the documentation system
    and generate interactive and static help files.
    NcCsT||_||_|dkri}||_|dkr*i}||_i|_g|_t�|_tdd�|_	dS)Nr=)�target)
�session�obj�
command_table�	arg_table�_subcommand_table�_related_itemsr!�rendererr�doc)rrTrUrVrWrrrr�szHelpCommand.__init__cCsdS)aX
        Return the ``event_class`` for this object.

        The ``event_class`` is used by the documentation pipeline
        when generating documentation events.  For the event below::

            doc-title.<event_class>.<name>

        The document pipeline would use this property to determine
        the ``event_class`` value.
        Nr)rrrr�event_class�s
zHelpCommand.event_classcCsdS)z�
        Return the name of the wrapped object.

        This would be called by the document pipeline to determine
        the ``name`` to be inserted into the event, as shown above.
        Nr)rrrrrJ�szHelpCommand.namecCs|jS)z=These are the commands that may follow after the help command)rX)rrrr�subcommand_table�szHelpCommand.subcommand_tablecCs|jS)z:This is list of items that are related to the help command)rY)rrrr�
related_items�szHelpCommand.related_itemscCsv|r@ti|j�}|j|�\}}t|dd�dk	r@|j|j||�S|j|�}tj|j|�|j	j
|jj��|j
�dS)N�
subcommand)rr]Zparse_known_args�getattrr_�EventHandlerClassrZgenerate_eventsrTrZr-r[�getvalueZ
unregister)rr7Zparsed_globalsZsubcommand_parserZparsedZ	remaining�instancerrr�__call__s
zHelpCommand.__call__)rrrr9rar�propertyr\rJr]r^rdrrrrrR�s$
rRc@sHeZdZdZeZdd�Zedd��Zedd��Z	edd	��Z
d
d�ZdS)
�ProviderHelpCommandz^Implements top level help command.

    This is what is called when ``aws help`` is run.

    cCs<tj||d||�||_||_||_d|_d|_dg|_dS)Nzaws help topics)rRr�description�synopsisZ
help_usagerX�
_topic_tag_dbrY)rrTrVrWrgrhZusagerrrrs
zProviderHelpCommand.__init__cCsdS)N�awsr)rrrrr\'szProviderHelpCommand.event_classcCsdS)Nrjr)rrrrrJ+szProviderHelpCommand.namecCs6|jdkr0|jdkrt�|_|jj�|j�|_|jS)N)rXrirZload_json_index�_create_subcommand_table)rrrrr]/s



z$ProviderHelpCommand.subcommand_tablecCsFi}t|j�}||d<|jj�}x |D]}t|j|�}|||<q&W|S)N�topics)�TopicListerCommandrTriZget_all_topic_names�TopicHelpCommand)rr]Ztopic_lister_commandZtopic_names�
topic_nameZtopic_help_commandrrrrk8s


z,ProviderHelpCommand._create_subcommand_tableN)rrrr9rrarrer\rJr]rkrrrrrfs	rfcs<eZdZdZeZ�fdd�Zedd��Zedd��Z	�Z
S)�ServiceHelpCommandz�Implements service level help.

    This is the object invoked whenever a service command
    help is implemented, e.g. ``aws ec2 help``.

    cs&tt|�j||||�||_||_dS)N)rrpr�_name�_event_class)rrTrUrVrWrJr\)rrrrPszServiceHelpCommand.__init__cCs|jS)N)rr)rrrrr\WszServiceHelpCommand.event_classcCs|jS)N)rq)rrrrrJ[szServiceHelpCommand.name)rrrr9rrarrer\rJrrr)rrrpFs
rpc@s4eZdZdZeZdd�Zedd��Zedd��Z	dS)	�OperationHelpCommandz�Implements operation level help.

    This is the object invoked whenever help for a service is requested,
    e.g. ``aws ec2 describe-instances help``.

    cCs*tj|||d|�t�|_||_||_dS)N)rRrrZparam_shorthandrqrr)rrTZoperation_modelrWrJr\rrrriszOperationHelpCommand.__init__cCs|jS)N)rr)rrrrr\psz OperationHelpCommand.event_classcCs|jS)N)rq)rrrrrJtszOperationHelpCommand.nameN)
rrrr9rrarrer\rJrrrrrs`s
rscs8eZdZeZ�fdd�Zedd��Zedd��Z�Z	S)rmcstt|�j|dii�dS)N)rrmr)rrT)rrrr|szTopicListerCommand.__init__cCsdS)Nrlr)rrrrr\szTopicListerCommand.event_classcCsdS)Nrlr)rrrrrJ�szTopicListerCommand.name)
rrrr	rarrer\rJrrr)rrrmysrmcs8eZdZeZ�fdd�Zedd��Zedd��Z�Z	S)rncs tt|�j|dii�||_dS)N)rrnr�_topic_name)rrTro)rrrr�szTopicHelpCommand.__init__cCs
d|jS)Nztopics.)rJ)rrrrr\�szTopicHelpCommand.event_classcCs|jS)N)rt)rrrrrJ�szTopicHelpCommand.name)
rrrr
rarrer\rJrrr)rrrn�srn)/Zloggingr%r:rr'�
subprocessrrZ
docutils.corerZdocutils.writersrZawscli.clidocsrrrr	r
Zawscli.bcdocrZawscli.bcdoc.restdocrZawscli.bcdoc.textwriterr
Zawscli.argprocessrZawscli.argparserrZawscli.topictagsrZawscli.utilsrZ	getLoggerr0�	Exceptionrr!�objectr"r rrRrfrprsrmrnrrrr�<module>
s>
*1o2