+
    i'                         ^ RI Ht ^ RIHt RtRtRtRt ! R R]4      t ! R R4      t	 ! R R4      t
 ! R	 R
]
4      t ! R R]4      t ! R R]
4      tR# )    )
HTMLParser)zip_longestc                   f   a a ] tR t^t oRtV 3R ltR tV 3R ltV 3R ltR t	R t
R tR	tVtV ;t# )
DocStringParserz
A simple HTML parser.  Focused on converting the subset of HTML
that appears in the documentation strings of the JSON models into
simple ReST format.
c                >   < R V n         Wn        \        SV `  4        R # N)treedocsuper__init__)selfr
   	__class__s   &&E/usr/lib/python3/dist-packages/botocore/docs/bcdoc/docstringparser.pyr   DocStringParser.__init__   s    	    c                f    \         P                  ! V 4       \        V P                  4      V n        R # r   )r   resetHTMLTreer
   r	   r   s   &r   r   DocStringParser.reset"   s     TXX&	r   c                   < \         SV `  V4       V P                  P                  4        \	        V P
                  4      V n        R # r   )r   feedr	   writer   r
   )r   datar   s   &&r   r   DocStringParser.feed&   s-    T		TXX&	r   c                   < \         SV `  4        V P                  P                  4        \	        V P
                  4      V n        R # r   )r   closer	   r   r   r
   )r   r   s   &r   r   DocStringParser.close+   s*    		TXX&	r   c                >    V P                   P                  WR 7       R# ))attrsNr	   add_tag)r   tagr    s   &&&r   handle_starttagDocStringParser.handle_starttag1   s    		#+r   c                @    V P                   P                  VR R7       R# )F)is_startNr!   )r   r#   s   &&r   handle_endtagDocStringParser.handle_endtag4   s    		#.r   c                <    V P                   P                  V4       R # r   )r	   add_datar   r   s   &&r   handle_dataDocStringParser.handle_data7   s    		4 r   )r
   r	   )__name__
__module____qualname____firstlineno____doc__r   r   r   r   r$   r(   r-   __static_attributes____classdictcell____classcell__r   __classdict__s   @@r   r   r      s2     
''
',/! !r   r   c                   F   a  ] tR t^;t o RtR tR	R ltR tR tR t	Rt
V tR# )
r   z
A tree which handles HTML nodes. Designed to work with a python HTML parser,
meaning that the current_node will be the most recently opened tag. When
a tag is closed, the current_node moves up to the parent node.
c                `    Wn         \        4       V n        V P                  V n        . V n        R # r   )r
   StemNodeheadcurrent_nodeunhandled_tagsr   r
   s   &&r   r   HTMLTree.__init__B   s$    J	 II r   Nc                   V P                  W4      '       g   V P                  P                  V4       R # V'       d/   \        W4      pV P                  P                  V4       W@n        R # V P                  P                  V n        R # r   )_doc_has_handlerr>   appendTagNoder=   	add_childparent)r   r#   r    r'   nodes   &&&& r   r"   HTMLTree.add_tagH   se    $$S33&&s+3&D''- $ $ 1 1 8 8Dr   c                h    V'       d   R V 2pMRV 2p\        V P                  P                  V4      # )start_end_)hasattrr
   style)r   r#   r'   handler_names   &&& r   rB   HTMLTree._doc_has_handlerT   s0    #C5>L!#<Ltxx~~|44r   c                N    V P                   P                  \        V4      4       R # r   )r=   rE   DataNoder,   s   &&r   r+   HTMLTree.add_data\   s    ##HTN3r   c                P    V P                   P                  V P                  4       R # r   )r<   r   r
   r   s   &r   r   HTMLTree.write_   s    		!r   )r=   r
   r<   r>   )NT)r/   r0   r1   r2   r3   r   r"   rB   r+   r   r4   r5   r8   s   @r   r   r   ;   s(     !
954" "r   r   c                   0   a  ] tR t^ct o RR ltR tRtV tR# )NodeNc                    Wn         R # r   rF   )r   rF   s   &&r   r   Node.__init__d   s    r   c                    \         hr   )NotImplementedErrorr?   s   &&r   r   
Node.writeg   s    !!r   rY   r   )r/   r0   r1   r2   r   r   r4   r5   rU   s   @r   rW   rW   c   s     " "r   rW   c                   l   a a ] tR t^kt oRV 3R lltR tR tR tR tR t	R t
R tR	 tR
 tRtVtV ;t# )r;   c                4   < \         SV `  V4       . V n        R # r   )r   r   children)r   rF   r   s   &&r   r   StemNode.__init__l   s     r   c                H    Wn         V P                  P                  V4       R # r   )rF   r`   rC   r   childs   &&r   rE   StemNode.add_childp   s    U#r   c                H    V P                  4        V P                  V4       R # r   )collapse_whitespace_write_childrenr?   s   &&r   r   StemNode.writet   s      "S!r   c                    \        V P                  V P                  R ,          4       FC  w  r#\        V\        4      '       d   Ve   VP	                  W4       K2  VP	                  V4       KE  	  R# )   NNN)r   r`   
