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/bcdoc/__pycache__/restdoc.cpython-312.pyc
�

P��e�%����ddlZddlZddlZddlmZddlmZddlmZdZ	ejd�ZdZejd�Zd	d
d�dd
d�dd
d�dd
d�d�Zdddd�ZGd�d�ZGd�de�Zy)�N)�OrderedDict)�DocStringParser)�	ReSTStylez&https://docs.aws.amazon.com/index.htmlzX`AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/[a-z0-9-.]*/[a-zA-Z]*>`_z�

    **{}**
    ::

        # This section is too large to render.
        # Please see the AWS API Documentation linked below.

    {}
    �bcdocszResponse Syntaxi�)�name�
line_limitzResponse Structurei�zRequest Syntax�
Parameters)zresponse-example�descriptionzrequest-examplezrequest-params��)z
client-apiz
paginator-apiz
waiter-apic�V�eZdZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zy
)�ReSTDocumentc��t|�|_||_t|�|_d|_d|_i|_i|_g|_	d|_
y)NTF)r�style�targetr�parser�	keep_data�do_translation�translation_map�hrefs�_writes�_last_doc_string)�selfrs  �=/usr/lib/python3/dist-packages/botocore/docs/bcdoc/restdoc.py�__init__zReSTDocument.__init__3sM���t�_��
����%�d�+������#���!�����
���� $���c�Z�|jr|�|jj|�yyy�N)rr�append�r�ss  r�_writezReSTDocument._write>s&���>�>�a�m��L�L����"�,�>rc�&�|j|�y)z2
        Write content into the document.
        N)r"�r�contents  r�writezReSTDocument.writeBs��	
���G�rc�`�|j|jj��|�d��y)z-
        Write content on a newline.
        �
N)r"r�spacesr$s  r�writelnzReSTDocument.writelnHs)��	
���t�z�z�(�(�*�+�G�9�B�7�8rc� �|jdS)zn
        Returns the last content written to the document without
        removing it from the stack.
        ����r�rs r�
peek_writezReSTDocument.peek_writeNs��
�|�|�B��rc�j�t|j�dkDr|jj�SdS)zL
        Removes and returns the last content written to the stack.
        rN)�lenr�popr.s r�	pop_writezReSTDocument.pop_writeUs,��&)����%6��%:�t�|�|���!�D��Drc�:�|jj|�y)z2
        Places new content on the stack.
        N)rrr s  r�
push_writezReSTDocument.push_write[s��	
�����A�rc��|jrX|jj�|jj�D]!\}}|jj	||��#dj|j�jd�S)zJ
        Returns the current content of the document as a string.
        ��utf-8)rr�
new_paragraph�items�link_target_definition�joinr�encode)r�refname�links   r�getvaluezReSTDocument.getvalueaso���:�:��J�J�$�$�&�!%���!1�!1�!3�
A�
����
�
�1�1�'�4�@�
A��w�w�t�|�|�$�+�+�G�4�4rc�`�|D�cgc]}|jj||��� c}Scc}wr)r�get)r�words�ws   r�translate_wordszReSTDocument.translate_wordsks)��8=�>�1��$�$�(�(��A�.�>�>��>s�#+c�F�|r|jr|j|�yyyr)rr")r�datas  r�handle_datazReSTDocument.handle_datans���D�N�N��K�K���#�4rc�R�|rj	t|j�}|jj|�|jj	�t|j�}||f|_yy#t$r/tjdd��tj|�YywxYw)NzError parsing doc stringT)�exc_info)	r1rr�feed�closer�	Exception�LOG�debug)r�
doc_string�start�ends    r�include_doc_stringzReSTDocument.include_doc_stringrs����
&��D�L�L�)����� � ��,����!�!�#��$�,�,�'��).����%�
���
&��	�	�4�t�	�D��	�	�*�%�
&�s�A(A.�.5B&�%B&c�Z�|j�|j\}}|j||�=yyr)rr)rrQrRs   r�remove_last_doc_stringz#ReSTDocument.remove_last_doc_string~s2��� � �,��.�.�J�E�3����U�3�Y�'�-rN)�man)�__name__�
__module__�__qualname__rr"r&r*r/r3r5r@rErHrSrU�rrrr2s?��	%�#��9� �E��5�?��
&�(rrc����eZdZd�fd�	Zed��Zed��Zejd��Zed��Zed��Z	d�Z
dd�Zd	�Zd
�Z
dd�Zd�Zd
�Zd�Zd�Zd�Z�xZS)�DocumentStructurec���t�|�|��||_t�|_|jg|_i|_|�||_|�|j|�yy)a5Provides a Hierarichial structure to a ReSTDocument

        You can write to it similiar to as you can to a ReSTDocument but
        has an innate structure for more orginaztion and abstraction.

        :param name: The name of the document
        :param section_names: A list of sections to be included
            in the document.
        :param target: The target documentation of the Document structure
        :param context: A dictionary of data to store with the strucuture. These
            are only stored per section not the entire structure.
        )rN)�superr�_namer�
