+
    Dfj              
         R t ^ RIHt ^ RIt^ RIt^ RIHtHt ^ RIH	t	H
t
 ^ RIHt ^ RIHt ^ RIHtHt RP%                  ]
! ]	! R	^^
^ 4      4      4      t]P(                  ! ]]^R
7       R tR tR tR/t]! ]4      t]P9                  4        ]R0,           t]! ]4      t]P9                  4        ]3R lt]3R l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 R]&4      t( ! R R]&4      t)R  t*]*! 4       t+ ! R! R"]&4      t, ! R# R$]#4      t-R% t.R& t/ ! R' R(]4      t0R) t1R* t2R+ t3R, t4 ! R- R.4      t5R# )1a  
Micro Document Object Model: a partial DOM implementation with SUX.

This is an implementation of what we consider to be the useful subset of the
DOM.  The chief advantage of this library is that, not being burdened with
standards compliance, it can remain very stable between versions.  We can also
implement utility 'pythonic' ways to access and mutate the XML tree.

Since this has not subjected to a serious trial by fire, it is not recommended
to use this outside of Twisted applications.  However, it seems to work just
fine for the documentation generator, which parses a fairly representative
sample of XML.

Microdom mainly focuses on working with HTML and XHTML.

This module is now deprecated.
)annotationsN)BytesIOStringIO)VersiongetVersionString)ioType)InsensitiveDict)
ParseError	XMLParserz)twisted.web.microdom was deprecated at {}Twisted)
stacklevelc                    . pVP                   pV .p\        V4      ^ 8  d<   VP                  ^ 4      pVP                  V8X  d	   V! V4       VP                  VR&   KK  V# )a  
Return a list of all child elements of C{iNode} with a name matching
C{name}.

Note that this implementation does not conform to the DOM Level 1 Core
specification because it may return C{iNode}.

@param iNode: An element at which to begin searching.  If C{iNode} has a
    name matching C{name}, it will be included in the result.

@param name: A C{str} giving the name of the elements to return.

@return: A C{list} of direct or indirect child elements of C{iNode} with
    the name C{name}.  This may include C{iNode}.
N    N)appendlenpopnodeName
childNodesiNodenamematchesmatches_appendslicecs   &&    6/usr/lib/python3/dist-packages/twisted/web/microdom.pygetElementsByTagNamer   )   sW      G^^NGE
e*q.IIaL::1LLb	N    c                    VP                  4       p. pVP                  pV .p\        V4      ^ 8  dJ   VP                  ^ 4      pVP                  P                  4       V8X  d	   V! V4       VP
                  VR&   KY  V# )r   r   )lowerr   r   r   r   r   r   s   &&    r   getElementsByTagNameNoCaser!   D   si    ::<DG^^NGE
e*q.IIaL::%1LLb	Nr   c                L   a  \        S 4      \        8X  d	   V 3R  lpV# V 3R lpV# )c                x   < \        V \        4      '       d   V P                  R 4      p SP                  V 4       R# zutf-8N)
isinstancestrencodewritesstreams   &r   w_streamWriteWrapper.<locals>.wT   s)    !S!!HHW%LLOr   c                x   < \        V \        4      '       d   V P                  R 4      p SP                  V 4       R# r$   )r%   bytesdecoder(   r)   s   &r   r,   r-   [   s)    !U##HHW%LLOr   )r   r/   )r+   r,   s   f r   _streamWriteWrapperr1   Q   s'    f~	 H	
 Hr   c                >    V F  w  r#V P                  W24      p K  	  V # )z)
Perform the exact opposite of 'escape'.
replacetextcharsr*   hs   &&  r   unescaper9   r   #     ||A! Kr   c                >    V F  w  r#V P                  W#4      p K  	  V # )z3
Escape a few XML special chars with XML entities.
r3   r5   s   &&  r   escaper<   {   r:   r   c                  (    ] tR t^tR tR R ltRtR# )MismatchedTagsc                	h    WW6WtV3w  V n         V n        V n        V n        V n        V n        V n        R # N)filenameexpectgotbegLinebegColendLineendCol)selfrA   rB   rC   rF   rG   rD   rE   s   &&&&&&&&r   __init__MismatchedTags.__init__   s8     sVfE	
MKHLKLKr   c                   V ^8  d   QhRR/#    returnr&    )formats   "r   __annotate__MismatchedTags.__annotate__   s     
 
 
r   c                	    R V P                   : RV P                  : RV P                  : RV P                  : RV P                  : RV P
                  : 2# )zexpected </z	>, got </z> line: z col: z, began line: )rB   rC   rF   rG   rD   rE   rH   s   &r   __str__MismatchedTags.__str__   s8    
 		
r   )rE   rD   rG   rF   rB   rA   rC   N)__name__
__module____qualname____firstlineno__rI   rU   __static_attributes__rO   r   r   r>   r>      s    	F
 
r   r>   c                      ] tR t^tR tRR ltR tRRR^ / R3R ltRRR^ / R3R ltRR lt	RR lt
RR	 ltR
 tR tR tR tR tR tR tRtR# )NodeNc                	     Wn         . V n        R # r@   )
