HEX
Server: nginx/1.24.0
System: Linux webserver 6.8.0-85-generic #85-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 18 15:26:59 UTC 2025 x86_64
User: wpuser (1002)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/botocore/docs/__pycache__/sharedexample.cpython-312.pyc
�

P��e�#��F�ddlZddlZddlmZddlmZGd�d�Zd�Zy)�N)�escape_controls)�parse_timestampc�^�eZdZd�Zd�Zd�Zd�Z	dd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zy)�SharedExampleDocumenterc�"�|jj�|j|jd��|jj	�|j||||j�|j|||j�y)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_input�input_shape�document_output�output_shape)�self�example�prefix�section�operation_models     �=/usr/lib/python3/dist-packages/botocore/docs/sharedexample.py�document_shared_examplez/SharedExampleDocumenter.document_shared_examplesp��	�
�
�#�#�%��
�
�g�k�k�-�0�1��
�
��� �����W�f�o�&A�&A�	
�	
���W�g��/K�/K�L�c��|jd�}|jj�|�|j|�|j	di�}|j	d�}|r|j	d�}|jd�}|j|||g|�|jd�}	|	jj
�|	jj
�|	jd�|	jj�y)N�input�comments�
parameterszinput-closezprint(response))�add_new_sectionr	�start_codeblockrr�_document_paramsr
�
end_codeblock)
rrrr�shape�
input_section�paramsr�
param_section�closing_sections
          rrz&SharedExampleDocumenter.document_input*s����/�/��8�
����+�+�-�������'����W�b�)���;�;�z�*����|�|�G�,�H�%�5�5�l�C�
����m�V�X�r�5�I�'�7�7�
�F�����&�&�(����&�&�(����/�0����+�+�-rc���|jd�}|jj�|jd�|jj�|jj	�|jdi�}ddi|d<|jd�}|r|jd�}|j
|||g|d�|jd�}|jj�y)N�outputzExpected Output:z...�ResponseMetadatarTzoutput-close)rr	r
rrr�_document_dictr!)rrrr"�output_sectionr$rr&s        rrz'SharedExampleDocumenter.document_output;s��� �0�0��:�����%�%�'����/�0����%�%�'����,�,�.����X�r�*��',�U�^��!�"��;�;�z�*����|�|�H�-�H����N�F�H�b�%��N�(�8�8��H�����+�+�-rc�h�t|t�r|j|||||�yt|t�r|j	|||||�yt|t
j�r|j|||�y|r#|jdk(r|j|||�y|j|||�y)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)rr�valuer�pathr"s      r�	_documentz!SharedExampleDocumenter._documentLs����e�T�"�������$��F�
��t�
$�������$��F�
��w�~�~�
.��!�!�'�5�$�7�
�u���+�5��#�#�G�U�D�9����w��t�4rc���|jd�}|j|d�|j�D�]\}}	|jd|z�|j|�}
|
jj�|j
||�}|r+|
j|�|
jj�|
jd|z�d}|rF|jdk(r|jj|�}n|jdk(r|j}|j|
|	|||�|j���
|jd�}
|j|
d�|s|
jd	�yy)
Nz
dict-value�{�.%sz'%s': �	structure�mapzending-brace�}�,)r�_start_nested_value�items�appendr	r
�_get_commentrr5�membersrr8r:�pop�_end_nested_value)rrr8rr9r"�	top_level�dict_section�key�val�item_section�item_comment�
item_shape�dict_section_ends              rr*z&SharedExampleDocumenter._document_dictesL���.�.�|�<��� � ��s�3����
�	�H�C���K�K����$�'�7�7��<�L����'�'�)��,�,�T�8�<�L���"�"�<�0��"�"�+�+�-����x�#�~�.��J���?�?�k�1�!&���!2�!2�3�!7�J��_�_��-�!&���J��N�N�<��h��j�I��H�H�J�%	�&(�7�7��G�����/��5���"�"�3�'�rc�l�|jd�}|j|d�|j�D]�\}}|jd|z�|j|�}	|	jj�|j
||�}
|
r+|	j|
�|	jj�|	j|dz�d}|r|jj|�}|j|	||||�|j���|jd�}|j|d�y)Nzparam-values�(r=�=zending-parenthesis�))
rrBrCrDr	r
rErrFrr:rGrH)
rrr8rr9r"r%rKrLrMrNrO�param_section_ends
             rr z(SharedExampleDocumenter._document_params�s���/�/��?�
�� � ���4����
�	�H�C���K�K����$�(�8�8��=�L����'�'�)��,�,�T�8�<�L���"�"�<�0��"�"�+�+�-����s�S�y�)��J��"�]�]�.�.�s�3�
��N�N�<��h��j�I��H�H�J�	� *�9�9�:N�O�����0�#�6rc��|jd�}|j|d�|j}t|�D]�\}}	|j|�}
|
jj�|j
d|z�|j||�}|r+|
j|�|
jj�|j|
|	|||�|j���|jd�}|j|d�y)Nzlist-section�[z[%s]zending-bracketz],)rrB�member�	enumerater	r
rDrErr:rGrH)
rrr8rr9r"�list_sectionrO�indexrLrMrN�list_section_ends
             rr1z&SharedExampleDocumenter._document_list�s����.�.�~�>��� � ��s�3��\�\�
