U
    ÷EZhę-  ć                   @   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_type_namec                   @   sn   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 Z	dd Z
dd Zdd Zdd ZdS )ŚBaseParamsDocumenterNc                 C   s   g }| j |||d||d dS )a3  Fills out the documentation for a section given a model shape.

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

        :param shape: The shape of the operation.

        :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ŚnameŚincludeŚexclude)Śtraverse_and_document_shape)Śselfr   r   r	   r
   r   © r   ś[/home/aprabhat/apps/x.techxrdev.in/venv/lib/python3.8/site-packages/botocore/docs/params.pyŚdocument_params   s    śz$BaseParamsDocumenter.document_paramsc                 K   s   | j ||f| d S ©N©Ś_add_member_documentation©r   r   r   Śkwargsr   r   r   Śdocument_recursive_shape+   s    z-BaseParamsDocumenter.document_recursive_shapec                 K   s   | j ||f| d S r   r   )r   r   r   r   r	   r
   r   r   r   r   Śdocument_shape_default.   s    z+BaseParamsDocumenter.document_shape_defaultc           	      K   sb   | j ||f| |j}|j|jd|jjid}|  |” | j|||d d | d”}|  |” d S )Nr   ©Ścontext©r   r   r   r   zend-list)r   ŚmemberŚadd_new_sectionr   Ś_start_nested_paramr   Ś_end_nested_param)	r   r   r   r   r	   r
   r   Śparam_shapeŚparam_sectionr   r   r   Śdocument_shape_type_list3   s     
’
ü
z-BaseParamsDocumenter.document_shape_type_listc           
      K   s¢   | j ||f| |jdd|jjid}|  |” |   ||j” |j|jjd|jjid}|j ”  |  |” | j||j|d d | d”}	|  	|	” |  	|	” d S )NŚkeyr   r   r   zend-map)
r   r   r!   r   r   ŚvalueŚstyleŚindentr   r   )
r   r   r   r   r	   r
   r   Zkey_sectionr   Śend_sectionr   r   r   Śdocument_shape_type_mapE   s,     
’
 
’

ü