parentNoder   )rH   r_   s   &&r   rI   Node.__init__   s    $r   c                    \        V P                  4      \        VP                  4      8w  d   R# \        V P                  VP                  4       F  w  r#VP                  V4      '       d   K   R# 	  R# )z
Compare this node to C{other}.  If the nodes have the same number of
children and corresponding children are equal to each other, return
C{True}, otherwise return C{False}.

@type other: L{Node}
@rtype: C{bool}
FT)r   r   zipisEqualToNode)rH   otherabs   &&  r   rc   Node.isEqualToNode   sW     t3u'7'7#88)9)9:DA??1%% ; r    c                	    \        4       hr@   NotImplementedError)rH   r+   indent	addindentnewlstrip
nsprefixes	namespaces   &&&&&&&&r   writexmlNode.writexml   s     "##r   c           	     	b    \        4       pV P                  WqW#WEV4       VP                  4       pV# r@   )r   rr   getvalue)	rH   rl   rm   rn   ro   rp   rq   r*   rvs	   &&&&&&&  r   toxml
Node.toxml   s-     Ja%YOZZ\	r   c                	(    V P                  WW4V4      # r@   )rr   )rH   r+   rl   rm   rn   ro   s   &&&&&&r   writeprettyxmlNode.writeprettyxml   s    }}VYeDDr   c                	&    V P                  WW44      # r@   )rw   )rH   rl   rm   rn   ro   s   &&&&&r   toprettyxmlNode.toprettyxml   s    zz&T99r   c                	    \        4       hr@   rj   rH   deepparents   &&&r   	cloneNodeNode.cloneNode   s    !##r   c                	.    V P                   '       d   ^# ^ #    r   rT   s   &r   hasChildNodesNode.hasChildNodes   s    ???r   c                    \        V\        4      '       g   \        R4      hV P                  P	                  V4       Wn        R# )z
Make the given L{Node} the last child of this node.

@param child: The L{Node} which will become a child of this node.

@raise TypeError: If C{child} is not a C{Node} instance.
expected Node instanceN)r%   r]   	TypeErrorr   r   r_   rH   childs   &&r   appendChildNode.appendChild   s5     %&&455u%r   c                    \        V\        4      '       d   \        V\        4      '       g   \        R4      hV P                  P	                  V4      pWn        V P                  P                  W14       V# )aT  
Make the given L{Node} C{new} a child of this node which comes before
the L{Node} C{ref}.

@param new: A L{Node} which will become a child of this node.

@param ref: A L{Node} which is already a child of this node which
    C{new} will be inserted before.

@raise TypeError: If C{new} or C{ref} is not a C{Node} instance.

@return: C{new}
r   )r%   r]   r   r   indexr_   insert)rH   newrefis   &&& r   insertBeforeNode.insertBefore   sY     #t$$JsD,A,A455OO!!#&q&
r   c                    \        V\        4      '       g   \        R4      hWP                  9   d#   V P                  P	                  V4       RVn        V# )a  
Remove the given L{Node} from this node's children.

@param child: A L{Node} which is a child of this node which will no
    longer be a child of this node after this method is called.

@raise TypeError: If C{child} is not a C{Node} instance.

@return: C{child}
r   N)r%   r]   r   r   remover_   r   s   &&r   removeChildNode.removeChild   sF     %&&455OO#OO""5)#Er   c                   \        V\        4      '       d   \        V\        4      '       g   \        R4      hVP                  V Jd   \	        R4      hWP
                  V P
                  P                  V4      &   RVn        Wn        R# )a  
Replace a L{Node} which is already a child of this node with a
different node.

@param newChild: A L{Node} which will be made a child of this node.

@param oldChild: A L{Node} which is a child of this node which will
    give up its position to C{newChild}.

@raise TypeError: If C{newChild} or C{oldChild} is not a C{Node}
    instance.

@raise ValueError: If C{oldChild} is not a child of this C{Node}.
r   z$oldChild is not a child of this nodeN)r%   r]   r   r_   
ValueErrorr   r   )rH   newChildoldChilds   &&&r   replaceChildNode.replaceChild  sl     (D))Hd1K1K455d*CDD;C--h78""r   c                	(    V P                   R,          # )r   r   rT   s   &r   	lastChildNode.lastChild$  s    r""r   c                	b    \        V P                  4      '       d   V P                  ^ ,          # R# r   N)r   r   rT   s   &r   
firstChildNode.firstChild'  s#    t??1%%r   )r   r_   r@   )rh    
r   r   )rW   rX   rY   rZ   r   rI   rc   rr   rw   rz   r}   r   r   r   r   r   r   r   r   r[   rO   r   r   r]   r]      sr    H& 
$ 2BaBRTE:$ *$#.#r   r]   c                      ] tR tRt$ RR ltRR ltRtR]R&   R t]t	]
R 4       tR	 tR
R
R
^ / R
3R ltR tR tR tR tR tRtR# )Documenti9  Nc                	f    \         P                  V 4       V'       d   V P                  V4       R # R # r@   )r]   rI   r   )rH   documentElements   &&r   rI   Document.__init__:  s$    d_- r   c                	    \        4       pV P                  Vn        V'       d   V P                  P                  ^V 4      pMV P                  pVP	                  V4       V# r   )r   doctyper   r   r   )rH   r   r   dnewEls   &&&  r   r   Document.cloneNode?  sK    JLL	((221d;E((E	er   z
None | strr   c                	n    V P                   VP                   8H  ;'       d    \        P                  W4      # r@   )r   r]   rc   rH   ns   &&r   isEqualToDocumentDocument.isEqualToDocumentK  s(    		)JJt/A/A$/JJr   c                	(    V P                   ^ ,          # r   r   rT   s   &r   r   Document.documentElementP  s    q!!r   c                j    V P                   '       d   \        R4      h\        P                  W4       R# )z
Make the given L{Node} the I{document element} of this L{Document}.

