a
    ݌xd-                     @   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   L/var/www/html/Ranjet/env/lib/python3.9/site-packages/botocore/docs/params.pydocument_params   s    z$BaseParamsDocumenter.document_paramsc                 K   s   | j ||fi | 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i | d S r   r   )r   r   r   r   r	   r
   r   r   r   r   document_shape_default.   s    z+BaseParamsDocumenter.document_shape_defaultc           	      K   sf   | j ||fi | |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i | |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|	|v 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 u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 ur6|jd|  |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- %sr-   
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 | qS z``%s``r   .0r!   r   r   r   
<listcomp>       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_exampleZexampler   r   r   r      s4    







z2ResponseParamsDocumenter._add_member_documentationc                 K   s   | j |||fi | 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   rT   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i | |j  | |j|}t|D ]Z\}}	|rV|	|v rVq@||	 }
|j|	d|
jid}|j	  |	|j
v }| 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   rY   r   r   r   r+      s0    





z5RequestParamsDocumenter.document_shape_type_structureFc                 K   sx  |  |}|d u rt|j}|rn|d}|d| d|  |d}	|	j  |d}
|
d|  nL|d}
|
d |d ur|
jd|  |
d	 |d}| || |r|d
}|j	  |jd |d	 |j
r`|d}|j	  t|ddrH|d}d}ddd |j D }|||  ||j
 | || |d}|j  d S )Nr>   z:type z: zend-param-typer;   z:param %s: r<   r=   r-   zis-requiredz
[REQUIRED]r?   r@   FrA   zl.. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: %s. rB   c                 S   s   g | ]}d | qS rC   r   rD   r   r   r   rF   !  rG   zERequestParamsDocumenter._add_member_documentation.<locals>.<listcomp>z	end-param)r.   r   r/   r   r0   r#   r4   rH   r3   r$   rI   rJ   rK   r)   rL   rM    _add_special_trait_documentationrN   )r   r   r   r   Zis_top_level_paramrY   r   r2   r1   Zend_type_sectionrO   Zis_required_sectionrP   rQ   rR   rS   Zend_param_sectionr   r   r   r      sR    	














z1RequestParamsDocumenter._add_member_documentationc                 C   s   d|j v 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   	docstringr   r   r   r_   -  s    z9RequestParamsDocumenter._append_idempotency_documentation)NN)NFF)	r7   r8   r9   rU   rV   r+   r   r]   r_   r   r   r   r   rW      s    
    
9rW   N)Zbotocore.docs.shaper   Zbotocore.docs.utilsr   r   r:   rW   r   r   r   r   <module>   s
    2