
    Pe-                     ^    d dl mZ d dlmZ  G d de      Z G d de      Z G d de      Zy	)
    )ShapeDocumenter)py_type_namec                   d    e Zd ZddZd Z	 ddZ	 ddZ	 ddZ	 	 	 ddZd Z	d	 Z
d
 Zd Zd Zy)BaseParamsDocumenterNc                 6    g }| j                  |||d||       y)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
   s         6/usr/lib/python3/dist-packages/botocore/docs/params.pydocument_paramsz$BaseParamsDocumenter.document_params   s.     (( 	) 	
    c                 ,     | j                   ||fi | y N_add_member_documentationr   r   r	   kwargss       r   document_recursive_shapez-BaseParamsDocumenter.document_recursive_shape+   s    &&&w@@r   c                 ,     | j                   ||fi | y r   r   )r   r   r	   r
   r   r   r   s          r   document_shape_defaultz+BaseParamsDocumenter.document_shape_default.   s     	'&&w@@r   c                 :    | j                   ||fi | |j                  }|j                  |j                  d|j                  j                  i      }| j	                  |       | j                  |||d        |j                  d      }| j                  |       y )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_sections	            r   document_shape_type_listz-BaseParamsDocumenter.document_shape_type_list3   s     	'&&w@@ll//w0A0A&B 0 
 	  /((!	 	) 	
 ))*5w'r   c                 L    | j                   ||fi | |j                  dd|j                  j                  i      }| j	                  |       | j                  ||j                         |j                  |j
                  j                  d|j
                  j                  i      }|j                  j                          | j	                  |       | j                  ||j
                  |d        |j                  d      }	| j                  |	       | j                  |	       y )Nkeyr	   r   r   zend-map)