isinstancerD   r   )r   r
   rd   
next_childs   &&  r   rh   StemNode._write_childrenx   sN    !,T]]DMM"<M!NE%))j.DC,C 	 "Or   c                    \         ;QJ d&    R  V P                   4       F  '       d   K   R# 	  R# ! R  V P                   4       4      # )c              3   @   "   T F  qP                  4       x  K  	  R # 5ir   )is_whitespace.0rd   s   & r   	<genexpr>)StemNode.is_whitespace.<locals>.<genexpr>   s     DmU&&((ms   FT)allr`   r   s   &r   rr   StemNode.is_whitespace   s3    sDdmmDssDsDsDdmmDDDr   c                l    V P                   ;'       d"    V P                   ^ ,          P                  4       # )r   )r`   startswith_whitespacer   s   &r   rz   StemNode.startswith_whitespace   s&    }}IIq!1!G!G!IIr   c                l    V P                   ;'       d"    V P                   R,          P                  4       # )rl   )r`   endswith_whitespacer   s   &r   r~   StemNode.endswith_whitespace   s&    }}HHr!2!F!F!HHr   c                   V P                   '       dB   V P                   ^ ,          P                  4       '       d   V P                   R,          V n         KS  V P                   '       d$   V P                   ^ ,          P                  4        R# R# )r   rk   N)r`   rr   lstripr   s   &r   r   StemNode.lstrip   sU    mmma 0 > > @ @ MM"-DM===MM!##% r   c                   V P                   '       d>   V P                   R,          P                  4       '       d   V P                   RR V n         KO  V P                   '       d$   V P                   R,          P                  4        R# R# )rl   Nr}   )r`   rr   rstripr   s   &r   r   StemNode.rstrip   sW    mmmb 1 ? ? A A MM#2.DM===MM"$$& r   c                    V P                  4        V P                  4        V P                   F  pVP                  4        K  	  R# )aN  Remove collapsible white-space from HTML.

HTML in docstrings often contains extraneous white-space around tags,
for readability. Browsers would collapse this white-space before
rendering. If not removed before conversion to RST where white-space is
part of the syntax, for example for indentation, it can result in
incorrect output.
N)r   r   r`   rg   rc   s   & r   rg   StemNode.collapse_whitespace   s0     	]]E%%' #r   )r`   r   )r/   r0   r1   r2   r   rE   r   rh   rr   rz   r~   r   r   rg   r4   r5   r6   r7   s   @@r   r;   r;   k   s?     $"!EJI&'( (r   r;   c                   \   a a ] tR t^t oRtR	V 3R lltR tR
R ltR tR t	R t
RtVtV ;t# )rD   zH
A generic Tag node. It will verify that handlers exist before writing.
c                >   < \         SV `  V4       W n        Wn        R # r   )r   r   r    r#   )r   r#   r    rF   r   s   &&&&r   r   TagNode.__init__   s     
r   c                    \         ;QJ d&    R  V P                   4       F  '       g   K   R# 	  R# ! R  V P                   4       4      # )c              3   B   "   T F  p\        V\        4      x  K  	  R # 5ir   )rm   rD   rs   s   & r   ru   +TagNode._has_nested_tags.<locals>.<genexpr>   s     I=%:eW--=s   TF)anyr`   r   s   &r   _has_nested_tagsTagNode._has_nested_tags   s3    sI4==IssIsIsI4==IIIr   c                   V P                   \        9   ;'       d    V P                  4       p\        V P                  \
        4      ;'       d9    V P                  P                   \        9   ;'       d    V P                   \        9   pV'       g	   V'       d   V P                  V4       R # V P                  V4       V P                  V4       V P                  W4       R # r   )r#   OMIT_SELF_TAGSr   rm   rF   rD   PRIORITY_PARENT_TAGSOMIT_NESTED_TAGSrh   _write_start
_write_end)r   r
   rn   prioritize_nested_tagsprioritize_parent_tags   &&&  r   r   TagNode.write   s    HH&BB4+@+@+B 	 t{{G, - -#77- -,, 	
 "%:  %#S!(r   c                   V P                   \        9   d!   V P                  4        V P                  4        \	        V P
                  RR V P
                  R,          4       F]  w  r\        V\        4      '       g   K  VP                  4       '       g   K5  VP                  4       '       g   KM  VP                  4        K_  	  \	        V P
                  RR V P
                  R,          4       F]  w  r#\        V\        4      '       g   K  VP                  4       '       g   K5  VP                  4       '       g   KM  VP                  4        K_  	  V P
                   F  pVP                  4        K  	  R# )aQ  Remove collapsible white-space.

All tags collapse internal whitespace. Block-display HTML tags also
strip all leading and trailing whitespace.

