o
    :_Wct"  ć                   @   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   sB   g }|j  ”  |j  ”  |dur| |” | j|||||d 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Śexclude)ŚstyleŚnew_lineZstart_codeblockŚwriteŚtraverse_and_document_shape)Śselfr   r   Śprefixr   r	   r   © r   ś7D:\Flask\env\Lib\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_shape2   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_default5   s   

z,BaseExampleDocumenter.document_shape_defaultc           	      K   sf   d|j v r*t|j d D ]\}}| d| ” |t|j d d k r'| d” qd S |  |||” d S )NŚenumś'%s'é   ś|)ŚmetadataŚ	enumerater   Ślenr   )	r   r   r   r   r   r	   r   Śir   r   r   r   Śdocument_shape_type_string@   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#   Śadd_new_sectionŚ_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_listK   s   

’’


z.BaseExampleDocumenter.document_shape_type_listc                 K   sŽ   |j s
| d” d S | d”}|  |d” |  |j |”}t|D ]E\}}	|r+|	|v r+q | |	”}
|
 d|	 ” ||	 }|
jdd|jid}| j||||	d |t|d	 k re|
 d
”}| d” |j	 
”  q |  |dd” d S )Nz{}śstructure-valueŚ{z'%s': ś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 )Nr   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    $