_structure�_path�_context�_generate_structure)rr�
section_namesr�context�	__class__s     �rrzDocumentStructure.__init__�s_���	�����'���
�%�-����j�j�\��
���
���#�D�M��$��$�$�]�3�%rc��|jS)z"The name of the document structure)r_r.s rrzDocumentStructure.name�s���z�z�rc��|jS)zv
        A list of where to find a particular document structure in the
        overlying document structure.
        �rar.s r�pathzDocumentStructure.path�s���z�z�rc��||_yrri)r�values  rrjzDocumentStructure.path�s	����
rc�,�t|j�Sr)�listr`r.s r�available_sectionsz$DocumentStructure.available_sections�s���D�O�O�$�$rc��|jSr)rbr.s rrezDocumentStructure.context�s���}�}�rc�4�|D]}|j|��yr)�add_new_section)rrd�section_names   rrcz%DocumentStructure._generate_structure�s��)�	/�L�� � ��.�	/rc��|j||j|��}|j|gz|_|jj|j_|j
|_|j|_||j|<|S)a�Adds a new section to the current document structure

        This document structure will be considered a section to the
        current document structure but will in itself be an entirely
        new document structure that can be written to and have sections
        as well

        :param name: The name of the section.
        :param context: A dictionary of data to store with the strucuture. These
            are only stored per section not the entire structure.
        :rtype: DocumentStructure
        :returns: A new document structure to add to but lives as a section
            to the document structure it was instantiated from.
        )rrre)rfrrjr�indentationrrr`)rrre�sections    rrrz!DocumentStructure.add_new_section�sx�� �.�.��d�k�k�7�!�
���y�y�D�6�)���$(�J�J�$:�$:��
�
�!�"&�"6�"6����
�
��
� '�������rc� �|j|S)zRetrieve a section�r`�rrs  r�get_sectionzDocumentStructure.get_section�s�����t�$�$rc��|j|=y)zDelete a sectionNrxrys  r�delete_sectionz DocumentStructure.delete_section�s���O�O�D�!rc�r�t|j�}|dk(re|jr�|jj	�|jj�D]!\}}|jj
||��#n'|tj|jd�k(rd}|j�}|jj�D]b\}}tj|j��}|r"|jd��d�j�n|}||j!|�z
}�dt|j#��}	t$j|j&�}
|�|j�nt(}|
r/|	|
dkDr't*j-|
d|�j�}|S)z�Flushes a doc structure to a ReSTructed string

        The document is flushed out in a DFS style where sections and their
        subsections' values are added to the string as they are visited.
        �Nrz

rr)r1rjrrr9r:r;�SECTION_METHOD_PATH_DEPTHrBr@r`�DOCUMENTATION_LINK_REGEX�search�decode�groupr=�flush_structure�
splitlines�SECTION_LINE_LIMIT_CONFIGr�DEFAULT_AWS_DOCS_LINK�LARGE_SECTION_MESSAGE�format)r�	docs_link�path_lengthr>r?rlrrv�match�
line_count�section_config�
aws_docs_links            rr�z!DocumentStructure.flush_structure�s����$�)�)�n���!���z�z��
�
�(�(�*�%)�Z�Z�%5�%5�%7�E�M�G�T��J�J�5�5�g�t�D�E��5�9�9�$�)�)�A�,�G�
G��I��
�
���!�_�_�2�2�4�	8�M�D�'�-�3�3�E�L�L�N�C�E�49�5�;�;�q�>�"�$�'�.�.�0�y�
�
�W�,�,�Y�7�7�E�	8���)�)�+�,�
�2�6�6�t�y�y�A���$�
����&�	�
�j�>�,�+G�G�)�0�0��v�&�
���f�h�
��rc�V�dj|j�jd�S)Nr7r8)r<rr=r.s rr@zDocumentStructure.getvalues ���w�w�t�|�|�$�+�+�G�4�4rc�"�t�|_yr)rr`r.s r�remove_all_sectionsz%DocumentStructure.remove_all_sections
s��%�-��rc��g|_yrr-r.s r�
clear_textzDocumentStructure.clear_text
s	����rc�^�|jd�}|jj|�|S)N�title)rrr�h1)rr��
title_sections   r�add_title_sectionz#DocumentStructure.add_title_sections,���,�,�W�5�
������u�%��rc�2�tjj|�stj|�tjj	||�d��}t|d�5}|j
|j��ddd�y#1swYyxYw)Nz.rst�wb)�osrj�exists�makedirsr<�openr&r�)r�	full_path�	file_name�sub_resource_file_path�fs     r�
write_to_filezDocumentStructure.write_to_filesq���w�w�~�~�i�(��K�K�	�"�!#�����i�I�;�d�9K�!L��
�(�$�
/�	,�1�
�G�G�D�(�(�*�+�	,�	,�	,�s�$ B
�
B)NrVNr)rWrXrYr�propertyrrj�setterrorercrrrzr|r�r@r�r�r�r��
__classcell__)rfs@rr\r\�s����4�.��������
�[�[�����%��%�����/��6%�"�(�T5�(���
,rr\)�loggingr��re�botocore.compatr�#botocore.docs.bcdoc.docstringparserr�botocore.docs.bcdoc.stylerr��compiler�r��	getLoggerrNr�rrr\rZrr�<module>r�s����	�	�'�?�/�@��%�2�:�:�I���	���g����!��!2�$�G�0��E� 0��E�+�4�@�	�������P(�P(�fU,��U,r