
    "                     ^    S SK Jr  S SKJr   " S S\5      r " S S\5      r " S S\5      rg	)
    )ShapeDocumenter)
py_defaultc                       \ rS rSr SS jrS r SS jr SS jr SS jr SS jr	 SS	 jr
S
 rSS jrSS jrS rSrg)BaseExampleDocumenter   Nc                    / nUR                   R                  5         UR                   R                  5         Ub  UR                  U5        U R	                  UUUUUS9  UR                  S5      nUR                   R                  5         g)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_linestart_codeblockwritetraverse_and_document_shapeadd_new_section)selfr	   r
   prefixr   r   r   final_blank_line_sections           (lib/third_party/botocore/docs/example.pydocument_example&BaseExampleDocumenter.document_example   s    &  %%'MM&!(( 	) 	
 $+#:#:;M#N  &&//1    c                 &    UR                  S5        g )Nz{'... recursive ...'})r   )r   r	   r
   kwargss       r   document_recursive_shape.BaseExampleDocumenter.document_recursive_shape4   s    /0r   c                     U R                  U5      nUc  [        UR                  5      nU R                  R	                  S5      U:X  a  SnUR                  U5        g )Nstreaming_shapezStreamingBody())_get_special_py_defaultr   	type_name_contextgetr   )r   r	   r
   r   r   r   r   py_types           r   document_shape_default,BaseExampleDocumenter.document_shape_default7   sP     ..u5? 1G==./58'Ggr   c                    SUR                   ;   ah  [        UR                   S   5       HK  u  pxUR                  SU-  5        U[        UR                   S   5      S-
  :  d  M:  UR                  S5        MM     g U R	                  XU5        g )Nenum'%s'   |)metadata	enumerater   lenr&   )	r   r	   r
   r   r   r   r   ir)   s	            r   document_shape_type_string0BaseExampleDocumenter.document_shape_type_stringB   ss     U^^#$U^^F%;<ho.s5>>&12Q66MM#& =
 ''@r   c                 D   UR                   nUR                  S5      nU R                  US5        UR                  SSUR                  0S9n	U R	                  XUS9  UR                  S5      n
U
R                  S5        UR                  S	5      nU R                  US
5        g )Nz
list-value[memberr
   contextr	   r
   r   ending-comma,ending-bracket])r5   r   _start_nested_paramnamer   r   _end_nested_param)r   r	   r
   r   r   r   r   param_shapelist_sectionparam_sectionending_comma_sectionending_bracket_sections               r   document_shape_type_list.BaseExampleDocumenter.document_shape_type_listM   s     ll..|<  s3$44w(8(89 5 
 	((!g 	) 	
  ,;;NK""3'!-!=!=>N!O5s;r   c                    UR                   (       d  UR                  S5        g UR                  S5      nU R                  US5        U R	                  UR                   U5      n[        U5       H  u  pU(       a  X;   a  M  UR                  U	5      n
U
R                  SU	-  5        Xy   nU
R                  SSUR                  0S9nU R                  UUUU	S9  U[        U5      S	-
  :  d  M~  U
R                  S
5      nUR                  S5        UR                  R                  5         M     U R                  USS5        g )Nz{}structure-value{z'%s': member-valuer
   r6   r	   r
   r   r>   r+   r9   r:   })membersr   r   r=   _add_members_to_shaper.   r>   r   r/   r   r   _end_structure)r   r	   r
   r   r   r   r   input_membersr0   paramrB   r@   param_value_sectionrC   s                 r   document_shape_type_structure3BaseExampleDocumenter.document_shape_type_structure^   s>    }}MM$))*;<  #.225=='J!-0HA5+#33E:M
U 23'.K"/"?"?+2B2B(C #@ # ,,+!	 -  3}%))'4'D'D"($ %**3/$**335) 1* 	GS#.r   c                 n   UR                  S5      nU R                  US5        UR                  nUR                  SSUR                  R                  0S9n	U	R                  S5        UR                  SSUR                  0S9n
U R                  XUS9  UR                  S	5      nU R                  US
5        g )Nz	map-valuerI   keyr
   r6   z
