o
    ¼­§iń"  ć                   @   sL   d dl mZ d dlmZ G dd deZG dd deZG dd deZd	S )
é    )ŚShapeDocumenter)Ś
py_defaultc                   @   s   e Zd Z	dddZdd Z	dddZ	ddd	Z	dd
dZ	dddZ	dddZ	dd Z
dddZdddZdd ZdS )ŚBaseExampleDocumenterNc                 C   sV   g }|j  ”  |j  ”  |dur| |” | j|||||d | d”}|j  ”  dS )a]  Generates an example based on a shape

        :param section: The section to write the documentation to.

        :param shape: The shape of the operation.

        :param prefix: Anything to be included before the example

        :type include: Dictionary where keys are parameter names and
            values are the shapes of the parameter names.
        :param include: The parameter shapes to include in the documentation.

        :type exclude: List of the names of the parameters to exclude.
        :param exclude: The names of the parameters to exclude from
            documentation.
        N)ŚsectionŚshapeŚhistoryŚincludeŚexcludezfinal-blank-line)ŚstyleŚnew_lineZstart_codeblockŚwriteŚtraverse_and_document_shapeŚadd_new_section)Śselfr   r   Śprefixr   r	   r   Zfinal_blank_line_section© r   śL/home/app/Keep/.python/lib/python3.10/site-packages/botocore/docs/example.pyŚdocument_example   s   


ū
z&BaseExampleDocumenter.document_examplec                 K   s   |  d” d S )Nz{'... recursive ...'})r   )r   r   r   Śkwargsr   r   r   Śdocument_recursive_shape4   s   z.BaseExampleDocumenter.document_recursive_shapec                 K   s>   |   |”}|d u rt|j}| j d”|krd}| |” d S )NZstreaming_shapezStreamingBody())Z_get_special_py_defaultr   Ś	type_nameŚ_contextŚgetr   )r   r   r   r   r   r	   r   Zpy_typer   r   r   Śdocument_shape_default7   s   

z,BaseExampleDocumenter.document_shape_defaultc           	      K   sj   d|j v r,t|j d D ]\}}| d| d” |t|j d d k r)| d” qd S |  |||” d S )NŚenumś'é   ś|)ŚmetadataŚ	enumerater   Ślenr   )	r   r   r   r   r   r	   r   Śir   r   r   r   Śdocument_shape_type_stringB   s   

żz0BaseExampleDocumenter.document_shape_type_stringc                 K   sn   |j }| d”}|  |d” |jdd|jid}	| j|	||d | d”}
|
 d” | d	”}|  |d
” d S )Nz
list-valueś[Śmemberr   ©Ścontext©r   r   r   śending-commaś,śending-bracketś])r$   r   Ś_start_nested_paramŚnamer   r   Ś_end_nested_param)r   r   r   r   r   r	   r   Śparam_shapeZlist_sectionŚparam_sectionŚending_comma_sectionZending_bracket_sectionr   r   r   Śdocument_shape_type_listM   s   

’’


z.BaseExampleDocumenter.document_shape_type_listc                 K   sā   |j s
| d” d S | d”}|  |d” |  |j |”}t|D ]G\}}	|r+|	|v r+q | |	”}
|
 d|	 d” ||	 }|
jdd|jid}| j||||	d	 |t|d
 k rg|
 d”}| d” |j	 
”  q |  |dd” d S )Nz{}śstructure-valueŚ{r   z': śmember-valuer   r%   ©r   r   r   r-   r   r(   r)   Ś})Śmembersr   r   r,   Ś_add_members_to_shaper   r-   r   r    r
   r   Ś_end_structure)r   r   r   r   r   r	   r   Śinput_membersr!   Śparamr0   r/   Śparam_value_sectionr1   r   r   r   Śdocument_shape_type_structure^   s:   



’ü’

z3BaseExampleDocumenter.document_shape_type_structurec                 K   sz   |  d”}|  |d” |j}|j dd|jjid}	|	 d” |j dd|jid}
| j|
||d |  d	”}|  |d
” d S )Nz	map-valuer4   Śkeyr   r%   z
'string': Śvaluer'   r*   r7   )r   r,   r@   r?   r-   r   r   r.   )r   r   r   r   r   r	   r   Zmap_sectionZvalue_shapeZkey_sectionZvalue_sectionŚend_bracket_sectionr   r   r   Śdocument_shape_type_map   s   
’

’’
z-BaseExampleDocumenter.document_shape_type_mapc                 C   s$   |r|  ” }|D ]}|||j< q|S ©N)Ścopyr-   )r   r8   r   r<   r   r   r   r9      s
   z+BaseExampleDocumenter._add_members_to_shapec                 C   s4   |d ur	|  |” |j ”  |j ”  |j ”  d S rC   )r   r
   Śindentr   )r   r   Śstartr   r   r   r,      s
   


z)BaseExampleDocumenter._start_nested_paramc                 C   s8   |j  ”  |j  ”  |j  ”  |d ur| |” d S d S rC   )r
   Śdedentr   r   )r   r   Śendr   r   r   r.   ¢   s   


’z'BaseExampleDocumenter._end_nested_paramc                 C   sD   |j s| ”  | || ” |  |” d S | d”}|  ||” d S )Nr*   )Zavailable_sectionsZ
clear_textr   r.   r   )r   r   rF   rH   rA   r   r   r   r:   ©   s   
z$BaseExampleDocumenter._end_structure)NNN©NNrC   )Ś__name__Ś
__module__Ś__qualname__r   r   r   r"   r2   r>   rB   r9   r,   r.   r:   r   r   r   r   r      s$    
’"
’
’
’
’$
’

r   c                   @   s   e Zd ZdZdd ZdS )ŚResponseExampleDocumenterzresponse-examplec                 K   s8   |  d” | j|||fi |¤ | d”}|  d” d S )NzEventStream(zevent-stream-endś))r   r>   r   )r   r   r   r   r   Śend_sectionr   r   r   Ś document_shape_type_event_stream¹   s   

z:ResponseExampleDocumenter.document_shape_type_event_streamN)rJ   rK   rL   Ś
EVENT_NAMErP   r   r   r   r   rM   ¶   s    rM   c                   @   s   e Zd ZdZ	dddZdS )ŚRequestExampleDocumenterzrequest-exampleNc                 K   s   d}d}d}	d}
t |dkrd}d}	d}
d	}| d
”}|  ||	” |  |j|”}t|D ]J\}}|r7||v r7q,| |”}| || ” | |” || }|jdd|jid}| j||||d |t |d k rv| d”}| d” |j	 
”  q,|  ||	|
” d S )Nz'%s'z: r4   r7   r   ś=ś(rN   z%sr3   r5   r   r%   r6   r(   r)   )r    r   r,   r9   r8   r   r   r-   r   r
   r   r:   )r   r   r   r   r   r	   r   Zparam_formatŚoperatorrF   rH   r;   r!   r<   r0   r/   r=   r1   r   r   r   r>   Å   sH   



’ü’

z6RequestExampleDocumenter.document_shape_type_structurerI   )rJ   rK   rL   rQ   r>   r   r   r   r   rR   Ā   s    ’rR   N)Zbotocore.docs.shaper   Zbotocore.docs.utilsr   r   rM   rR   r   r   r   r   Ś<module>   s    &