+
    Ĝi%                         R t ^ RIHt ^ RIHt ^ RIHtHt ^ RIHtH	t	  ^ RI
Ht  ! R R]P                  4      tR	 t ! R
 R]4      t ! R R4      tR tR#   ] d    R t L>i ; i)a?  
SAX-based adapter to copy trees from/to the Python standard library.

Use the `ElementTreeContentHandler` class to build an ElementTree from
SAX events.

Use the `ElementTreeProducer` class or the `saxify()` function to fire
the SAX events of an ElementTree against a SAX ContentHandler.

See https://lxml.de/sax.html
)ContentHandler)etree)ElementTree
SubElement)CommentProcessingInstruction)GenericAliasc                 :    V P                    R VP                    R2# )[])__name__clsitems   &&Q/Users/mibo/.openclaw/workspace/.venv-ak/lib/python3.14/site-packages/lxml/sax.py_GenericAliasr      s    ,,qq11    c                       ] tR t^tRtRtR# )SaxErrorzGeneral SAX error.
     N)r   
__module____qualname____firstlineno____doc____static_attributes__r   r   r   r   r      s    r   r   c                 x    V ^ ,          R8X  d*   RV 9   d#   \        V R,          P                  R^4      4      # RV 3# )    {}:   NNN)tuplesplit)tags   &r   	_getNsTagr#       s7    
1v}SW]]3*++Syr   c                      a  ] tR t^'t o RtRR ltR t]! ]]P                  R7      tR t	R t
R tR	 tR
 tR tRR ltR tR tRR ltR tR t]tR tRtV tR# )ElementTreeContentHandlerz/Build an lxml ElementTree from SAX events.
    Nc                    \         P                  ! V 4       R V n        . V n        . V n        R V n        R R ./V n        / V n        Vf   \        P                  pWn
        R # N)r   __init___root_root_siblings_element_stack_default_ns_ns_mapping_new_mappingsr   Element_makeelement)selfmakeelements   &&r   r(   "ElementTreeContentHandler.__init__*   s[    %
  !TF,--K'r   c                ,    \        V P                  4      # )z=Contains the generated ElementTree after parsing is finished.)r   r)   r1   s   &r   
_get_etree$ElementTreeContentHandler._get_etree6   s    4::&&r   )docc                    R # r'   r   )r1   locators   &&r   setDocumentLocator,ElementTreeContentHandler.setDocumentLocator<       r   c                    R # r'   r   r5   s   &r   startDocument'ElementTreeContentHandler.startDocument?   r=   r   c                    R # r'   r   r5   s   &r   endDocument%ElementTreeContentHandler.endDocumentB   r=   r   c                    W P                   V&    V P                  V,          P                  V4       Vf	   W n        R # R #   \         d    T.T P                  T&    L+i ; ir'   )r.   r-   appendKeyErrorr,   )r1   prefixuris   &&&r   startPrefixMapping,ElementTreeContentHandler.startPrefixMappingE   sc    %(6"	-V$++C0 >"   	-(+uDV$	-s   "A   AAc                t    V P                   V,          pVP                  4        Vf   VR,          V n        R # R # N)r-   popr,   )r1   rG   ns_uri_lists   && r   endPrefixMapping*ElementTreeContentHandler.endPrefixMappingN   s2    &&v.>*2D r   c                    Vw  r#V'       d   R V,          pV# V P                   '       d   RV P                   : RV: 2pV# TpV# ){%s}%sr   r   )r,   )r1   ns_name_tuplens_uri
local_nameel_tags   &&   r   	_buildTag#ElementTreeContentHandler._buildTagT   sO    *-F
 	 !%!1!1:>F   Fr   c                   V P                  V4      pV'       dF   / p VP                  4       pV F+  w  rxV^ ,          '       d   RV,          p	M	V^,          p	WV	&   K-  	  MRpV P                  p
V P
                  fy   V P                  WEV P                  4      ;qn        V P                  '       d7   \        VR4      '       d%   V P                   F  pVP                  V4       K  	  V P                  R M\        V
R,          VWPP                  4      pV
P                  V4       V P                  P                  4        R#   \         d    TP                  4       p EL/i ; i)r   rS   Naddprevious:NNNrM   )rX   	iteritemsAttributeErroritemsr+   r)   r0   r.   r*   hasattrr[   r   rE   clear)r1   ns_nameqname
attributesel_nameattrsiter_attributes
name_tuplevalue	attr_nameelement_stackelementsiblings   &&&&         r   startElementNS(ElementTreeContentHandler.startElementNS^   s9   ..)E5","6"6"8 &5!
a== (: 5I *1I#(i  &5 E++::''8J8JKLGj"""ww'F'F#22G''0  3##A& r!2G!&(:(:<GW%  "3 " 5","2"2"45s   D> >EEc                    \        W4      pV P                  f   V P                  P                  V4       R # V P                  R,          P                  V4       R # rL   )r   r)   r*   rE   r+   )r1   targetdatapis   &&& r   processingInstruction/ElementTreeContentHandler.processingInstruction   sC    "60::&&r*#**2.r   c                    V P                   P                  4       pV P                  V4      pWCP                  8w  d   \	        R V,           4      hR# )zUnexpected element closed: N)r+   rN   rX   r"   r   )r1   ra   rb   rk   rW   s   &&&  r   endElementNS&ElementTreeContentHandler.endElementNS   sD    %%))+([[ 86ABB !r   c                    V'       d'   VP                  4        UUu/ uF
  w  r4R V3VbK  	  pppV P                  R V3W4       R # u uppi r'   )r^   rm   )r1   namerc   kvs   &&&  r   startElement&ElementTreeContentHandler.startElement   sH    3=3C3C3EF3E414)Q,3EJFT4L$; Gs   Ac                .    V P                  R V3V4       R # r'   )rv   )r1   ry   s   &&r   
endElement$ElementTreeContentHandler.endElement   s    4,-r   c                    V P                   R,          p VR,          pVP                  ;'       g    RV,           Vn        R#   \         d'    TP                  ;'       g    RT,           Tn         R# i ; i)r    NrM   )r+   tail
IndexErrortext)r1   rq   last_elements   && r   
characters$ElementTreeContentHandler.characters   sm    **2.	A'+L
 ".!2!2!8!8bD @L	  	A!-!2!2!8!8bD @L	As   	A A3 A32A3c                    \        W4      # r'   )r   r   s   &&r   __class_getitem__+ElementTreeContentHandler.__class_getitem__   s    S''r   )r,   r+   r0   r.   r-   r)   r*   r'   )r   r   r   r   r   r(   r6   propertyr   r;   r?   rB   rI   rP   rX   rm   rs   rv   r|   r   r   ignorableWhitespacer   r   __classdictcell____classdict__s   @r   r%   r%   '   sy     