r   r!   r(   r   r"   valuestyleindentr   r#   )
r   r   r	   r
   r   r   r   key_sectionr%   end_sections
             r   document_shape_type_mapz,BaseParamsDocumenter.document_shape_type_mapE   s    	'&&w@@--GUYY^^4 . 
 	  -&&{EII>//KKw0@0@&A 0 
 	""$  /((!++	 	) 	
 --i8{+{+r   c                 X   | j                  |j                  |      }| j                  |||       |D ]S  }	|r|	|v r
||	   }
|j                  |	d|
j                  i      }| j                  |       | j                  ||
||	       U |j                  d      }| j                  |       y )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   r2   paramr$   r%   s               r   document_shape_type_structurez2BaseParamsDocumenter.document_shape_type_structure`   s     ,,U]]GD&&wD&A 	E5G+!%.K#33)9)9: 4 M $$]3,,%!	 - 	 ))/:w'r   c                      y r    r   s       r   r   z.BaseParamsDocumenter._add_member_documentation}   s    r   c                 V    |r&|j                         }|D ]  }|||j                  <    |S r   )copyr   )r   r2   r   r3   s       r   r1   z*BaseParamsDocumenter._add_members_to_shape   s2    llnG  ,&+

#,r   c                     | j                  |      }t        |j                        }d}||j                  ||z         n|j                  j                  ||z         |j                  d       y )Nz(%s) -- )_get_special_py_type_namer   	type_namewriter*   italics)r   type_sectionr	   special_py_typepy_typetype_formats         r   "_document_non_top_level_param_typez7BaseParamsDocumenter._document_non_top_level_param_type   sg    88?u/& {_<=&&{W'<=3r   c                 l    |j                   j                          |j                   j                          y r   )r*   r+   new_liner   r   s     r   r"   z(BaseParamsDocumenter._start_nested_param   "     r   c                 l    |j                   j                          |j                   j                          y r   )r*   dedentrE   rF   s     r   r#   z&BaseParamsDocumenter._end_nested_param   rG   r   NN)NNN)__name__
__module____qualname__r   r   r   r&   r.   r4   r   r1   rC   r"   r#   r6   r   r   r   r      sY    
2A >BA >B(& >B,@ (: !!r   r   c                   "    e Zd ZdZdZddZd Zy)ResponseParamsDocumenterz5Generates the description for the response parameterszresponse-paramsNc                 
   |j                  d      }|j                  d       |/|j                  j                  d|z         |j                  d       |j                  d      }| j	                  ||       |j                  d      }|j
                  r|j                  j                          t        |dd      r|j                  d	      }d
}	dj                  |j                  j                         D 
cg c]  }
d|
z  	 c}
      }d}|j                  |	|z         |j                  d      }|j                  j                  |       |j                  |j
                         |j                  j                          y c c}
w )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, ``%s``z3'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}zparam-unknown-example)r!   r=   r*   boldrC   documentationr+   getattrjoinr2   keys	codeblockinclude_doc_stringnew_paragraph)r   r   r	   r   r   name_sectionr?   documentation_sectiontagged_union_docsnoter(   tagged_union_members_strunknown_code_exampleexamples                 r   r   z2ResponseParamsDocumenter._add_member_documentation   sb   ..|<4 ##D4K0s#..|<//eD ' 7 78M N!''..0u/7$+$;$;-%!%  ,099/4}}/A/A/CDX^D,(8 % "''0H(IJ!112IJ''(<=!44U5H5HI##% Es   5F c                 .     | j                   |||fi | y r   )r4   )r   r   r	   r
   r   s        r    document_shape_type_event_streamz9ResponseParamsDocumenter.document_shape_type_event_stream   s     	+**7E7MfMr   r   )rK   rL   rM   __doc__
EVENT_NAMEr   rj   r6   r   r   rO   rO      s    ?"J%&NNr   rO   c                   8    e Zd ZdZdZ	 ddZ	 	 	 d	dZd Zd Zy)
RequestParamsDocumenterz4Generates the description for the request parameterszrequest-paramsNc                 R   t        |      dkD  r. | j                  ||fi | |j                  j                          | j	                  |j
                  |      }t        |      D ]n  \  }}	|r|	|v r||	   }
|j                  |	d|
j                  i      }|j                  j                          |	|j                  v }| j                  ||
||	|       p |j                  d      }t        |      dkD  r|j                  j                          |j                  j                          y )N   r	   r   )r   r	   r
   r   is_requiredr0   )lenr   r*   r+   r1   r2   	enumerater!   r   rE   required_membersr   rI   )r   r   r	   r
   r   r   r   r2   ir3   r$   r%   rq   s                r   r4   z5RequestParamsDocumenter.document_shape_type_structure   s$    w<!*D**7EDVDMM  ",,U]]GD!'* 	HAu5G+!%.K#33)9)9: 4 M ((*5#9#99K,,%!' - 	  ))/:w<!MM  " r   c                    | j                  |      }|t        |j                        }|ry|j                  d      }|j	                  d| d|        |j                  d      }	|	j
                  j                          |j                  d      }
|
j	                  d|z         nv|j                  d      }
|
j	                  d       |/|
j
                  j                  d|z         |
j	                  d	       |j                  d      }| j                  ||       |rW|j                  d
      }|j
                  j                          |j
                  j                  d       |j	                  d	       |j                  r|j                  d      }|j
                  j                          t        |dd      ra|j                  d      }d}dj                  |j                  j                         D cg c]  }d|z  	 c}      }|j	                  ||z         |j                  |j                         | j!                  ||       |j                  d      }|j
                  j#                          y c c}w )NrT   z:type z: zend-param-typerQ   z:param %s: rR   rS   r:   zis-requiredz
[REQUIRED]rU   rV   FrW   zl.. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: %s. rX   rY   z	end-param)r;   r   r<   r!   r=   r*   rE   rZ   rC   r+   r[   r\   r]   r2   r^   r`    _add_special_trait_documentationra   )r   r   r	   r   is_top_level_paramrq   r   rA   r?   end_type_sectionrb   is_required_sectionrc   rd   re   r(   rf   end_param_sections                     r   r   z1RequestParamsDocumenter._add_member_documentation   sA    007?"5??3G"22<@LvRy9:+;;<LM""++-"22<@L}t34 #22<@Lt$""''t4""3'"22<@L33L%H")"9"9-"H%%,,.%%**<8%%c*$+$;$;%%! "''..0u/7$+$;$;-%!D 
 ,099/4}}/A/A/CDX^D,( "''0H(IJ!44U5H5HI112GO#33K@--/ Es   1I1c                 D    d|j                   v r| j                  |       y y )NidempotencyToken)metadata!_append_idempotency_documentation)r   r   r	   s      r   rw   z8RequestParamsDocumenter._add_special_trait_documentation)  s!    /227; 0r   c                 *    d}|j                  |       y )Nz,This field is autopopulated if not provided.)r=   )r   r   	docstrings      r   r   z9RequestParamsDocumenter._append_idempotency_documentation-  s    B	i r   rJ   )NFF)	rK   rL   rM   rk   rl   r4   r   rw   r   r6   r   r   rn   rn      s1    >!J >B!@  70r<!r   rn   N)botocore.docs.shaper   botocore.docs.utilsr   r   rO   rn   r6   r   r   <module>r      s;    0 ,I!? I!X/N3 /Nd`!2 `!r   