'string': valuer8   r;   rL   )r   r=   rW   rV   r>   r   r   r?   )r   r	   r
   r   r   r   r   map_sectionvalue_shapekey_sectionvalue_sectionend_bracket_sections               r   document_shape_type_map-BaseExampleDocumenter.document_shape_type_map   s     --k:  c2kk!11GUYY^^4 2 
 	.)#33g{'7'78 4 
 	((!g 	) 	
 *99:JK2C8r   c                 b    U(       a'  UR                  5       nU H  nX1UR                  '   M     U$ N)copyr>   )r   rM   r   rQ   s       r   rN   +BaseExampleDocumenter._add_members_to_shape   s+    llnG &+

# !r   c                     Ub  UR                  U5        UR                  R                  5         UR                  R                  5         UR                  R                  5         g r`   )r   r   indentr   )r   r	   starts      r   r=   )BaseExampleDocumenter._start_nested_param   sD    MM%  r   c                     UR                   R                  5         UR                   R                  5         UR                   R                  5         Ub  UR                  U5        g g r`   )r   dedentr   r   )r   r	   ends      r   r?   'BaseExampleDocumenter._end_nested_param   sH     ?MM# r   c                     UR                   (       d5  UR                  5         UR                  X#-   5        U R                  U5        g UR	                  S5      nU R                  XC5        g )Nr;   )available_sections
clear_textr   r?   r   )r   r	   re   ri   r\   s        r   rO   $BaseExampleDocumenter._end_structure   sV     )) MM%+&""7+")"9"9:J"K""#6<r    )NNNNNr`   )__name__
__module____qualname____firstlineno__r   r   r&   r1   rE   rS   r]   rN   r=   r?   rO   __static_attributes__ro   r   r   r   r      s]    AE 2D1 >B	 >B	A >B<$ >B!/H >B9&!
=r   r   c                       \ rS rSrSrS rSrg)ResponseExampleDocumenter   zresponse-examplec                     UR                  S5        U R                  " XU40 UD6  UR                  S5      nUR                  S5        g )NzEventStream(zevent-stream-end))r   rS   r   )r   r	   r
   r   r   end_sections         r    document_shape_type_event_stream:ResponseExampleDocumenter.document_shape_type_event_stream   sD     	n%**77MfM--.@A#r   ro   N)rq   rr   rs   rt   
EVENT_NAMEr|   ru   ro   r   r   rw   rw      s    #Jr   rw   c                   $    \ rS rSrSr SS jrSrg)RequestExampleDocumenter   zrequest-exampleNc                    SnSnSn	Sn
[        U5      S::  a  SnSn	Sn
S	nUR                  S
5      nU R                  X5        U R                  UR                  U5      n[        U5       H  u  pU(       a  X;   a  M  UR                  U5      nUR                  X}-  5        UR                  U5        X   nUR                  SSUR                  0S9nU R                  UUUUS9  U[        U5      S-
  :  d  M  UR                  S5      nUR                  S5        UR                  R                  5         M     U R                  XU
5        g )Nr*   z: rI   rL   r+   =(rz   z%srH   rJ   r
   r6   rK   r9   r:   )r/   r   r=   rN   rM   r.   r   r>   r   r   r   rO   )r   r	   r
   r   r   r   r   param_formatoperatorre   ri   rP   r0   rQ   rB   r@   rR   rC   s                     r   rS   6RequestExampleDocumenter.document_shape_type_structure   sd     w<1HECL))*;<  0225=='J!-0HA5+#33E:M 45)'.K"/"?"?+2B2B(C #@ # ,,+!	 -  3}%))'4'D'D"($ %**3/$**335+ 1, 	GC0r   ro   rp   )rq   rr   rs   rt   r~   rS   ru   ro   r   r   r   r      s    "J >B'1r   r   N)botocore.docs.shaper   botocore.docs.utilsr   r   rw   r   ro   r   r   <module>r      s6    0 *b=O b=J	 5 	*14 *1r   