�#�E�*�		�J�E�3�'�7�7��>�L����'�'�)��K�K����'��,�,�T�8�<�L���"�"�<�0��"�"�+�+�-��N�N�<��h��j�I��H�H�J�		�(�7�7�8H�I�����/��6rc�D�t|�}|jd|�d��y)N�'z',)rr)rrr8r9�
safe_values     rr7z%SharedExampleDocumenter._document_str�s#��%�U�+�
��
�
��*��R�(�)rc�>�|jdt|�z�y)Nz%s,)r�str)rrr8r9s    rr4z(SharedExampleDocumenter._document_number�s���
�
�e�c�%�j�(�)rc���t|�j�}t|d�}tdt	|��D]}|dt||�zz
}�|jd|z�y)Nr�z, z
datetime(%s),)r�	timetuplera�range�lenr)rrr8r9�datetime_tuple�datetime_str�is       rr6z*SharedExampleDocumenter._document_datetime�si��(��/�9�9�;���>�!�,�-���q�#�n�-�.�	:�A��D�3�~�a�'8�#9�9�9�L�	:��
�
�o��4�5rc�l�tjdddj|��}|r||vrd||zSy)Nz^\.�z# )�re�sub�join)rr9rrKs    rrEz$SharedExampleDocumenter._get_comment�s7���f�f�V�R������/����x���(�3�-�'�'�rc��|j|�|jj�|jj�y�N)rr	�indent)rr�starts   rrBz+SharedExampleDocumenter._start_nested_value�s.���
�
�e���
�
�����
�
���rc���|jj�|jj�|jj�|j|�yrp)r	�dedentr
r)rr�ends   rrHz)SharedExampleDocumenter._end_nested_value�s>���
�
�����
�
�����
�
��� ��
�
�c�rN)F)�__name__�
__module__�__qualname__rrrr:r*r r1r7r4r6rErBrH�rrrrsK��M�*.�".�"5�4@E�(�:7�,7�"*�*�6���
rrc��|jd�}|jj�|jjd�t	�}|D])}|j||j|d�||���+y)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-examples�Examples�id)rrrrN)rr	r
�boldrr)rr�example_prefix�shared_examples�container_section�
documenterrs       r�document_shared_examplesr��s��� �/�/�0A�B�����)�)�+���� � ��,�(�*�J�"�
���*�*��%�5�5�g�d�m�D�!�+�		+�	
�
r)r2rl�botocore.docs.utilsr�botocore.utilsrrr�ryrr�<module>r�s%���	�/�*�u�u�p
r