@param child: The L{Node} to make into this L{Document}'s document
    element.

@raise ValueError: If this document already has a document element.
zOnly one element per document.N)r   r   r]   r   r   s   &&r   r   Document.appendChildT  s'     ???=>>%r   rh   c           	     	    \        V4      pV! R V,           4       V P                  '       d   V! RV P                   RV 24       V P                  P                  WW4WVV4       R# )z<?xml version="1.0"?>z
<!DOCTYPE >N)r1   r   r   rr   	rH   r+   rl   rm   rn   ro   rp   rq   r,   s	   &&&&&&&& r   rr   Document.writexmla  s[      '	
!D
()<<<
4<<.$01%%IU		
r   c                	    \        V3/ VB # r@   )Element)rH   r   kws   &&,r   createElementDocument.createElementu  s    t"r""r   c                	    \        V4      # r@   )TextrH   r6   s   &&r   createTextNodeDocument.createTextNodex  s    Dzr   c                	    \        V4      # r@   )Commentr   s   &&r   createCommentDocument.createComment{  s    t}r   c                	f    V P                   P                  '       d   \        W4      # \        W4      # r@   )r   caseInsensitiver!   r   rH   r   s   &&r   r   Document.getElementsByTagName~  s*    ///-d99#D//r   c                	   V P                   R ,          pV'       dm   VP                  ^ 4      pVP                   '       d   VP                  VP                   4       \        VR4      '       g   KZ  VP	                  R4      V8X  g   Kr  V# R# ):NNNgetAttributeidN)r   r   extendhasattrr   )rH   r   r   nodes   &&  r   getElementByIdDocument.getElementById  se    __Q'
>>!$D!!$//2t^,,1B1B41HB1N r   rO   r@   r   )rW   rX   rY   rZ   rI   r   r   __annotations__r   rc   propertyr   r   rr   r   r   r   r   r   r[   rO   r   r   r   r   9  sn    .
 GZK &M" "&  
(#0
r   r   c                  J    ] tR tRtR	R ltR t]tRRR^ / R3R ltR
R ltRt	R# )EntityReferencei  Nc                	t    \         P                  W4       Wn        R V,           R,           ;V n        V n        R# )&;N)r]   rI   eref	nodeValuedata)rH   r   r_   s   &&&r   rI   EntityReference.__init__  s*    d'	%(4Z#%55r   c                	    \        V\        4      '       g   ^ # V P                  VP                  8H  ;'       d    V P                  VP                  8H  # r   )r%   r   r   r   r   s   &&r   isEqualToEntityReference(EntityReference.isEqualToEntityReference  s:    !_--		QVV#HH$..AKK*GHr   rh   c                	N    \        V4      pV! R V P                  ,           4       R# )rh   Nr1   r   r   s	   &&&&&&&& r   rr   EntityReference.writexml  s      '	"t~~
r   c                	.    \        V P                  V4      # r@   )r   r   r   s   &&&r   r   EntityReference.cloneNode  s    tyy&11r   )r   r   r   r@   r   )
rW   rX   rY   rZ   rI   r   rc   rr   r   r[   rO   r   r   r   r     s7    6
I
 -M
 2 2r   r   c                  *    ] tR tRtRR ltR t]tRtR# )CharacterDatai  Nc                	Z    \         P                  W4       V;V n        ;V n        V n        R # r@   )r]   rI   valuer   r   )rH   r   r_   s   &&&r   rI   CharacterData.__init__  s#    d'266
6TYr   c                	4    V P                   VP                   8H  # r@   )r   r   s   &&r   isEqualToCharacterData$CharacterData.isEqualToCharacterData  s    zzQWW$$r   )r   r   r   r@   )rW   rX   rY   rZ   rI   r   rc   r[   rO   r   r   r   r     s    7% +Mr   r   c                  :    ] tR tRtRtRRR^ / R3R ltRR ltRtR# )	r   i  z
A comment node.
rh   c                	L    \        V4      pV P                  p	V! R V	 R24       R# )z<!--z-->N)r1   r   )
rH   r+   rl   rm   rn   ro   rp   rq   r,   vals
   &&&&&&&&  r   rr   Comment.writexml  s'      'ii	DS/r   Nc                	.    \        V P                  V4      # r@   )r   r   r   s   &&&r   r   Comment.cloneNode  s    t~~v..r   rO   r   )rW   rX   rY   rZ   __doc__rr   r   r[   rO   r   r   r   r     s*     / /r   r   c                  R    ] tR tRtRR ltR tRR ltRRR^ / R3R ltR R	 ltR
