
     h+&                         d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ dZ	 ej                  d      ZdZ e j                  d      Zd	d
dddddd
dddddZddddZ G d d      Z G d de      Zy)    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.

    {}
    bcdocszResponse Syntaxi  )name
line_limitzResponse Structurei  zRequest Syntax
Parameters)zresponse-exampledescriptionzrequest-examplezrequest-params      )z
client-apizpaginator-apiz
waiter-apic                   V    e Zd ZddZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zy)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)selfr   s     w/home/developers/rajanand/mypropertyqr-fmb-refixing-v2/venv/lib/python3.12/site-packages/botocore/docs/bcdoc/restdoc.py__init__zReSTDocument.__init__3   sM    t_
%d+#!
 $    c                 Z    | j                   r|| j                  j                  |       y y y N)r   r   appendr   ss     r   _writezReSTDocument._write>   s&    >>amLL" ,>r   c                 &    | j                  |       y)z2
        Write content into the document.
        N)r"   r   contents     r   writezReSTDocument.writeB   s     	Gr   c                 `    | j                  | j                  j                          | d       y)z-
        Write content on a newline.
        
N)r"   r   spacesr$   s     r   writelnzReSTDocument.writelnH   s)     	tzz((*+G9B78r   c                      | j                   d   S )zn
        Returns the last content written to the document without
        removing it from the stack.
        r   r   s    r   
peek_writezReSTDocument.peek_writeN   s    
 ||Br   c                 j    t        | j                        dkD  r| j                  j                         S dS )zL
        Removes and returns the last content written to the stack.
        r   N)lenr   popr.   s    r   	pop_writezReSTDocument.pop_writeU   s,     &)%6%:t||!DDr   c                 :    | j                   j                  |       y)z2
        Places new content on the stack.
        N)r   r   r    s     r   
push_writezReSTDocument.push_write[   s     	Ar   c                    | j                   rX| j                  j                          | j                   j                         D ]!  \  }}| j                  j	                  ||       # dj                  | j                        j                  d      S )zJ
        Returns the current content of the document as a string.
         utf-8)r   r   new_paragraphitemslink_target_definitionjoinr   encode)r   refnamelinks      r   getvaluezReSTDocument.getvaluea   so     ::JJ$$&!%!1!1!3 A

11'4@Awwt||$++G44r   c                 `    |D cg c]  }| j                   j                  ||        c}S c c}w r   )r   get)r   wordsws      r   translate_wordszReSTDocument.translate_wordsk   s)    8=>1$$((A.>>>s   #+c                 F    |r| j                   r| j                  |       y y y r   )r   r"   )r   datas     r   handle_datazReSTDocument.handle_datan   s    DNNKK #4r   c                 R   |rj	 t        | j                        }| j                  j                  |       | j                  j	                          t        | j                        }||f| _        y y # t        $ r/ t        j                  dd       t        j                  |       Y y w xY w)NzError parsing doc stringT)exc_info)	r1   r   r   feedcloser   	ExceptionLOGdebug)r   
doc_stringstartends       r   include_doc_stringzReSTDocument.include_doc_stringr   s    &DLL)  ,!!#$,,').%   &		4t	D		*%&s   A(A. .5B&%B&c                 Z    | j                   | j                   \  }}| j                  ||= y y r   )r   r   )r   rQ   rR   s      r   remove_last_doc_stringz#ReSTDocument.remove_last_doc_string~   s2      ,..JE3U3Y' -r   N)man)__name__
__module____qualname__r   r"   r&   r*   r/   r3   r5   r@   rE   rH   rS   rU    r   r   r   r   2   s?    	%#9 E5?
&(r   r   c                        e Zd Zd fd	Zed        Zed        Zej                  d        Zed        Zed        Z	d Z
ddZd	 Zd
 Zd ZddZd Zd Zd Zd Zd Z xZS )DocumentStructurec                     t         |   |       || _        t               | _        | j                  g| _        i | _        ||| _        || j                  |       yy)a5  Provides 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.
        )r   N)superr   _namer   
_structure_path_context_generate_structure)r   r   section_namesr   context	__class__s        r   r   zDocumentStructure.__init__   s_     	'
%-jj\
#DM$$$]3 %r   c                     | j                   S )z"The name of the document structure)r_   r.   s    r   r   zDocumentStructure.name   s     zzr   c                     | j                   S )zv
        A list of where to find a particular document structure in the
        overlying document structure.
        ra   r.   s    r   pathzDocumentStructure.path   s     zzr   c                     || _         y r   ri   )r   values     r   rj   zDocumentStructure.path   s	    
