eE"Sr/SQrSrSSKrSSKrSSKrSSKrSSKrSSKrSSK r SSK r SSK J r "SS\ 5rS r"S S 5r04S jrSCS jrSCSjr\r"SS5r"SS5r\ R.S5rSCSjrSr1SkrSrSr\\\S.rSrSSSSSS S!S".r \ \l S#r!S$r"S%r#S&r$SDSSS'S(.S)jjr%"S*S+\RL5r'SDSSS'S(.S,jjr(S-r)SES.jr*SCS/jr+SDS0jr,"S1S25r-SCS3jr.SCS4jr/\.r0SCS5jr1"S6S75r2"S8S95r3SCSSS:.S;jjr4\Rj"S<\Rl5Rnr8"S=S>5r9S?r:S@r;\rr> \>"\\5 g!\?a gf=f)FaLightweight XML support for Python. XML is an inherently hierarchical data format, and the most natural way to represent it is with a tree. This module has two classes for this purpose: 1. ElementTree represents the whole XML document as a tree and 2. Element represents a single node in this tree. Interactions with the whole document (reading and writing to/from files) are usually done on the ElementTree level. Interactions with a single XML element and its sub-elements are done on the Element level. Element is a flexible container object designed to store hierarchical data structures in memory. It can be described as a cross between a list and a dictionary. Each Element has a number of properties associated with it: 'tag' - a string containing the element's name. 'attributes' - a Python dictionary storing the element's attributes. 'text' - a string containing the element's text content. 'tail' - an optional string containing text after the element's end tag. And a number of child elements stored in a Python sequence. To create an element instance, use the Element constructor, or the SubElement factory function. You can also use the ElementTree class to wrap an element structure and convert it to and from XML. )CommentdumpElement ElementTree fromstringfromstringlistindent iselement iterparseparse ParseErrorPIProcessingInstructionQName SubElementtostring tostringlist TreeBuilderVERSIONXMLXMLID XMLParser XMLPullParserregister_namespace canonicalizeC14NWriterTargetz1.3.0N) ElementPathc\rSrSrSrSrg)r kzAn error when parsing an XML document. In addition to its exception value, a ParseError contains two extra attributes: 'code' - the specific exception code 'position' - the line and column of the error N)__name__ __module__ __qualname____firstlineno____doc____static_attributes__r!;/opt/imh/python3.13/lib/python3.13/xml/etree/ElementTree.pyr r ks  r(r c[US5$)z2Return True if *element* appears to be an Element.tag)hasattr)elements r)r r ys 7E ""r(c\rSrSrSrSrSrSrSr04Sjr Sr Sr Sr Sr S rS rS rS rS rSrSrSrSrSSjrSSjrSSjrSSjrSrSSjrSrSrSrSSjr Sr!Sr"g) r~a8An XML element. This class is the reference implementation of the Element interface. An element's length is its number of subelements. That means if you want to check if an element is truly empty, you should check BOTH its length AND its text attribute. The element tag, attribute names, and attribute values can be either bytes or strings. *tag* is the element name. *attrib* is an optional dictionary containing element attributes. *extra* are additional element attributes given as keyword arguments. Example form: text...tail Nc [U[5(d#[SURR<35eXl0UEUEUl/Ulg)Nzattrib must be dict, not ) isinstancedict TypeError __class__r"r+attrib _children)selfr+r5extras r)__init__Element.__init__sM&$''  )),- -))5) r(c`SURRUR[U54-$)Nz<%s %r at %#x>)r4r"r+idr7s r)__repr__Element.__repr__s&4>>#:#:DHHbh"OOOr(c$URX5$)zCreate a new element with the same type. *tag* is a string containing the element name. *attrib* is a dictionary containing the element attributes. Do not call this method, use the SubElement factory function instead. )r4)r7r+r5s r) makeelementElement.makeelements~~c**r(cURURUR5nURUlURUlXSS&U$N)rAr+r5texttail)r7elems r)__copy__Element.__copy__s>$++6II II Q r(c,[UR5$rD)lenr6r=s r)__len__Element.__len__s4>>""r(cf[R"S[SS9 [UR5S:g$)NzTesting an element's truth value will always return True in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. stacklevelr)warningswarnDeprecationWarningrKr6r=s r)__bool__Element.__bool__s1  K 1   4>>"a''r(c URU$rDr6r7indexs r) __getitem__Element.__getitem__s~~e$$r(c[U[5(aUHnURU5 M OURU5 X RU'grD)r1slice_assert_is_elementr6)r7rZr-elts r) __setitem__Element.__setitem__sC eU # #'',  # #G , 'ur(cURU grDrXrYs r) __delitem__Element.__delitem__s NN5 !r(c\URU5 URRU5 g)zAdd *subelement* to the end of this element. The new element will appear in document order after the last existing subelement (or directly after the text, if it's the first subelement), but before the end tag for this element. Nr_r6appendr7 subelements r)rhElement.appends$  + j)r(cnUH/nURU5 URRU5 M1 g)z[Append subelements from a sequence. *elements* is a sequence with zero or more elements. Nrg)r7elementsr-s r)extendElement.extends.  G  # #G , NN ! !' * r(c\URU5 URRX5 g)z(Insert *subelement* at position *index*.N)r_r6insert)r7rZrjs r)rqElement.inserts"  + e0r(cp[U[5(d![S[U5R-5eg)Nzexpected an Element, not %s)r1 _Element_Pyr3typer")r7es r)r_Element._assert_is_elements1![))9DGrArHrLrUr[rardrhrnrqr_ryr|rrrrrrrrrrr'r!r(r)rr~s( C F1 D D$&P +#(%(" *+1 N * 8 E ; < % -!" ##,r(rc V0UEUEnURX5nURU5 U$)a|Subelement factory which creates an element instance, and appends it to an existing parent. The element tag, attribute names, and attribute values can be either bytes or Unicode strings. *parent* is the parent element, *tag* is the subelements name, *attrib* is an optional directory containing element attributes, *extra* are additional attributes given as keyword arguments. )rArh)parentr+r5r8r-s r)rrs4! % F  -G MM' Nr(c0[[5nXlU$)zComment element factory. This function creates a special element which the standard serializer serializes as an XML comment. *text* is a string containing the comment string. )rrrE)rEr-s r)rrsgGL Nr(cl[[5nXlU(aURS-U-UlU$)aProcessing Instruction element factory. This function creates a special element which the standard serializer serializes as an XML comment. *target* is a string containing the processing instruction, *text* is a string containing the processing instruction contents, if any.  )rrrE)targetrEr-s r)rrs1+,GL ||c)D0 Nr(cR\rSrSrSrSSjrSrSrSrSr S r S r S r S r S rg)riaQualified name wrapper. This class can be used to wrap a QName attribute value in order to get proper namespace handing on output. *text_or_uri* is a string containing the QName value either in the form {uri}local, or if the tag argument is given, the URI part of a QName. *tag* is an optional argument which if given, will make the first argument (text_or_uri) be interpreted as a URI, and this argument (tag) be interpreted as a local name. Nc2U(a SU<SU<3nXlg)N{}rE)r7 text_or_urir+s r)r9QName.__init__s &137K r(cUR$rDrr=s r)__str__ QName.__str__s yyr(cTSURR<SUR<S3$)N)r4r"rEr=s r)r>QName.__repr__s NN33TYY??r(c,[UR5$rD)hashrEr=s r)__hash__QName.__hash__sDIIr(c|[U[5(aURUR:*$URU:*$rDr1rrEr7others r)__le__ QName.__le__1 eU # #99 * *yyE!!r(c|[U[5(aURUR:$URU:$rDrrs r)__lt__ QName.__lt__1 eU # #99uzz) )yy5  r(c|[U[5(aURUR:$URU:$rDrrs r)__ge__ QName.__ge__rr(c|[U[5(aURUR:$URU:$rDrrs r)__gt__ QName.__gt__rr(c|[U[5(aURUR:H$URU:H$rDrrs r)__eq__ QName.__eq__rr(rrD)r"r#r$r%r&r9rr>rrrrrrr'r!r(r)rrs5  @"!"!"r(rc\rSrSrSrSSjrSrSrSSjrSSjr SS jr SS jr SS jr SS jr SS S.SjjrSrSrg)ria An XML element hierarchy. This class also provides support for serialization to and from standard XML. *element* is an optional root element node, *file* is an optional file handle or file name of an XML file whose contents will be used to initialize the tree with. NcBXlU(aURU5 ggrD)_rootr )r7r-files r)r9ElementTree.__init__ s  JJt  r(cUR$)z!Return root element of this tree.rr=s r)getrootElementTree.getroots zzr(cXlg)zReplace root element of this tree. This will discard the current contents of the tree and replace it with the given element. Use with care! Nr)r7r-s r)_setrootElementTree._setroots  r(c(Sn[US5(d[US5nSnUcU[5n[US5(a:URU5UlURU(aUR 5 $$UR S5=n(a+URU5 UR S5=n(aM+UR 5UlURU(aUR 5 $$!U(aUR 5 ff=f)aLoad external XML document into element tree. *source* is a file name or file object, *parser* is an optional parser instance that defaults to XMLParser. ParseError is raised if the parser fails to parse the document. Returns the root element of the given source document. FreadrbT _parse_wholei)r,openrrrcloserfeed)r7sourceparser close_sourcedatas r)r ElementTree.parse!s vv&&&$'FL ~"6>22 "(!4!4V! C77Dc8URRU5$)zCreate and return tree iterator for the root element. The iterator loops over all elements in this tree, in document order. *tag* is a string with the tag name to iterate over (default is to return all elements). )rrr7r+s r)rElementTree.iterCszzs##r(cUSSS:Xa"SU-n[R"SU-[SS9 URR X5$)a4Find first matching element by tag name or path. Same as getroot().find(path), which is Element.find() *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return the first matching element, or None if no element was found. Nr/.This search is broken in 1.3 and earlier, and will be fixed in a future version. If you rely on the current behaviour, change it to %rrOrP)rRrS FutureWarningrr|r}s r)r|ElementTree.findOsO 8s?:D MM-/34!   zzt00r(cUSSS:Xa"SU-n[R"SU-[SS9 URR XU5$)a=Find first matching element by tag name or path. Same as getroot().findtext(path), which is Element.findtext() *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return the first matching element, or None if no element was found. NrrrrrOrP)rRrSrrrrs r)rElementTree.findtextesS 8s?:D MM-/34!   zz""4*==r(cUSSS:Xa"SU-n[R"SU-[SS9 URR X5$)a9Find all matching subelements by tag name or path. Same as getroot().findall(path), which is Element.findall(). *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return list containing all matching elements in document order. NrrrrrOrP)rRrSrrrr}s r)rElementTree.findall{sQ 8s?:D MM-/34!   zz!!$33r(cUSSS:Xa"SU-n[R"SU-[SS9 URR X5$)a?Find all matching subelements by tag name or path. Same as getroot().iterfind(path), which is element.iterfind() *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return an iterable yielding all matching elements in document order. NrrrrrOrP)rRrSrrrr}s r)rElementTree.iterfindsQ 8s?:D MM-/34!   zz""444r(Tshort_empty_elementsc U(dSnOU[;a[SU-5eU(d US:XaSnOSn[X5upxUS:Xa?U(d+Uc5UR5S:wa!UR5S;a U"S U<S 35 US :Xa[ XpR 5 O3[ UR U5up[Un U "XpR XUS 9 SSS5 g!,(df  g=f) azWrite element tree to a file as XML. Arguments: *file_or_filename* -- file name or a file object opened for writing *encoding* -- the output encoding (default: US-ASCII) *xml_declaration* -- bool indicating if an XML declaration should be added to the output. If None, an XML declaration is added if encoding IS NOT either of: US-ASCII, UTF-8, or Unicode *default_namespace* -- sets the default XML namespace (for "xmlns") *method* -- either "xml" (default), "html, "text", or "c14n" *short_empty_elements* -- controls the formatting of elements that contain no content. If True (default) they are emitted as a single self-closed tag, otherwise they are emitted as a pair of start/end tags xmlzunknown method %rc14nutf-8us-asciiNunicode)rrz rEr) _serialize ValueError _get_writerlower_serialize_textr _namespaces) r7file_or_filenameencodingxml_declarationdefault_namespacemethodrwritedeclared_encodingqnamesr serializes r)r ElementTree.writes:F : %069: :"% ) 48RO$,^^%2&,,.6KK%()zz2%0=N%O"&v. %V/CE5 4 4s BC  C.c"URUSS9$)Nr)r )r )r7rs r) write_c14nElementTree.write_c14nszz$vz..r(rrrD)NNNN)r"r#r$r%r&r9rrr rr|rrrr rr'r!r(r)rrsZ   D $1,>,4,5." $ 3E $( 3Ej/r(rc## URnUR5S:XaU[USS5=(d S4v g[R"5n[ U[ R5(aUnO[ U[ R5(a2[ R"U5nURUR5 OF[ R"5nSUl X$lURUl URUl[ R "UUSSS9nURUR5 URU4v SSS5 g![a NWf=f!,(df  g=f![aP UR5S:XaSn[#USUSS 9nURU4v SSS5 g!,(df  g=ff=f7f) Nrr rcgNTr!r!r(r)_get_writer..sDr(xmlcharrefreplace )r errorsnewlinew)r r)r rgetattr contextlib ExitStackr1ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletellAttributeError TextIOWrapperr)rr r stackrs r)rrs-+ && >> y (!1:tDOO O%%'5.0A0ABB+D 0",,??,,-=>DNN4;;/,,.D$0DM!&J)9(A(A $4$9$9 ''19/B046 t{{+jj(**9('&*'(' ' >> y (H "C(,.15**h& &.... 'sG E:AGBE),"EAE) G E&#E)%E&&E)) E73G:,G&G7G?G G GGGGc^^^SS0m0mT(aSTT'UUU4SjnUR5GHXnURn[U[5(a#URT;aU"UR5 OD[U[ 5(aUT;aU"U5 O UbU[ LaU[La [U5 UR5HoupE[U[5(a URnUT;aU"U5 [U[5(dMKURT;dM]U"UR5 Mq URn[U[5(dGM3URT;dGMFU"UR5 GM[ TT4$)Ncj>USSS:XavUSSRSS5upTRU5nUc1[RU5nUcS[T5-nUS:waUTU'U(a U<SU<3TU'gUTU'gT(a [ S5eUTU'g![ a [ U5 gf=f)Nrrrzns%dr:z.add_qname s .RayC 9++C3#,>+//4F~!'#j/!9*0 3/5s$;F5M$'F5M$$3!&u  . &u - .sA8B<BBB21B2) rr+r1rrErrr r4r) rGr r8r+rrrErrs ` @@r)rrs7D\FJ(* $%.8 hh c5 ! !xxv%#((# S ! !& # _G!32 &s +**,JC#u%%hh& #%''EJJf,D%**% 'yy dE " "tyy'> dii '( : r(c URnURnU[La U"SU-5 GOU[La U"SU-5 GOX&nUc/U(aU"[ U55 UHn[ XUSUS9 M GOYU"SU-5 [ UR55n U (dU(aU(aH[UR5SS9H+upU (aSU -n U"SU <S [U 5<S 35 M- U Hhup[U [5(a U Rn [U [5(aX*Rn O [U 5n U"S X+<S U <S 35 Mj U(d[U5(dU(dDU"S 5 U(aU"[ U55 UHn[ XUSUS9 M U"S U-S -5 OU"S5 UR(aU"[ UR55 gg)N rrc US$Nrr!xs r)r _serialize_xml..hQqTr(rr1 xmlns=""rr)r+rErr _escape_cdata_serialize_xmllistrsorted_escape_attribr1rrKrF) r rGrrrkwargsr+rErvrvks r)rIrIRs ((C 99D g~ kD ! % % hok ;mD)*u4HJ #) &E  &z'7'7'9+9!; #aA*1- !;"DA!!U++FF!!U++"66N*1-&)Q78"s4yy(<c --.A"5VT8LNdSj3&'e  yy mDII&'r(>brhrcolimgwbrareabaselinkmetaembedframeinputparamtrackrisindexbasefontc <URnURnU[LaU"S[U5-5 GOU[LaU"S[U5-5 GOX%nUc0U(aU"[U55 UHn[ XUS5 M GObU"SU-5 [ UR55nU(dU(aU(aH[UR5SS9H+upU (aSU -n U"SU <S[U 5<S 35 M- UHhup[U [5(a U Rn [U [5(aX)Rn O [U 5n U"S X*<SU <S 35 Mj U"S 5 UR5n U(a&U S :XdU S :Xa U"U5 OU"[U55 UHn[ XUS5 M U [;aU"SU-S -5 UR(aU"[UR55 gg)Nr;r<rc US$r>r!r?s r)r!_serialize_html..rBr(rCr1rDrErFrrscriptstylerG)r+rErrHr_serialize_htmlrJrrKrLr1r_escape_attrib_htmlr HTML_EMPTYrF) r rGrrrMr+rErvrrNrOltags r)reres ((C 99D g~ kM$//0 % % ht,,-k ;mD)*&$7 #) &E  &z'7'7'9+9!; #aA*1- !;"DA!!U++FF!!U++"66N/2&)Q78" #J99;D8#tw$K--.&$7:%dSj3&' yy mDII&'r(cUR5H nU"U5 M UR(aU"UR5 ggrD)rrF)r rGparts r)rrs1  d   yy diir()rhtmlrEc[R"SU5(a [S5e[[R 55Hup#X!:XdX0:XdM[U M U[U'g)a\Register a namespace prefix. The registry is global, and any existing mapping for either the given prefix or the namespace URI will be removed. *prefix* is the namespace prefix, *uri* is a namespace uri. Tags and attributes in this namespace will be serialized with prefix if possible. ValueError is raised if prefix is reserved or is invalid. zns\d+$z'Prefix format reserved for internal useN)rematchrrJr3r)r7r6rOrNs r)rrsX xx 6""BCC^))+, 8q{q!-!N3r(rrkrdfwsdlxsxsidc)$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/1999/xhtmlz+http://www.w3.org/1999/02/22-rdf-syntax-ns#z http://schemas.xmlsoap.org/wsdl/z http://www.w3.org/2001/XMLSchemaz)http://www.w3.org/2001/XMLSchema-instancez http://purl.org/dc/elements/1.1/cP[SU<S[U5R<S35e)Nzcannot serialize z (type ))r3rur"rs r)r4r4s! +/d1D1DE  r(cSU;aURSS5nSU;aURSS5nSU;aURSS5nU$![[4a [U5 gf=f)N&&r<r>replacer3r+r4rs r)rHrHso ) $;<<W-D $;<<V,D $;<<V,D ~ &)"4()A A A*)A*cSU;aURSS5nSU;aURSS5nSU;aURSS5nSU;aURSS5nS U;aURS S 5nS U;aURS S 5nS U;aURS S5nU$![[4a [U5 gf=f)Nrxryrrzrr{rF" z rz  z r|rs r)rLrLs) $;<<W-D $;<<V,D $;<<V,D 4<<<h/D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sB)B,,C  C cSU;aURSS5nSU;aURSS5nSU;aURSS5nU$![[4a [U5 gf=f)Nrxryrr{rFrr|rs r)rfrfsm ) $;<<W-D $;<<V,D 4<<<h/D ~ &)"4()r~T)r r rc US:Xa[R"5O[R"5n[U5R XaUUUUS9 UR 5$)aGenerate string representation of XML element. All subelements are included. If encoding is "unicode", a string is returned. Otherwise a bytestring is returned. *element* is an Element instance, *encoding* is an optional output encoding defaulting to US-ASCII, *method* is an optional output which can be one of "xml" (default), "html", "text" or "c14n", *default_namespace* sets the default XML namespace (for "xmlns"). Returns an (optionally) encoded string containing the XML data. rr r r r)r"StringIOBytesIOrr getvalue)r-r r r r rstreams r)rr+sT ')3R[[]Fv/>1B&,4H J ?? r(c6\rSrSrSrSrSrSrSrSr Sr g ) _ListDataStreamiCz7An auxiliary stream accumulating into a list reference.cXlgrDlst)r7rs r)r9_ListDataStream.__init__Esr(cgrr!r=s r)r(_ListDataStream.writableHr(cgrr!r=s r)r)_ListDataStream.seekableKrr(c:URRU5 grD)rrh)r7bs r)r _ListDataStream.writeNs r(c,[UR5$rD)rKrr=s r)r*_ListDataStream.tellQs488}r(rN) r"r#r$r%r&r9r(r)r r*r'r!r(r)rrCsAr(rc X/n[U5n[U5RXqUUUUS9 U$)Nr)rrr )r-r r r r rrrs r)rrTsA C S !Fv/>1B&,4H J Jr(c[U[5(d [U5nUR[RSS9 UR 5R nU(a USS:wa [RRS5 gg)aWrite element tree or element structure to sys.stdout. This function should be used for debugging only. *elem* is either an ElementTree, or a single Element. The exact output format is implementation dependent. In this version, it's written as an ordinary XML file. r)r rN)r1rr sysstdoutrrF)rGrFs r)rrase dK ( (4 JJszzIJ. <<>  D 48t# $r(c^^^[U[5(aUR5nUS:a[SU35e[ U5(dgSUT--/mUUU4SjmT"US5 g)aIndent an XML document by inserting newlines and indentation space after elements. *tree* is the ElementTree or Element to modify. The (root) element itself will not be changed, but the tail text of all elements in its subtree will be adapted. *space* is the whitespace to insert for each indentation level, two space characters by default. *level* is the initial indentation level. Setting this to a higher value than 0 can be used for indenting subtrees that are more deeply nested inside of a document. rz,Initial indentation level must be >= 0, got Nrc>US-nTUnUR(aURR5(dX0lUHSn[ U5(aT"XB5 UR (a!UR R5(aMMX4lMU WR R5(d TUUlgg![a TUT-nTRU5 Nf=fr>) IndexErrorrhrEstriprKrF)rGlevel child_levelchild_indentationchild_indent_children indentationsspaces r)r indent.._indent_childrensai  3 ,[ 9  yy  1 1)IE5zz 4::UZZ%5%5%7%7. zz!!%e,EJ" 3 ,U 3e ;     1 2 3sC#C-,C-)r1rrrrK)treerrrrs ` @@r)rrtsg$ $$||~ qyGwOPP t9955=()L-,T1r(c<[5nURX5 U$)zParse XML document into element tree. *source* is a filename or file object containing XML data, *parser* is an optional parser instance defaulting to XMLParser. Return an ElementTree instance. )rr )rrrs r)r r s =DJJv Kr(c^^^^^ [XS9m[TS5(d[TS5mSmOSmUUU 4SjnU"T5m"UUU4SjS[RR 5nU"5nS Ul[R"U5m U$) a&Incrementally parse XML document into ElementTree. This class also reports what's going on to the user based on the *events* it is initialized with. The supported events are the strings "start", "end", "start-ns" and "end-ns" (the "ns" events are used to get detailed namespace information). If *events* is omitted, only "end" events are reported. *source* is a filename or file object containing XML data, *events* is a list of events to report back, *parser* is an optional parser instance. Returns an iterator providing (event, elem) pairs. )events_parserrrTFc3|># TR5ShvN URS5nU(dOTRU5 MDTR5nTR5ShvN T"5nUbX#lT(aUR 5 ggNN/!T(aUR 5 ff=f7f)Ni@) read_eventsrr_close_and_return_rootrootr)rrritr pullparserwrs r)iteratoriterparse..iterators %11333{{9-% 446D!--/ / /B~ 4 0  s?B<BBAB-B.BB<BBB99B<cN>\rSrSrYRrUUU4SjrUU4SjrSrg)$iterparse..IterParseIteratoricT>T(aTR5 TR5 grDr)r7rgenrs r)r*iterparse..IterParseIterator.closes  IIKr(c6>T(aTR5 ggrDr)r7rrs r)__del__,iterparse..IterParseIterator.__del__s r(r!N)r"r#r$r%__next__rrr')rrrsr)IterParseIteratorrs<<    r(rN) rr,r collectionsabcIteratorrweakrefref) rrrrrrrrrrs ` @@@@r)r r s"f=J 66 " "fd#  $ 6 C  KOO44   BBG RB Ir(cD\rSrSrS SS.SjjrSrSrSrSrS r S r g) riN)rc[R"5UlU=(d [[ 5S9UlUcSnUR R URU5 g)Nr)end)rdeque _events_queuerrr _setevents)r7rrs r)r9XMLPullParser.__init__sL )..0A);="A >F  2 2F;r(cURc [S5eU(aURRU5 gg![a%nURR U5 SnAgSnAff=f)Feed encoded data to parser.Nz!feed() called after end of stream)rrr SyntaxErrorrrh)r7rexcs r)rXMLPullParser.feeds` << @A A  / !!$'  /""))#.. /s> A-A((A-cHURR5nSUlU$rD)rr)r7rs r)r$XMLPullParser._close_and_return_roots ||!!#  r(c$UR5 g)zFinish feeding data to parser. Unlike XMLParser, does not return the root element. Use read_events() to consume elements from XMLPullParser. N)rr=s r)rXMLPullParser.closes ##%r(c## URnU(a5UR5n[U[5(aUeUv U(aM4gg7f)zReturn an iterator over currently available (event, elem) pairs. Events are consumed from the internal event queue as they are retrieved from the iterator. N)rpopleftr1 Exception)r7revents r)rXMLPullParser.read_eventss? ##NN$E%++  fs AA  A chURc [S5eURR5 g)Nz"flush() called after end of stream)rrflushr=s r)rXMLPullParser.flush+s( << AB B r()rrrD) r"r#r$r%r9rrrrrr'r!r(r)rrs' r(cU(d[[5S9nURU5 UR5n0nUR 5H!nUR S5nU(dMXCU'M# X#4$)aParse XML document from string constant for its IDs. *text* is a string containing XML data, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an (Element, dict) tuple, in which the dict maps element id:s to elements. rr<)rrrrrr)rErridsrGr<s r)rrBsb +-0 KK <<>D C  XXd^ 2G 9r(cU(d[[5S9nUHnURU5 M UR5$)zParse XML document from sequence of string fragments. *sequence* is a list of other sequence, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an Element instance. rr)sequencerrEs r)rrZs5 +-0 D <<>r(cd\rSrSrSrSSSSSS.SjjrSrSrS rS r S r S r SS jr Sr Srg)rilaGeneric element structure builder. This builder converts a sequence of start, data, and end method calls to a well-formed element structure. You can use this class to build an element structure using a custom XML parser, or a parser for some other XML-like format. *element_factory* is an optional element factory which is called to create new Element instances, as necessary. *comment_factory* is a factory to create comments to be used instead of the standard factory. If *insert_comments* is false (the default), comments will not be inserted into the tree. *pi_factory* is a factory to create processing instructions to be used instead of the standard factory. If *insert_pis* is false (the default), processing instructions will not be inserted into the tree. NF)comment_factory pi_factoryinsert_comments insert_pisc/Ul/UlSUlSUlSUlUc[ nX lX@lUc[nX0l XPl Uc[nXl grD) _data_elem_lastr_tailr_comment_factoryrr _pi_factoryrr_factory)r7element_factoryrrrrs r)r9TreeBuilder.__init__sd      "%O /.  .J%$  "%O' r(c[UR5S:XdS5eURcS5eUR$)z;Flush builder buffers and return toplevel document Element.rzmissing end tagszmissing toplevel element)rKrrr=s r)rTreeBuilder.closes>4::!#7%77#zz%A'AA%zzr(cbUR(aURbSRUR5nUR(a/URRbS5eXRlO.URR bS5eXRl/Ulgg)Nr/zinternal error (tail)zinternal error (text))rrjoinrrFrEr7rEs r)_flushTreeBuilder._flushs~ ::zz%wwtzz*::::??2K4KK2&*JJO::??2K4KK2&*JJODJ r(c:URRU5 g)zAdd text to current element.N)rrhr7rs r)rTreeBuilder.datas $r(c UR5 URX5=UlnUR(aURSR U5 OUR cX0lURR U5 SUlU$)znOpen new element and return it. *tag* is the element name, *attrs* is a dict containing element attributes. rr)rrrrrhrr)r7r+attrsrGs r)startTreeBuilder.startsl  MM#55 T :: JJrN ! !$ ' ZZ J $  r(cUR5 URR5UlURRU:Xd$SURR<SU<S35eSUlUR$)z?Close and return current Element. *tag* is the element name. zend tag mismatch (expected z, got rvr)rrpoprr+rrs r)rTreeBuilder.endsa ZZ^^% zz~~$ (::>>3( ($ zzr(cPURURURU5$)zPCreate a comment using the comment_factory. *text* is the text of the comment. )_handle_singlerrrs r)commentTreeBuilder.comments* ""  ! !4#7#7? ?r(cPURURURX5$)zCreate a processing instruction using the pi_factory. *target* is the target name of the processing instruction. *text* is the data of the processing instruction, or ''. )r rr)r7rrEs r)piTreeBuilder.pis( ""   doov= =r(cU"U6nU(aLUR5 X@lUR(aURSRU5 SUlU$)Nrr)rrrrhr)r7factoryrqargsrGs r)r TreeBuilder._handle_singlesE~  KKMJzz 2%%d+DJ r() rrrrrrrrrrrD)r"r#r$r%r&r9rrrrrr r r r'r!r(r)rrlsC&(!%$!&5((  " ?=r(rcj\rSrSrSrSSS.SjrSrSrSrS r S r S r S r S r SrSrSrSrg)riaMElement structure builder for XML source data based on the expat parser. *target* is an optional target object which defaults to an instance of the standard TreeBuilder class, *encoding* is an optional encoding string which if given, overrides the encoding specified in the XML file: http://www.iana.org/assignments/character-sets N)rr cSSKJn UR US5nUc [ 5nU=UlUlU=UlUl URUl 0Ul URUl[US5(aUR Ul[US5(aUR$Ul[US5(aUR(Ul[US5(aUR,Ul[US 5(aUR0Ul[US 5(aUR4Ul[US 5(aUR8UlS UlS UlSUl 0Ul!S URD-Ul#g![a" SSKnGN![a [S5ef=ff=f![Ha gf=f)Nrexpatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrstart_nsend_nsrr r rzExpat %d.%d.%d)% xml.parsersr ImportErrorpyexpat ParserCreaterrrr_targeterror_error_names_defaultDefaultHandlerExpandr,_startStartElementHandler_endEndElementHandler _start_nsStartNamespaceDeclHandler_end_nsEndNamespaceDeclHandlerrCharacterDataHandlerr CommentHandlerr ProcessingInstructionHandler buffer_textordered_attributes_doctypeentity version_infoversionr+)r7rr rrs r)r9XMLParser.__init__s  )##Hc2 > ]F%++ dl%++ dlkk  &*mm# 67 # #)-F & 65 ! !'+yyF $ 6: & &/3~~F , 68 $ $-1\\F * 66 " "*0++F ' 69 % %$*NNF ! 64 28))F /$%!   +e.@.@@DLM  ' !M  N   s/F 7F; F8FF44F8; GGcBURnURnUGHnUS:Xa SUlXTUR4SjnXclM*US:XaXTUR 4SjnXclMIUS:Xa;[URS5(aXTUR4SjnOXT4S jnXcl MUS :Xa;[URS 5(aXTUR4S jnOXT4S jnXcl MUS:XaXTU4SjnXcl MUS:XaXTU4SjnXclM[SU-5e g)Nrrc"U"X$"X545 grDr!)r+ attrib_inrrhrs r)handler%XMLParser._setevents..handler)sE5#89:r(rc"U"X"U545 grDr!)r+rrhrs r)r8r9.sE3s8,-r(zstart-nsrc"U"X$"X545 grDr!)r7r6rrhrs r)r8r95sx'<=>r(c>U"X =(d SU=(d S445 gNr/r!)r7r6rrhs r)r8r99s "ciR'@ABr(zend-nsrc"U"X"U545 grDr!)r7rrhrs r)r8r9?svf~67r(cU"US45 grDr!)r7rrhs r)r8r9Cst}-r(r cHU"XRRU545 grD)rr )rErrhr7s r)r8r9GsE;;#6#6t#<=>r(r cHU"X$RRX545 grD)rr ) pi_targetrrrhr7s r)r8r9KsE;;>>)#BCDr(zunknown event %r)rrhr/r#r$r%r&r,rr'r(r)r*r,r-r)r7 events_queueevents_to_reportrrh event_namer8s r)rXMLParser._seteventss$$*JW$,-)2<"&++;.5*u$'1 $ .,3(z)4;; 333=)-?4>C3:0x'4;;11.8'+||8/9.18.y((2?(/%t#3=!%E7>3 !3j!@AAU+r(cx[U5nURUlURUR4UlUerD)r codelinenooffsetposition)r7rerrs r) _raiseerrorXMLParser._raiseerrorRs0::||U\\1  r(c~URUnU$![a UnSU;aSU-nX RU'U$f=f)Nrr)r KeyError)r7rnames r)_fixnameXMLParser._fixnameXsS $;;s#D   $Dd{Tz#KK   $s %<<c^URRU=(d SU=(d S5$r=)rrr7r7r6s r)r'XMLParser._start_nscs!{{##FLb#)<A??B BczURR5nURRS5 URRSS5 URRU5 g!URanUR U5 SnANBSnAff=f!URRU5 f=f)NFr()rGetReparseDeferralEnabledSetReparseDeferralEnabledrrrrM)r7 was_enabledrNs r)rXMLParser.flushskk;;=  ? KK 1 1% 8 KK  c5 ) KK 1 1+ >{{   Q    KK 1 1+ >s)7A//B?BBBBB:) r0rr rrr1rrr3)r"r#r$r%r&r9rrMrRr'r)r#r%r!rrrr'r!r(r)rrsN"&+Z3Bj =0 .34%l *"?r(r)out from_filec UcUc [S5eSnUc[R"5=pA[[ UR 40UD6S9nUb"UR U5 UR5 O Ub [X%S9 UbUR5$S$)aConvert XML to its C14N 2.0 serialised form. If *out* is provided, it must be a file or file-like object that receives the serialised canonical XML output (text, not bytes) through its ``.write()`` method. To write to a file, open it in text mode with encoding "utf-8". If *out* is not provided, this function returns the output as text string. Either *xml_data* (an XML string) or *from_file* (a file path or file-like object) must be provided as input. The configuration options are the same as for the ``C14NWriterTarget``. Nz:Either 'xml_data' or 'from_file' must be provided as inputr)r) rr"rrrr rrr r)xml_datar|r}optionssiors r)rrsI-UVV C {KKM! .syyDGD EF H    i' _3<<>6$6r(z ^\w+:\w+$c\rSrSrSrSSSSSSSS.Sjr\4SjrSrSS jr S r S R4S jr S r SrSSjrSrSrSrSrg)ria Canonicalization writer target for the XMLParser. Serialises parse events to XML C14N 2.0. The *write* function is used for writing out the resulting data stream as text (not bytes). To write to a file, open it in text mode with encoding "utf-8" and pass its ``.write`` method. Configuration options: - *with_comments*: set to true to include comments - *strip_text*: set to true to strip whitespace before and after text content - *rewrite_prefixes*: set to true to replace namespace prefixes by "n{number}" - *qname_aware_tags*: a set of qname aware tag names in which prefixes should be replaced in text content - *qname_aware_attrs*: a set of qname aware attribute names in which prefixes should be replaced in text content - *exclude_attrs*: a set of attribute names that should not be serialised - *exclude_tags*: a set of tag names that should not be serialised FN) with_comments strip_textrewrite_prefixesqname_aware_tagsqname_aware_attrs exclude_attrs exclude_tagsc\Xl/UlX lX0lU(a [ U5OSUlU(a [ U5OSUlX@lU(a[ U5UlOSUlU(a[ U5RUl OSUl S//Ul /Ul U(d6URR[[R!555 URR/5 0UlS/UlSUlSUlSUlSUlg)N)rtrFr)_writer_with_comments _strip_textr_exclude_attrs _exclude_tags_rewrite_prefixes_qname_aware_tags intersection_find_qname_aware_attrs_declared_ns_stack _ns_stackrhrJr3r _prefix_map_preserve_space_pending_start _root_seen _root_done_ignored_depth) r7r rrrrrrrs r)r9C14NWriterTarget.__init__ s  +%4Ac-0t2>S.D!1 %()9%:D "%)D " +./@+A+N+ND (+/D ( <$ #  NN ! !$~';';'="> ? b! %w"r(c#T# U"U5HnU(dM UShvN M gN 7frDr!)r7ns_stack _reversedrs r)_iter_namespaces!C14NWriterTarget._iter_namespaces/s%#H-Jz%%%.%s((& (cURSS5up#URUR5HupEXR:XdM SUSU3s $ [SUSUS35e)Nr1rrrzPrefix z of QName "" is not declared in scope)splitrrr)r7 prefixed_namer7rQr6ps r)_resolve_prefix_name%C14NWriterTarget._resolve_prefix_name4sf$**32 ++DNN;FC{C54&))<76(+m_D^_``r(cUc%USSS:XaUSSRSS5OSU4up#OUn[5nURUR5H4upVXR:XaXd;aU(aUSU3OUX24s $UR U5 M6 UR (amX R ;aUR UnO&S[UR 53=o`R U'URSRX&45 USU3X24$U(d SU;aX3U4$URUR5H=upVXR:XdM URSRX&45 U(aUSU3OUX24s $ U(dX3U4$[SUS 35e) Nrrrr/r1rmrz Namespace "r) r2rrraddrrrKrhrr)r7r5r6r+ prefixes_seenur7s r)_qnameC14NWriterTarget._qname;s ;38!93CuQRy''Q/"eHCC ..t/F/FGIAxF7,2&3%(SEE   f %H  ! !&&&))#.34S9I9I5J4K1LL))#.  # #B ' . .} =XQse$c. .r.S= ..t~~>IAx''+22C=A,2&3%(SEE? S= ;se+EFGGr(c^UR(dURRU5 ggrD)rrrhrs r)rC14NWriterTarget.data`s""" JJ  d ##r(r/cU"UR5nURSS2 UR(a$URS(dUR5nURbFURSso0lU(a[ U5(aUOSnUR "/UQUP76 UbgU(a-UR(aUR[U55 gggNr) rrrrr_looks_like_prefix_namer#rr_escape_cdata_c14n)r7 _join_textrr qname_texts r)rC14NWriterTarget._flushds$**% JJqM   D$8$8$<::) rrrrrrhrrr#)r7r+rnew_namespacess r)rC14NWriterTarget.startzs    )##s.@.@'@   1 $   :: KKM &&~6  ! ! -#9O9O2O#&~">D   C/r(cURb<U(a5UR5VVs0sHupVXPR;dMXV_M nnnU1Ukn0nUb&URU5=oU'URU 5 URbhU(aaUR U5n U (aFU H?n X+n [ U 5(dMURU 5=oU 'URU 5 MA OSn OSn UR n [USS9Vs0sH oU "U5_M nnU(a6UVVs/sHunnU(aSU-OSU4PM nnnUR5 O/nU(a][UR55H@upVU bXZ;aXh;a XUSnXunn nURU(aUOU U45 MB URS5nURRU(aUS:HOURS5 URnU"S XS-5 U(a<U"S RUVVs/sHupVS US [U5S 3PM snn55 U"S5 UbU"[XUS55 SUlUR"R/5 gs snnfs snfs snnfs snnf)Nc&URSS5$)Nrr)r)rms r)r)C14NWriterTarget._start..s!''#q/r(rCzxmlns:xmlnsrz+{http://www.w3.org/XML/1998/namespace}spacepreserverrr/rrErFrT)rrrrrrrrKsortrhrrrr_escape_attrib_c14nrrr)r7r+rrrrOrNrresolved_namesr5qattrs attr_namer parse_qnamerm parsed_qnamesr6r7r[ attr_qnamespace_behaviourr s r)r#C14NWriterTarget._starts    *u&+kkmTmdaq@S@S7STQTmET  !151J1J:1V VE:. JJu   ' ' 311%8F!'I!,E.u558<8Q8QRW8XXu 5 5) "( Fkk 4: 153453qKN*53 4 $2#1KC'-F"'3?#1  NN I u{{}-%!+!:M%Q&78;A-:-=* Is  *A!FG . ))$QR ##-)rrrrrrrrrs r)r C14NWriterTarget.commentsw""      ?? KK  __ KKM d-d34C89 KK r(ctUR(agUR(aURS5 O2UR(a!UR(aUR 5 URU(aSUS[ U5S3OSUS35 UR(dURS5 gg)Nrz)rrrrrrr)r7rrs r)r C14NWriterTarget.pis     ?? KK  __ KKM :>b,T232 6bPRO U KK r()rrrrrrrrrrrrrrrrrrD)r"r#r$r%r&r9reversedrrrrrrrrr#rr r r'r!r(r)rrsj, %"&$#$# J4<& a#HJ$!# 210"C"J   r(rc SU;aURSS5nSU;aURSS5nSU;aURSS5nSU;aURSS5nU$![[4a [U5 gf=f) Nrxryrrzrr{r r|rs r)rrs) $;<<W-D $;<<V,D $;<<V,D 4<<<g.D ~ &)"4()sA!A$$BBcjSU;aURSS5nSU;aURSS5nSU;aURSS5nSU;aURSS5nS U;aURS S 5nS U;aURS S 5nU$![[4a [U5 gf=f) NrxryrrzrFrrz rz rrr|rs r)rr s) $;<<W-D $;<<V,D $;<<X.D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sBBB21B2)r)_set_factoriesrDr)z r)@r&__all__rrrmrRr"rcollections.abcr rr/rrr r rrrrr rrcontextmanagerrrrIrgrerrrr3r4rHrLrfrr#rrrrr r rrrrrrrrcompileUNICODErnrrrrrt _elementtreerrr!r(r)rs!P (       # ^^B $&$  +"+"`\/\/B /+/+b;z0(d 0(d    !*-2$*38(.(,16(, %3! ) )8 )!T"&0b''" !%&* &/l <~77t",  $vvth?h?Z7tt7<**\2::>DDD)&). 3K+712  s% E<<FF