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: //lib/python3.6/site-packages/botocore/docs/bcdoc/__pycache__/restdoc.cpython-36.pyc
3

�T_:�@sZddlZddlmZddlmZddlmZejd�ZGdd�de	�Z
Gdd	�d	e
�ZdS)
�N)�OrderedDict)�DocStringParser)�	ReSTStyleZbcdocsc@sneZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�ReSTDocument�mancCsBt|�|_||_t|�|_d|_d|_i|_i|_g|_	d|_
dS)NTF)r�style�targetr�parser�	keep_dataZdo_translation�translation_map�hrefs�_writes�_last_doc_string)�selfr�r�/usr/lib/python3.6/restdoc.py�__init__s

zReSTDocument.__init__cCs|jr|dk	r|jj|�dS)N)r
r
�append)r�srrr�_write#szReSTDocument._writecCs|j|�dS)z2
        Write content into the document.
        N)r)r�contentrrr�write'szReSTDocument.writecCs|jd|jj�|f�dS)z-
        Write content on a newline.
        z%s%s
N)rrZspaces)rrrrr�writeln-szReSTDocument.writelncCs
|jdS)zn
        Returns the last content written to the document without
        removing it from the stack.
        ����)r
)rrrr�
peek_write3szReSTDocument.peek_writecCs
|jj�S)zL
        Removes and returns the last content written to the stack.
        )r
�pop)rrrr�	pop_write:szReSTDocument.pop_writecCs|jj|�dS)z2
        Places new content on the stack.
        N)r
r)rrrrr�
push_write@szReSTDocument.push_writecCsH|jr6|jj�x$|jj�D]\}}|jj||�qWdj|j�jd�S)zJ
        Returns the current content of the document as a string.
        �zutf-8)rr�
new_paragraph�items�link_target_definition�joinr
�encode)r�refname�linkrrr�getvalueFs

zReSTDocument.getvaluecs�fdd�|D�S)Ncsg|]}�jj||��qSr)r�get)�.0�w)rrr�
<listcomp>Qsz0ReSTDocument.translate_words.<locals>.<listcomp>r)rZwordsr)rr�translate_wordsPszReSTDocument.translate_wordscCs|r|jr|j|�dS)N)r
r)r�datarrr�handle_dataSs
zReSTDocument.handle_datacCsn|rjy8t|j�}|jj|�|jj�t|j�}||f|_Wn,tk
rhtjddd�tj|�YnXdS)NzError parsing doc stringT)�exc_info)	�lenr
r	Zfeed�closer�	Exception�LOG�debug)rZ
doc_string�start�endrrr�include_doc_stringWs


zReSTDocument.include_doc_stringcCs$|jdk	r |j\}}|j||�=dS)N)rr
)rr5r6rrr�remove_last_doc_stringcs

z#ReSTDocument.remove_last_doc_stringN)r)�__name__�
__module__�__qualname__rrrrrrrr'r,r.r7r8rrrrrs

rcs�eZdZd�fdd�	Zedd��Zedd��Zejd	d��Zed
d��Zedd
��Z	dd�Z
ddd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Z�ZS) �DocumentStructureNrcsTtt|�j|d�||_t�|_|jg|_i|_|dk	r>||_|dk	rP|j|�dS)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<r�_namer�
_structure�_path�_context�_generate_structure)r�name�
section_namesr�context)�	__class__rrrks

zDocumentStructure.__init__cCs|jS)z"The name of the document structure)r>)rrrrrC�szDocumentStructure.namecCs|jS)zv
        A list of where to find a particular document structure in the
        overlying document structure.
        )r@)rrrr�path�szDocumentStructure.pathcCs
||_dS)N)r@)r�valuerrrrG�scCs
t|j�S)N)�listr?)rrrr�available_sections�sz$DocumentStructure.available_sectionscCs|jS)N)rA)rrrrrE�szDocumentStructure.contextcCsx|D]}|j|�qWdS)N)�add_new_section)rrDZsection_namerrrrB�s
z%DocumentStructure._generate_structurecCsJ|j||j|d�}|j|g|_|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.
        )rCrrE)rFrrGrZindentationrrr?)rrCrE�sectionrrrrK�s

z!DocumentStructure.add_new_sectioncCs
|j|S)zRetrieve a section)r?)rrCrrr�get_section�szDocumentStructure.get_sectioncCs|j|=dS)zDelete a sectionN)r?)rrCrrr�delete_section�sz DocumentStructure.delete_sectioncCstt|j�dkrD|jrD|jj�x$|jj�D]\}}|jj||�q*W|j�}x"|jj�D]\}}||j	�7}qXW|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.
        r)
r0rGrrr r!r"r'r?�flush_structure)rr%r&rHrCrLrrrrO�s
z!DocumentStructure.flush_structurecCsdj|j�jd�S)Nrzutf-8)r#r
r$)rrrrr'�szDocumentStructure.getvaluecCst�|_dS)N)rr?)rrrr�remove_all_sections�sz%DocumentStructure.remove_all_sectionscCs
g|_dS)N)r
)rrrr�
clear_text�szDocumentStructure.clear_text)NrN)N)r9r:r;r�propertyrCrG�setterrJrErBrKrMrNrOr'rPrQ�
__classcell__rr)rFrr<js
r<)ZloggingZbotocore.compatrZ#botocore.docs.bcdoc.docstringparserrZbotocore.docs.bcdoc.stylerZ	getLoggerr3�objectrr<rrrr�<module>
s
T