HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/site-packages/botocore/docs/__pycache__/sharedexample.cpython-38.pyc
U

KD�g�#�@sBddlZddlZddlmZddlmZGdd�d�Zdd�ZdS)�N)�escape_controls)�parse_timestampc@sveZdZdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�SharedExampleDocumentercCsJ|j��|�|�d��|j��|�||||j�|�|||j�dS)a8Documents a single shared example based on its definition.

        :param example: The model of the example

        :param prefix: The prefix to use in the method example.

        :param section: The section to write to.

        :param operation_model: The model of the operation used in the example
        �descriptionN)	�style�
new_paragraph�write�get�new_line�document_inputZinput_shape�document_outputZoutput_shape)�self�example�prefix�section�operation_model�r�H/opt/cppython/lib/python3.8/site-packages/botocore/docs/sharedexample.py�document_shared_examples

�z/SharedExampleDocumenter.document_shared_examplec
Cs�|�d�}|j��|dk	r&|�|�|�di�}|�d�}|rJ|�d�}|�d�}|�|||g|�|�d�}	|	j��|	j��|	�d�|	j��dS)N�input�comments�
parameterszinput-closezprint(response))�add_new_sectionr�start_codeblockrr	�_document_paramsr
�
end_codeblock)
r
rrr�shapeZ
input_section�paramsr�
param_section�closing_sectionrrrr*s









z&SharedExampleDocumenter.document_inputcCs�|�d�}|j��|�d�|j��|j��|�di�}ddi|d<|�d�}|rb|�d�}|�|||g|d�|�d�}|j��dS)N�outputzExpected Output:z...ZResponseMetadatarTzoutput-close)rrr
rrr	�_document_dictr)r
rrrZoutput_sectionrrrrrrr;s







z'SharedExampleDocumenter.document_outputcCs�t|t�r|�|||||�nft|t�r<|�|||||�nHt|tj�rX|�|||�n,|rv|jdkrv|�	|||�n|�
|||�dS)a
        :param section: The section to add the docs to.

        :param value: The input / output values representing the parameters that
                      are included in the example.

        :param comments: The dictionary containing all the comments to be
                         applied to the example.

        :param path: A list describing where the documenter is in traversing the
                     parameters. This is used to find the equivalent location
                     in the comments dictionary.
        �	timestampN)�
isinstance�dictr!�list�_document_list�numbers�Number�_document_number�	type_name�_document_datetime�
_document_str)r
r�valuer�pathrrrr�	_documentLs

z!SharedExampleDocumenter._documentFcCs�|�d�}|�|d�|��D]�\}}	|�d|���|�|�}
|
j��|�||�}|rn|
�|�|
j��|
�d|�d��d}|r�|jdkr�|j	�
|�}n|jdkr�|j}|�|
|	|||�|�
�q|�d�}
|�|
d	�|s�|
�d
�dS)Nz
dict-value�{�.�'z': Z	structure�mapzending-brace�}�,)r�_start_nested_value�items�appendrr
�_get_commentrr*�membersr	r-r/�pop�_end_nested_value)r
rr-rr.rZ	top_levelZdict_section�key�val�item_section�item_comment�
item_shapeZdict_section_endrrrr!es.








z&SharedExampleDocumenter._document_dictc
Cs�|�d�}|�|d�|��D]�\}}|�d|���|�|�}	|	j��|�||�}
|
rn|	�|
�|	j��|	�|d�d}|r�|j�	|�}|�
|	||||�|��q|�d�}|�|d�dS)Nzparam-values�(r1�=zending-parenthesis�))
rr6r7r8rr
r9rr:r	r/r;r<)
r
rr-rr.rrr=r>r?r@rAZparam_section_endrrrr�s$






z(SharedExampleDocumenter._document_paramsc
Cs�|�d�}|�|d�|j}t|�D]l\}}	|�|�}
|
j��|�d|�d��|�||�}|rv|
�|�|
j��|�	|
|	|||�|�
�q$|�d�}|�|d�dS)Nzlist-section�[�]zending-bracketz],)rr6�member�	enumeraterr
r8r9rr/r;r<)
r
rr-rr.rZlist_sectionrA�indexr>r?r@Zlist_section_endrrrr&�s






z&SharedExampleDocumenter._document_listcCst|�}|�d|�d��dS)Nr2z',)rr)r
rr-r.Z
safe_valuerrrr,�sz%SharedExampleDocumenter._document_strcCs|�t|��d��dS)Nr5)r�str)r
rr-r.rrrr)�sz(SharedExampleDocumenter._document_numbercCsVt|���}t|d�}tdt|��D]}|dt||�7}q&|�d|�d��dS)Nr�z, z	datetime(z),)r�	timetuplerJ�range�lenr)r
rr-r.Zdatetime_tupleZdatetime_str�irrrr+�s
z*SharedExampleDocumenter._document_datetimecCs4t�ddd�|��}|r,||kr,d||SdSdS)Nz^\.�z# )�re�sub�join)r
r.rr=rrrr9�sz$SharedExampleDocumenter._get_commentcCs"|�|�|j��|j��dS�N)rr�indent)r
r�startrrrr6�s

z+SharedExampleDocumenter._start_nested_valuecCs,|j��|j��|j��|�|�dSrT)r�dedentr
r)r
r�endrrrr<�s


z)SharedExampleDocumenter._end_nested_valueN)F)�__name__�
__module__�__qualname__rrrr/r!rr&r,r)r+r9r6r<rrrrrs�
rcCsP|�d�}|j��|j�d�t�}|D] }|j||�|d�||d�q*dS)aDocuments the shared examples

    :param section: The section to write to.

    :param operation_model: The model of the operation.

    :param example_prefix: The prefix to use in the method example.

    :param shared_examples: The shared JSON examples from the model.
    zshared-examplesZExamples�id)rrrrN)rrr�boldrr)rrZexample_prefixZshared_examplesZcontainer_sectionZ
documenterrrrr�document_shared_examples�s

�r^)r'rQZbotocore.docs.utilsrZbotocore.utilsrrr^rrrr�<module>
s9