(' ZZ%7%78E#/#B/C<
.	A %( (r   r%   c                   <   a  ] tR t^t o RtR tR tR tR tRt	V t
R# )ElementTreeProducerz5Produces SAX events for an element and children.
    c                     VP                  4       pY0n        W n        ^ RIHp W@n        V! / / 4      V n        R#   \         d    Tp L7i ; i)r   )AttributesNSImplN)getrootr]   _element_content_handlerxml.sax.xmlreaderr   _attr_class_empty_attributes)r1   element_or_treecontent_handlerrk   
attr_classs   &&&  r   r(   ElementTreeProducer.__init__   sP    	&%--/G   /D%!+B!3  	&%G	&s   : A
	A
c                b   V P                   P                  4        V P                  p\        VR 4      '       dp   . pVP	                  4       p\        VRR4      \        J d$   VP                  V4       VP	                  4       pK8  VRRR1,           F  pV P                  V/ 4       K  	  V P                  V/ 4       \        VR4      '       dJ   VP                  4       p\        VRR4      \        J d%   V P                  V/ 4       VP                  4       pK9  V P                   P                  4        R# )getpreviousr"   NgetnextrM   )r   r?   r   r_   r   getattrr   rE   _recursive_saxifyr   rB   )r1   rk   siblingsrl   s   &   r   saxifyElementTreeProducer.saxify   s    ++---7M**H))+G'5$/3HH(!--/#DbD>>&&w3 * 	w+7I&&oo'G'5$/3HH&&w3!//+))+r   c           	        V P                   pVP                  pV\        J g   V\        J dX   V\        J d'   VP	                  VP
                  VP                  4       VP                  pV'       d   VP                  V4       R # VP                  p. pWb8w  dD   VP                  4        F/  w  rVP                  V4      V	8w  g   K  VP                  W34       K1  	  VP                  4       p
V
'       dW   / p/ pV
 F:  w  r\        V4      pWV&   V P                  V^ ,          V^,          VR RR7      W&   K<  	  V P                  W4      pMV P                   p\        V4      w  p	pV P                  V	VWaP"                  RR7      pV F  w  ppVP%                  VV4       K  	  VP'                  V	V3VV4       VP                  pV'       d   VP                  V4       V F  pV P)                  VV4       K  	  VP+                  V	V3V4       V F  w  ppVP-                  V4       K  	  VP                  pV'       d   VP                  V4       R # R # )NT)preferred_prefixis_attributeF)r   )r   r"   r   r   rs   rp   r   r   r   nsmapr^   getrE   r#   _build_qnamer   r   rG   rI   rm   r   rv   rP   )r1   rk   parent_nsmapr   r"   r   element_nsmapnew_prefixesrG   rU   attribsattr_valuesattr_qnamesattr_ns_namerh   attr_ns_tuplesax_attributesrV   rb   rH   r   childs   &&&                   r   r   %ElementTreeProducer._recursive_saxify   s&   //kk'>S$99++55NNGLL2<<D**40("/"5"5"7##F+v5 ''&)9; #8 --/KK'.# ), 7-2M*-1->->!!$mA&6%) .? .>* (/ "--kGN!33N&s^
!!J~~E " S (KFC..vs; (&&Z %	9||&&t,E""5-8 $$fj%95A'KFC,,V4 (||&&t, r   c                F   Vf   V# V'       g   VP                  V4      V8X  d   TpM_VP                  4        UUu. uF  w  rxVf   K  W8X  g   K  VNK  	  p	pp\        V	4      ^8X  d
   V	^ ,          MV	'       d   \        V	4      MR pVf   V# VR,           V,           # u uppi )N:)r   r^   lenmin)
r1   rU   rV   r   r   r   rG   pfxrH   
candidatess
   &&&&&&    r   r    ElementTreeProducer._build_qname  s    >		*: ;v E%F ',kkm&3
 '*} m  
 "%ZA!5
1(2S_  >|j((s   BBB)r   r   r   r   N)r   r   r   r   r   r(   r   r   r   r   r   r   s   @r   r   r      s$     	4,.4-l) )r   r   c                4    \        W4      P                  4       # )zdOne-shot helper to generate SAX events from an XML tree and fire
them against a SAX ContentHandler.
)r   r   )r   r   s   &&r   r   r     s     @GGIIr   N)r   xml.sax.handlerr   lxmlr   
lxml.etreer   r   r   r   typesr   r   ImportError	LxmlErrorr   r#   r%   r   r   r   r   r   <module>r      sn   
 +  . 523u 
|( |(~p) p)fJI  222s   A 
A%$A%