Approximately follows the specification used in browsers:
https://www.w3.org/TR/css-text-3/#white-space-rules
https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Whitespace
Nrk   r}   )r#   HTML_BLOCK_DISPLAY_TAGSr   r   zipr`   rm   rQ   r~   rz   rg   )r   prevcurnxtrd   s   &    r   rg   TagNode.collapse_whitespace   s     88..KKMKKM T]]3B/r1BCID4**,,..--//

 D DMM#2.b0ABHC3))++----//

 C ]]E%%' #r   c                    R V P                    2p\        VP                  V4      '       d)   \        VP                  V4      ! V P                  4       R# R# )rJ   N)r#   rL   rM   getattrr    )r   r
   rN   s   && r   r   TagNode._write_start   s?    z*399l++CII|,TZZ8 ,r   c                    R V P                    2p\        VP                  V4      '       dC   VR8X  d   \        VP                  V4      ! V4       R# \        VP                  V4      ! 4        R# R# )rK   end_aN)r#   rL   rM   r   )r   r
   rn   rN   s   &&& r   r   TagNode._write_end   sT    dhhZ(399l++w&		<0<		<02 ,r   )r    r#   )NNr   )r/   r0   r1   r2   r3   r   r   r   rg   r   r   r4   r5   r6   r7   s   @@r   rD   rD      s/     
J)" (D9
3 3r   rD   c                   t   a a ] tR t^t oRtRV 3R llt]R 4       tR tR t	R t
R tR tR	 tR
 tRtVtV ;t# )rQ   z(
A Node that contains only string data.
c           	       < \         SV `  V4       \        V\        4      '       g   \	        R \        V4       R24      hRV n        RV n        RV n        VR8X  d   R# VP                  4       '       d	   Wn        R# \        R \        V4       4       4      p\        V4      \        R \        \        V4      4       4       4      ,
          pVRV V n        WR V n        WV V n        R# )zExpecting string type, z given. Nc              3   Z   "   T F!  w  rVP                  4       '       d   K  Vx  K#  	  R # 5ir   isspacert   idxchs   &  r   ru   $DataNode.__init__.<locals>.<genexpr>  s      
.GCbjjlCC   +
+c              3   Z   "   T F!  w  rVP                  4       '       d   K  Vx  K#  	  R # 5ir   r   r   s   &  r   ru   r     s       *
8GC

CC8r   )r   r   rm   str
ValueErrortype_leading_whitespace_trailing_whitespace_stripped_datar   next	enumeratelenreversed)r   r   rF   first_non_spacelast_non_spacer   s   &&&  r   r   DataNode.__init__   s     $$$6tDzl'JKK#% $&! 2:<<>>(,% 
(
 
 TT *
($8*
 &
 
 $((8#9 $($9!">Br   c                N    V P                    V P                   V P                   2# r   r   r   r   r   s   &r   r   DataNode.data  s1     ''()<)<(=(()+	
r   c                |    V P                   R 8H  ;'       d'    V P                  R 8g  ;'       g    V P                  R 8g  # r   )r   r   r   r   s   &r   rr   DataNode.is_whitespace  s@    ""b( 
 
$$*MMd.G.G2.M	
r   c                |    V P                   R 8g  ;'       g'    V P                  R 8H  ;'       d    V P                  R 8g  # r   r   r   s   &r   rz   DataNode.startswith_whitespace  s@    ''2- 
 
2%II$*C*Cr*I	
r   c                |    V P                   R 8g  ;'       g'    V P                  R 8H  ;'       d    V P                  R 8g  # r   )r   r   r   r   s   &r   r~   DataNode.endswith_whitespace  s@    ((B. 
 
2%HH$*B*Bb*H	
r   c                    V P                   R 8w  d
   R V n         R# V P                  R 8X  d   V P                  4        R# R# r   N)r   r   r   r   s   &r   r   DataNode.lstrip$  s4    ##r)')D$  B&KKM 'r   c                    V P                   R 8w  d
   R V n         R# V P                  R 8X  d   V P                  4        R# R# r   )r   r   r   r   s   &r   r   DataNode.rstrip*  s4    $$*(*D%  B&KKM 'r   c                    R# )z4Noop, ``DataNode.write`` always collapses whitespaceN r   s   &r   rg   DataNode.collapse_whitespace0  s    r   c                    VP                  V P                  P                  4       4      pV P                   R P	                  V4       V P
                   2pVR8w  d   VP                  V4       R# R# ) r   N)translate_wordsr   splitr   joinr   r-   )r   r
   wordsstr_datas   &&  r   r   DataNode.write4  sj    ##D$7$7$=$=$?@''(%(9(()+ 	 r>OOH% r   r   r   )r/   r0   r1   r2   r3   r   propertyr   rr   rz   r~   r   r   rg   r   r4   r5   r6   r7   s   @@r   rQ   rQ      sL     C, 
 






& &r   rQ   N)codea)spanir   r   )r   b)pnoteulli)html.parserr   	itertoolsr   r   r   r   r   r   r   rW   r;   rD   rQ   r   r   r   <module>r      sp    # !$ - 3 "!j "!J%" %"P" "5(t 5(pM3h M3`H&t H&r   