r   c                 ,    t        | j                        S r   )listr`   r.   s    r   available_sectionsz$DocumentStructure.available_sections   s    DOO$$r   c                     | j                   S r   )rb   r.   s    r   re   zDocumentStructure.context   s    }}r   c                 4    |D ]  }| j                  |        y r   )add_new_section)r   rd   section_names      r   rc   z%DocumentStructure._generate_structure   s    ) 	/L  .	/r   c                    | j                  || j                  |      }| j                  |gz   |_        | j                  j                  |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.
        )r   r   re   )rf   r   rj   r   indentationr   r   r`   )r   r   re   sections       r   rr   z!DocumentStructure.add_new_section   sx      ..dkk7 ! 
 yyD6)$(JJ$:$:!"&"6"6

 'r   c                      | j                   |   S )zRetrieve a sectionr`   r   r   s     r   get_sectionzDocumentStructure.get_section   s    t$$r   c                     || j                   v S r   rx   ry   s     r   has_sectionzDocumentStructure.has_section   s    t&&r   c                     | j                   |= y)zDelete a sectionNrx   ry   s     r   delete_sectionz DocumentStructure.delete_section   s    OOD!r   c                 r   t        | j                        }|dk(  re| j                  r| j                  j	                          | j                  j                         D ]!  \  }}| j                  j                  ||       # n'|t        j                  | j                  d         k(  rd}| j                         }| j                  j                         D ]b  \  }}t        j                  |j                               }|r"|j                  d       dj                         n|}||j!                  |      z  }d t        |j#                               }	t$        j                  | j&                        }
||j                         nt(        }|
r/|	|
d   kD  r't*        j-                  |
d   |      j                         }|S )zFlushes 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.
           Nr   z

r   r   )r1   rj   r   r   r9   r:   r;   SECTION_METHOD_PATH_DEPTHrB   r@   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?   rl   r   rv   match
line_countsection_configaws_docs_links               r   r   z!DocumentStructure.flush_structure   s    $))n!zz

((*%)ZZ%5%5%7 EMGTJJ55gtDE 599$))A,GGI!__224 	8MD' -33ELLNCE495;;q>"$'..0y  W,,Y77E	8 ))+,
266tyyA $ & 	
 j>,+GG)00v&fh  r   c                 V    dj                  | j                        j                  d      S )Nr7   r8   )r<   r   r=   r.   s    r   r@   zDocumentStructure.getvalue
  s     wwt||$++G44r   c                 "    t               | _        y r   )r   r`   r.   s    r   remove_all_sectionsz%DocumentStructure.remove_all_sections  s    %-r   c                     g | _         y r   r-   r.   s    r   
clear_textzDocumentStructure.clear_text  s	    r   c                 ^    | j                  d      }|j                  j                  |       |S )Ntitle)rr   r   h1)r   r   title_sections      r   add_title_sectionz#DocumentStructure.add_title_section  s,    ,,W5u%r   c                 2   t         j                  j                  |      st        j                  |       t         j                  j	                  || d      }t        |d      5 }|j                  | j                                d d d        y # 1 sw Y   y xY w)Nz.rstwb)osrj   existsmakedirsr<   openr&   r   )r   	full_path	file_namesub_resource_file_pathfs        r   write_to_filezDocumentStructure.write_to_file  sq    ww~~i(KK	"!#iI;d9K!L($/ 	,1GGD((*+	, 	, 	,s   $ BB)NrV   Nr   )rW   rX   rY   r   propertyr   rj   setterro   re   rc   rr   rz   r|   r~   r   r@   r   r   r   r   __classcell__)rf   s   @r   r\   r\      s    4.     
[[  % %  /6%'"(T5(
,r   r\   )loggingr   rebotocore.compatr   #botocore.docs.bcdoc.docstringparserr   botocore.docs.bcdoc.styler   r   compiler   r   	getLoggerrN   r   r   r   r\   rZ   r   r   <module>r      s     	 	 ' ? /@ %2::I 	  g!!2$G0E 0E+4@	   P( P(fX, X,r   