z,BaseParamsDocumenter.document_shape_type_mapc                 K   s   |   |j|”}| j|||d |D ]J}	|r4|	|kr4q"||	 }
|j|	d|
jid}|  |” | j||
||	d q"| d”}|  |” d S )N)r   r   r   r   śend-structure)Ś_add_members_to_shapeŚmembersr   r   r   r   r   r   )r   r   r   r   r	   r
   r   r   r)   Śparamr   r   r   r   r   Śdocument_shape_type_structure`   s&    
 ’
ü
z2BaseParamsDocumenter.document_shape_type_structurec                 K   s   d S r   r   r   r   r   r   r   }   s    z.BaseParamsDocumenter._add_member_documentationc                 C   s$   |r |  ” }|D ]}|||j< q|S r   )Ścopyr   )r   r)   r	   r*   r   r   r   r(      s
    z*BaseParamsDocumenter._add_members_to_shapec                 C   sN   |   |”}t|j}d}|d k	r0| || ” n|j || ” | d” d S )Nz(%s) --ś )Ś_get_special_py_type_namer   Ś	type_nameŚwriter#   Zitalics)r   Śtype_sectionr   Zspecial_py_typeŚpy_typeZtype_formatr   r   r   Ś"_document_non_top_level_param_type   s    

z7BaseParamsDocumenter._document_non_top_level_param_typec                 C   s   |j  ”  |j  ”  d S r   )r#   r$   Śnew_line©r   r   r   r   r   r      s    
z(BaseParamsDocumenter._start_nested_paramc                 C   s   |j  ”  |j  ”  d S r   )r#   Śdedentr4   r5   r   r   r   r      s    
z&BaseParamsDocumenter._end_nested_param)NN)NN)NN)NN)NNN)Ś__name__Ś
__module__Ś__qualname__r   r   r   r    r&   r+   r   r(   r3   r   r   r   r   r   r   r      s(   
   ’
   ’
   ’
    ł
r   c                   @   s&   e Zd ZdZdZdddZdd ZdS )	ŚResponseParamsDocumenterz5Generates the description for the response parameterszresponse-paramsNc                 K   sŚ   |  d”}| d” |d k	r4|j | ” | d” |  d”}|  ||” |  d”}|jrĢ|j ”  t|ddrĄ|  d”}d	}	d
 dd |j	 
” D ”}
d}| |	|
 ” |  d”}|j |” | |j” |j ”  d S )Nś
param-nameś- r-   ś
param-typeśparam-documentationŚis_tagged_unionFśparam-tagged-union-docsaK  .. note::    This is a Tagged Union structure. Only one of the     following top level keys will be set: %s.     If a client receives an unknown member it will     set ``SDK_UNKNOWN_MEMBER`` as the top level key,     which maps to the name or tag of the unknown     member. The structure of ``SDK_UNKNOWN_MEMBER`` is     as followsś, c                 S   s   g | ]}d | d qS ©z``r   ©Ś.0r!   r   r   r   Ś
<listcomp>½   s     zFResponseParamsDocumenter._add_member_documentation.<locals>.<listcomp>z3'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}zparam-unknown-example)r   r0   r#   Śboldr3   Śdocumentationr$   ŚgetattrŚjoinr)   ŚkeysZ	codeblockŚinclude_doc_stringŚnew_paragraph)r   r   r   r   r   Śname_sectionr1   Śdocumentation_sectionŚtagged_union_docsŚnoteŚtagged_union_members_strZunknown_code_exampleŚexampler   r   r   r   ¢   s4    





’’
’’
z2ResponseParamsDocumenter._add_member_documentationc                 K   s   | j |||f| d S r   )r+   )r   r   r   r   r   r   r   r   Ś document_shape_type_event_streamÉ   s    z9ResponseParamsDocumenter.document_shape_type_event_stream)N)r7   r8   r9   Ś__doc__Ś
EVENT_NAMEr   rS   r   r   r   r   r:      s   
'r:   c                   @   s8   e Zd ZdZdZdddZdddZd	d
 Zdd ZdS )ŚRequestParamsDocumenterz4Generates the description for the request parameterszrequest-paramsNc                 K   sĘ   t |dkr&| j||f| |j ”  |  |j|”}t|D ]Z\}}	|rR|	|krRq<||	 }
|j|	d|
jid}|j 	”  |	|j
k}| j||
||	|d q<| d”}t |dkrø|j ”  |j 	”  d S )Né   r   r   )r   r   r   r   Śis_requiredr'   )Ślenr   r#   r$   r(   r)   Ś	enumerater   r   r4   Zrequired_membersr   r6   )r   r   r   r   r	   r
   r   r)   Śir*   r   r   rX   r   r   r   r+   Ō   s2    
 ’

ū

z5RequestParamsDocumenter.document_shape_type_structureFc                 K   sz  |   |”}|d krt|j}|rr| d”}| d| d| ” | d”}	|	j ”  | d”}
|
 d| d” nJ| d”}
|
 d” |d k	r¦|
j | ” |
 d” | d”}|  ||” |rź| d	”}|j 	”  |j d
” | d” |j
rb| d”}|j 	”  t|ddrJ| d”}d}d dd |j ” D ”}| || ” | |j
” |  ||” | d”}|j ”  d S )Nr=   z:type z: zend-param-typer;   z:param r<   r-   zis-requiredz
[REQUIRED]r>   r?   Fr@   zl.. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: %s. rA   c                 S   s   g | ]}d | d qS rB   r   rC   r   r   r   rE   !  s     zERequestParamsDocumenter._add_member_documentation.<locals>.<listcomp>z	end-param)r.   r   r/   r   r0   r#   r4   rF   r3   r$   rG   rH   rI   r)   rJ   rK   Ś _add_special_trait_documentationrL   )r   r   r   r   Zis_top_level_paramrX   r   r2   r1   Zend_type_sectionrM   Zis_required_sectionrN   rO   rP   rQ   Zend_param_sectionr   r   r   r   š   sR    	












’
’’’
z1RequestParamsDocumenter._add_member_documentationc                 C   s   d|j kr|  |” d S )NZidempotencyToken)ŚmetadataŚ!_append_idempotency_documentation)r   r   r   r   r   r   r\   )  s    
z8RequestParamsDocumenter._add_special_trait_documentationc                 C   s   d}|  |” d S )Nz,This field is autopopulated if not provided.)r0   )r   r   Z	docstringr   r   r   r^   -  s    z9RequestParamsDocumenter._append_idempotency_documentation)NN)NFF)	r7   r8   r9   rT   rU   r+   r   r\   r^   r   r   r   r   rV   Ļ   s      ’
    ś
9rV   N)Zbotocore.docs.shaper   Zbotocore.docs.utilsr   r   r:   rV   r   r   r   r   Ś<module>   s
    2