t	R# )r   i  Nc                	>    \         P                  WV4       W0n        R # r@   )r   rI   raw)rH   r   r_   r  s   &&&&r   rI   Text.__init__  s    t:6r   c                n    \         P                  W4      ;'       d    V P                  VP                  8H  # )z
Compare this text to C{text}.  If the underlying values and the C{raw}
flag are the same, return C{True}, otherwise return C{False}.
)r   rc   r  rH   rd   s   &&r   rc   Text.isEqualToNode  s*    
 **47QQDHH		<QQr   c                	B    \        V P                  W P                  4      # r@   )r   r   r  r   s   &&&r   r   Text.cloneNode  s    DNNFHH55r   rh   c                	~   \        V4      pV P                  '       d9   V P                  p	\        V	\        4      '       g   \	        V P                  4      p	M_V P                  p
\        V
\        4      '       g   \	        V
4      p
V'       d    R P                  V
P                  4       4      p
\        V
4      p	V! V	4       R# )r   N)r1   r  r   r%   r&   joinsplitr<   )rH   r+   rl   rm   rn   ro   rp   rq   r,   r   vs   &&&&&&&&   r   rr   Text.writexml  s      '888..Cc3''$..)Aa%%FHHQWWY')C	#r   c                   V ^8  d   QhRR/# rL   rO   )rP   s   "r   rQ   Text.__annotate__  s     6 6# 6r   c                	H    R \        V P                  4      ,          R,           # )zText(%s))reprr   rT   s   &r   __repr__Text.__repr__  s    4//#55r   r  )Nr   r   )
rW   rX   rY   rZ   rI   rc   r   rr   r  r[   rO   r   r   r   r     s5    R6 06 6r   r   c                  6    ] tR tRtRR ltRRR^ / R3R ltRtR# )CDATASectioni  Nc                	.    \        V P                  V4      # r@   )r  r   r   s   &&&r   r   CDATASection.cloneNode  s    DNNF33r   rh   c                	n    \        V4      pV! R 4       V! RV P                  ,           4       V! R4       R# )z	<![CDATA[rh   z]]>Nr   r   s	   &&&&&&&& r   rr   CDATASection.writexml  s-      '	+	"t~~
	%r   rO   r   )rW   rX   rY   rZ   r   rr   r[   rO   r   r   r  r    s%    4  r   r  c               #  N   "   ^ p  R\        V 4      ,           x  V ^,           p K   5i)r   p)r&   )r   s    r   
_genprefixr     s$     	A
CFlEs   #%c                      ] tR tRtRtRtR# )_Attri  z#Support class for getAttributeNode.rO   N)rW   rX   rY   rZ   r  r[   rO   r   r   r"  r"    s    )r   r"  c                      ] tR tRt^ t^tRtRR ltR tR t	R t
R tRR ltR	 tR
 tRR ltRR ltR tR tR tR tRRR^ / R3R ltR R ltR R ltRtR# )r   i  Nc	                	   \         P                  W4       T;'       g    V'       * V n        W`n        V'       g   VP	                  4       pVf	   / V n        MAW n        V P
                  P                  4        F  w  r\        V
4      V P
                  V	&   K  	  V'       d   \        V P
                  VR7      V n        V;V n	        ;V n
        V n        W@n        WPn        Wn        R # )N)preserve)r]   rI   preserveCaser   r    
attributesitemsr9   r   
endTagNamer   tagName	_filename_markposrq   )rH   r*  r'  r_   rA   markposr   r&  rq   kr  s   &&&&&&&&&  r   rI   Element.__init__  s     	d'(??,?.mmoG DO(O--/%-a[" 0 -dooUDO9@@@$-$,!"r   c                	h    V P                   f	   Wn         R # V P                   P                  V4       R # r@   )rp   update)rH   pfxss   &&r   addPrefixesElement.addPrefixes>  s#    ??""OOO""4(r   c                	V    V P                   '       g   VP                  4       pWn        R # r@   )r&  r    r)  )rH   r)  s   &&r   endTagElement.endTagD  s!       #))+J$r   c                	F   V P                   '       dW   V P                  VP                  8H  ;'       d6    V P                  P                  4       VP                  P                  4       8H  # V P                  VP                  8H  ;'       d    V P                  VP                  8H  # r@   )r   r'  r   r    r   s   &&r   isEqualToElementElement.isEqualToElementI  sy    OOq||3  ##%)9)9);; 1<</RRdmmqzz6QRr   c                *   V P                   P                  4       VP                   P                  4       8H  ;'       dX    V P                  VP                  8H  ;'       d7    V P                  VP                  8H  ;'       d    \        P                  W4      # )z
Compare this element to C{other}.  If the C{nodeName}, C{namespace},
C{attributes}, and C{childNodes} are all the same, return C{True},
otherwise return C{False}.
)r   r    rq   r'  r]   rc   r  s   &&r   rc   Element.isEqualToNodeP  s{     MM!U^^%9%9%;; 0 0%//10 05#3#330 0 ""4/		
r   c                	L   \        V P                  VV P                  V P                  V P                  R 7      pVP
                  P                  V P
                  4       V'       d3   V P                   Uu. uF  qDP                  ^V4      NK  	  upVn        V# . Vn        V# u upi ))r_   rq   r&  r   )	r   r*  rq   r&  r   r'  r1  r   r   )rH   r   r   cloner   s   &&&  r   r   Element.cloneNode]  s    LLnn** 00
 	0GKWe5 9WE   "E  Xs   4B!c                	R    V P                   '       d   \        W4      # \        W4      # r@   )r   r!   r   r   s   &&r   r   Element.getElementsByTagNamel  s$    -d99#D//r   c                	    ^# r   rO   rT   s   &r   hasAttributesElement.hasAttributesq  s    r   c                	8    V P                   P                  W4      # r@   )r'  get)rH   r   defaults   &&&r   r   Element.getAttributet  s    ""411r   c                	    W3pW@P                   9   d   V P                   V,          # WP                  8X  d   V P                   P                  W#4      # V# r@   )r'  rq   rF  )rH   nsr   rG  nsks   &&&& r   getAttributeNSElement.getAttributeNSw  sF    j//!??3''??&&t55r   c                	8    \        V P                  V4      V 4      # r@   )r"  r   r   s   &&r   getAttributeNodeElement.getAttributeNode  s    T&&t,d33r   c                	"    W P                   V&   R # r@   r'  )rH   r   attrs   &&&r   setAttributeElement.setAttribute  s     $r   c                	D    WP                   9   d   V P                   V R # R # r@   rR  r   s   &&r   removeAttributeElement.removeAttribute  s    ??"% #r   c                	    WP                   9   # r@   rR  r   s   &&r   hasAttributeElement.hasAttribute  s    &&r   rh   c           
       a RpRp	Rp
V P                   '       g   V P                  V n        \        V4      pV P                  '       d=   V P                  P                  4       pVP                  4        F  pW9   g   K  W K  	  M/ pR.pV P                  V	9   d   WB.V,           pVP                  oV3R lpV P                  pWpP                  8w  d   V P                  e   V P                  V9   dN   W`P                  ,          pS! VR,           V P                  ,           4       VR,           V P                  ,           pMDS! V P                  4       V! RV P                  4       V P                  pMS! V P                  4       RP                  p\        V P                  P                  4       4       Fq  w  pp\        V\        4      '       dG   Vw  ppW9   d
   Wm,          pM\        \         4      pVW&   Vf   Q hV! VR,           V,           V4       Kb  Vf   Q hV! VV4       Ks  	  V'       dI   VP                  4        F   w  ppV'       g   K  V! RV,           V4       K"  	  VP#                  V4       TpMTpV! V! V4      4       V P$                  '       d   V! R4       W#,           pV P$                   FK  pV P                  V	9   d"   V P                  V
9   d   V! V! VV34      4       VP'                  VVW4VVV4       KM  	  V P                  V	9   d   V! V! WB34      4       V! V! R	VR34      4       R# V P                  P)                  4       V9  d   V! V! R
VR34      4       R# V! R4       R# )a  
Serialize this L{Element} to the given stream.

@param stream: A file-like object to which this L{Element} will be
    written.

@param nsprefixes: A C{dict} mapping namespace URIs as C{str} to
    prefixes as C{str}.  This defines the prefixes which are already in
    scope in the document at the point at which this L{Element} exists.
    This is essentially an implementation detail for namespace support.
    Applications should not try to use it.

@param namespace: The namespace URI as a C{str} which is the default at
    the point in the document at which this L{Element} exists.  This is
    essentially an implementation detail for namespace support.
    Applications should not try to use it.
<c                0   < S! R V R\        V4      R34      # )r   z="")r<   )_atr_valbexts   &&r   <lambda>"Element.writexml.<locals>.<lambda>  s    tS$fTlC,P'Qr   N:xmlnsrh   zxmlns:r   z</z></ />)imgbrhrbasemetalinkparamareainputcolbasefontisindexframe)htmlheadbodynoscriptinsdelh1h2h3h4h5h6scriptuloldlprerj  
blockquoteaddressr  divfieldsettabletrformobjectr  appletmap)r  r  r  rv  )r&  r*  r)  r1   rp   copykeysr   rq   r  sortedr'  r(  r%   tuplenext	genprefixr1  r   rr   r    )rH   r+   rl   rm   rn   ro   rp   rq   ALLOWSINGLETONBLOCKELEMENTSFORMATNICELYr,   newprefixesrJ  begin	writeattrr)  prefixjrS  r   keydownprefixes	newindentr   rb  s   &&&&&&&&                 @r   rr   Element.writexml  s   8

@ 2    "llDO'???//..0K oo'$# ( K<<=(NU*E||Q	
 __
&4>>+E ~~+ $NN3Vc\DLL01#c\DOO;
 T\\"'4>>2 !NN	 GG 5 5 78ID#$&&C#'^F!)_F&,KO&&3,,c2&$$ 9 )//1
F6h/4 2 z*&L%L	!E(???cF*I<<=0T\\\5Qay)*+Iy|Y ) ||},!TN#$az3'()\\!7a
C()*eHr   c                   V ^8  d   QhRR/# rL   rO   )rP   s   "r   rQ   Element.__annotate__5  s      # r   c                	B   R \        V P                  4      ,          pV P                  '       d   VRV P                  : 2,          pV P                  '       d   VRV P                  : 2,          pV P                  '       d   VRV P                  : 2,          pVR,           # )z
Element(%sz, attributes=z, filename=z
, markpos=r  )r  r   r'  r+  r,  )rH   reps   & r   r  Element.__repr__5  s|    T$--00???]4??"566C>>>[ 233C===Z011CSyr   c                   V ^8  d   QhRR/# rL   rO   )rP   s   "r   rQ   r  ?  s       r   c                	l   R V P                   ,           pV P                  '       g   V P                  '       d
   VR,          pV P                  '       d   V\        V P                  4      ,          pV P                  '       d   VRV P                  ,          ,          pV P                  '       g   V P                  '       d
   VR,          pV P                  P                  4        F  pVRV,          ,          pK  	  V P                  4       '       d   VRV P                   ,          ,          pV# VR,          pV# )r]  z (z line %s column %sr  z %s=%rz
 >...</%s>rg  )r   r+  r,  r  r'  r(  r   )rH   r  items   &  r   rU   Element.__str__?  s    DMM!>>>T]]]4KC>>>4''C==='$--77C>>>T]]]3JCOO))+D8d?"C ,<$--//C 
 5LC
r   )
r+  r,  r'  r   r)  rq   r   rp   r&  r*  )NNNNr   r   Nr   r@   )rW   rX   rY   rZ   r&  r   rp   rI   r3  r6  r9  rc   r   r   rC  r   rL  rO  rT  rW  rZ  rr   r  rU   r[   rO   r   r   r   r     s    LOJ#>)%
S
0
24%&' gR r   r   c                V    / pV P                  4        F  w  r#\        V4      W&   K  	  V# r@   )r(  r9   r   ddr.  r  s   &   r   _unescapeDictr  R  s)    	B	 Ir   c                D    / pV P                  4        F	  w  r#W!V&   K  	  V# r@   )r(  r  s   &   r   _reverseDictr  Y  s%    	B	1 Ir   c                  "   ] tR tRtRP	                  4       tRRR.RRR.RRR.RR.R. R#OR. R#OR	. R#OR
R
.RR.RR.RR.RR.RR.RRR.RR./t^ ^^ ]]3R ltR tR t	]
P                  ! R4      tR tR tR tR tR tR tR tR tR tR  tR!tR"# )$MicroDOMParseri`  z#area link br img hr input base metar  dtr  litbodytheadtfootcolgrouprq  r  tdthrv  rw  titleoptionc                	    . V n         R R RR/p\        V4      pVRV3.V n        . V n        RV n        Wn        W n        T;'       g    V'       * V n        W@n        WPn	        R# )rf  rh   N)
elementstackr  nsstack	documents
_mddoctypebeExtremelyLenientr   r&  soonCloserslaterClosers)rH   r  r   r&  r  r  r   drs   &&&&&&  r   rI   MicroDOMParser.__init__x  sk     gr4(!_D""4.(??,?&(r   c                	    \        \        V P                  4      4       FB  pV P                  V) ,          pVP                  R 8X  g   VP	                  RR4      R8X  g   KA   ^# 	  ^ # )r  z	xml:spacerh   r%  )ranger   r  r*  r   )rH   edxels   &  r   shouldPreserveSpace"MicroDOMParser.shouldPreserveSpace  sT    T../0C""C4(BzzU"book2&F*&T 1 r   c                	P    V P                   '       d   V P                   R,          # R# )r   Nr   )r  rT   s   &r   
_getparentMicroDOMParser._getparent  s"    $$R((r   z\s*/[/*]\s*c                	   V P                   '       d   \        VP                  4      ^8X  g   R# VP                  4       p\	        V\
        4      '       Ed   RpVP                  pV P                  P                  V4      pV'       d   VP                  4       pV\        V4      R p \        RV,          4      P                  ^ ,          p\        TP                  4      ^8w  d   R# TP                  4       p\	        T\        \        34      '       dQ   . Tn        T'       d%   TP                  P                  \        T4      4       TP                  P                  T4       R# R# R#   \        \        3 d     R# i ; i)r   Nrh   z	<a>%s</a>)r  r   r   r   r%   r   r   COMMENTmatchgroupparseStringr	   r>   r  r   r   )rH   r  r   r  oldvaluer  es   &&     r   _fixScriptElement MicroDOMParser._fixScriptElement  s$    &&&c"--.@A.EMMOa FwwHLL&&x0E#CKM2h 67BB1E 1<< A%A!lG455 "MM((f6$$Q'	 6+   / s   &#E% %E:9E:c                	    Wn         R # r@   )r  )rH   r   s   &&r   
gotDoctypeMicroDOMParser.gotDoctype  s    !r   c                	   V P                  4       pV P                  '       d   \        V\        4      '       d   VP                  pTpV P
                  '       d!   VP                  4       pVP                  4       pWPP                  P                  V. 4      9   d,   V P                  VP                  4       V P                  4       p\        V4      pV P                  R,          ^ ,          p/ p. pVP                  4        Fa  w  rV	P                  R4      '       g   K  V	P                  R^4      p\        V4      ^8X  d   WV^,          &   MWR&   VP!                  V	4       Kc  	  V F  p	W) K  	  V'       d"   VP#                  4       pVP%                  V4       . pVP                  4        F[  w  rV	P                  R^4      p\        V4      ^8X  g   K)  Vw  rVR8w  g   K6  W9   g   K>  WWm,          V3&   VP!                  V	4       K]  	  V F  p	W) K  	  \        VVVV P&                  V P)                  4       V P
                  V P*                  VP                  R4      R7      p\-        V4      pVP/                  V4       V'       dW   V P                  R,          ^,          P#                  4       pVP%                  V4       V P                  P!                  WoV34       V P0                  P!                  V4       V'       d   VP3                  V4       V P                  '       d1   VP                  V P4                  9   d   V P                  V4       R# R# R# )r   rf  re  rh   xml)r   r&  rq   Nr   )r  r  r%   r   r*  r   r    r  rF  	gotTagEndr  r  r(  
startswithr  r   r   r  r1  rA   saveMarkr&  r  r3  r  r   r  )rH   r   r'  r   
parentNamemyName
namespaces	newspaceskeysToDeleter.  r  
spacenamesksplitpfxtvr  	revspacesrscopys   &&&               r   gotTagStartMicroDOMParser.gotTagStart  s    """"z&''B'BJF###'--/
**..z2>>v~~.*":.
\\"%a(
	$$&DA||G$$WWS!_
z?a'/0jm,$%bM##A& ' A #*Ji($$&DAWWS!_F6{a %<C$567z23 ''* ' A MMMMO 00** nnR(	
 !+	
y!\\"%a(--/FMM)$LL 89  $r""""rzzT5E5E'ENN4  (F"r   c                	    V P                  4       pV! W#4      pV'       d   VP                  V4       R # V P                  '       d   V P                  P	                  V4       R # R # r@   )r  r   r  r  r   )rH   factoryr   r   tes   &&&  r   _gotStandaloneMicroDOMParser._gotStandalone  sL    "T"r"$$$NN!!"% %r   c                	    VP                  4       '       g   V P                  4       '       d   V P                  \        V4       R # R # r@   )ro   r  r  r   rH   r   s   &&r   gotTextMicroDOMParser.gotText  s0    ::<<43355d+ 6r   c                	2    V P                  \        V4       R # r@   )r  r   r  s   &&r   
gotCommentMicroDOMParser.gotComment  s    GT*r   c                	2    V P                  \        V4       R # r@   )r  r   )rH   	entityRefs   &&r   gotEntityReference!MicroDOMParser.gotEntityReference  s    OY7r   c                	2    V P                  \        V4       R # r@   )r  r  )rH   cdatas   &&r   gotCDataMicroDOMParser.gotCData  s    L%0r   c                	h   V P                   '       gG   V P                  '       d   R # \        V P                  RV3V P	                  4       ,           R,           !  hV P                   P                  4       pV P                  R,          ^,          pV P                  R,          ^,          VJ d   V P                  P                  4       pMR pV P                  '       d,   VP                  P                  4       pVP                  4       pMVP                  pTpVP                  R^4      p\        V4      ^8X  d   Vw  rVP                  VR 4      p
V
ej   VP                  V
8w  dY   V P                  '       gG   \        V P                  VP                  V3V P	                  4       ,           VP                  ,           !  hWV8X  Eg~   V P                  '       Ed%   V P                   '       Ed   V P                   ^ ,          p\        \        V P                   4      4       FY  pV P                   V^,           ) ,          P                  V8X  g   K/  V P                   V^,           ) ,          P!                  V4        M>	  V P                   P#                  V4       Ve   V P                  P#                  V4       R # V P                   V^,           ) R 1 V P                   '       g   V P$                  P#                  V4       R # MF\        V P                  VP                  V3V P	                  4       ,           VP                  ,           !  hVP!                  V4       V P                   '       g   V P$                  P#                  V4       V P                  '       d'   VP                  R8X  d   V P'                  V4       R # R # R # )NNOTHINGre  r  )r   r   r   )r  r  r>   rA   r  r   r  r   r*  r    r  r   rF  rq   r,  r  r6  r   r  r  )rH   r   r  pfxdixnstupletncnamensplitr  newnamerJ  lastElidxs   &&           r   r  MicroDOMParser.gotTagEnd  s       &&& ==)T2T]]_DvM  ""$b!!$<<A"$ll&&(GG!!#BJJLEBEC#v;!!LCC&B~<<2%222,!%

D A"&--/!2"$++!.  &&&$$$!..q1F$S):):%;<,,sQwZ8@@EI --aj9@@F!  = ))004". LL//8))C!G*,7,,,--f5$}}bjj$7$--/IBKKW  			$   NN!!"%"""rzzX'=""2& (>"r   c                	   \         P                  ! W4       V P                  '       d   V P                  '       d/   V P                  P                  V P                  ^ ,          4       R# \        V P                  V P                  R,          R3V P                  4       ,           V P                  R,          P                  ,           !  hR# )r   END_OF_FILENr   )
r
   connectionLostr  r  r  r   r>   rA   r  r,  )rH   reasons   &&r   r  MicroDOMParser.connectionLostT  s      .&&&%%d&7&7&:;$(9(9"(=}M--/*++B/889 	 r   )	r  r  r   r  r  r  r  r&  r  N)r  r  r  )rW   rX   rY   rZ   r  r  r  rI   r  r  recompiler  r  r  r  r  r  r  r  r   r  r  r[   rO   r   r   r  r  `  s    
 8==?Kc4[tTltTltf,,,ZLwtftftf&&!8*L( !)* jj(G(B"=!~&,+81>'@r   r  c                   \        V R4      '       g   \        V R4      p \        V/ VB p\        V RR4      Vn        VP                  R4       \        V R4      '       d!   VP                  V P                  4       4       M=V P                  R4      pV'       d%   VP                  V4       V P                  R4      pK,  VP                  R4       VP                  '       g   \        VP                  ^ ^ R4      hVP                  '       d   \        VP                  4      ^8X  dI   VP                  ^ ,          p\        V\        4      '       g   \        R	4      pVP!                  V4       TpMC\        R	4      pVP                   F  pVP!                  V4       K  	  MVP                  ^ ,          p\#        V4      pVP$                  Vn        V# )
z
Parse HTML or XML readable.
readrbr   z<xmlfile />Nru   i   zNo top-level Nodes in documentru  )r   openr  getattrrA   makeConnectiondataReceivedru   r  r  r  r	   r  r   r%   r   r   r   r  r   )	readableargskwargsmdprr   r  r   docs	   &*,      r   parser!  c  sg    8V$$$'
$
)&
)C8V];CLtx$$**,-MM$Qd#At===q!-MNN
s}}"a Aa))V_q!Ae$ ' MM!
1+C..CKJr   c                    \        V \        4      '       d(   \        \        V P	                  R 4      4      .VO5/ VB # \        \        V 4      .VO5/ VB # )zUTF-16)r%   r&   r!  r   r'   )str  r   s   &*,r   r  r    sK    "cWRYYx01?D?B??*t*r**r   c                    \        V ^ ^R7      # z
Parse an XML readable object.
r   r&  )r!  )r  s   &r   parseXMLr'    s     11==r   c                    \        V ^ ^R7      # r%  )r  )r#  s   &r   parseXMLStringr)    s     r11==r   c                  F    ] tR tRtRtRR ltR tR tR tRR lt	R t
R	tR
# )lmxi  z
Easy creation of XML.
c                	T    \        V\        4      '       d   \        V4      pWn        R # r@   )r%   r&   r   r   )rH   r   s   &&r   rI   lmx.__init__  s    dC  4=D	r   c                	F   a a S^ ,          R8X  d   \        R4      hVV 3R l# )r   _zno private attrsc                 *   < SP                   ! S3/ V B # r@   )add)r   r   rH   s   ,r   rc  !lmx.__getattr__.<locals>.<lambda>  s    DHHT0R0r   )AttributeErrorr   s   ffr   __getattr__lmx.__getattr__  s     7c> !34400r   c                	<    V P                   P                  W4       R # r@   )r   rT  )rH   r  r   s   &&&r   __setitem__lmx.__setitem__  s    		s(r   c                	8    V P                   P                  V4      # r@   )r   r   )rH   r  s   &&r   __getitem__lmx.__getitem__  s    yy%%c**r   c                	T    \        WR 7      pV P                  P                  V4       V # )r  )r   r   r   )rH   txtr  nns   &&& r   r6   lmx.text  s#    #		b!r   c                	    \        V^ ^ R7      pV P                  P                  V4       \        V4      pVP	                  4        F   w  rVV^ ,          R8X  d
   VR,          pWdV&   K"  	  V# )r   r&  r/  :r   NN)r   r   r   r+  r(  )rH   r*  r   newNodexfr.  r  s   &&,    r   r1  lmx.add  s_    '11E		g&\HHJDAts{bEqE  	r   )r   N)r  r   )rW   rX   rY   rZ   r  rI   r4  r7  r:  r6   r1  r[   rO   r   r   r+  r+    s%    
1
)+
r   r+  ))r   z&amp;)r]  z&lt;)r   z&gt;)r_  z&quot;))'z&apos;)6r  
__future__r   r  warningsior   r   incrementalr   r   twisted.python.compatr   twisted.python.utilr   twisted.web.suxr	   r
   rP   warningStringwarnDeprecationWarningr   r!   r1   HTML_ESCAPE_CHARSlistREV_HTML_ESCAPE_CHARSreverseXML_ESCAPE_CHARSREV_XML_ESCAPE_CHARSr9   r<   	Exceptionr>   r]   r   r   r   r   r   r  r   r  r"  r   r  r  r  r!  r  r'  r)  r+  rO   r   r   <module>rV     s  " # 
    1 ) / 1;BBWYB23 	m/A >6
&  ./     $'99 ,-      /  ) 
Y 
6K KtQt Qh2d 2<+D +/m /.(6= (6V= ( L	*M *ud up	@Y @F$N+>>" "r   