�ɲɾ�����ӯ�����һ��ˣ��������С���˴��ͣ�������P���ҹ��ñ˽��ά�Բ��������˸߸ԣ�������ơ��ҹ��ñ�����ά�Բ���ˡ���˳^�ӣ������ӡ� ���ͯj�ӣ��ƺ���ӣ� ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!cElementTree.pyo000064400000000260152530264050007651 0ustar00 {fc@sddlTdS(i(t*N(t _elementtree(((s./usr/lib64/python2.7/xml/etree/cElementTree.pyttcElementTree.py000064400000000122152530264050007467 0ustar00# Deprecated alias for xml.etree.ElementTree from xml.etree.ElementTree import * __init__.pyc000064400000000201152530264050007013 0ustar00 {fc@sdS(N((((s*/usr/lib64/python2.7/xml/etree/__init__.pyttElementInclude.pyo000064400000003657152530264050010207 0ustar00 {fc@shddlZddlmZdZedZedZdefdYZdd Z dd Z dS( iNi(t ElementTrees!{http://www.w3.org/2001/XInclude}tincludetfallbacktFatalIncludeErrorcBseZRS((t__name__t __module__(((s0/usr/lib64/python2.7/xml/etree/ElementInclude.pyR>scCsat|O}|dkr3tj|j}n$|j}|rW|j|}nWdQX|S(Ntxml(topenRtparsetgetroottreadtdecode(threfRtencodingtfiletdata((s0/usr/lib64/python2.7/xml/etree/ElementInclude.pytdefault_loaderMs  cCs|dkrt}nd}x|t|kr||}|jtkr|jd}|jdd}|dkr|||}|dkrtd||fntj|}|jr|jpd|j|_n|||3s    cElementTree.pyc000064400000000260152530264050007635 0ustar00 {fc@sddlTdS(i(t*N(t _elementtree(((s./usr/lib64/python2.7/xml/etree/cElementTree.pyttElementTree.pyo000064400000104001152530264050007504 0ustar00 {fc@s>dddddddddd d d d d dddddddgZdZddlZddlZddlZdefdYZyddlmZWne k reZnXd e fdYZ dZ defdYZ e ZZidZed Zed!ZeZd efd"YZdefd#YZed$Zd%Zd&d'd(d)d*d+d,d-d.d/d0d1d2f ZyeeZWnek rnXd3Zd4Zied56ed66ed76Zd8Zid5d96d6d:6d;d<6d=d>6d?d@6dAdB6dCdD6Z dEZ!dFZ"dGZ#dHZ$dIZ%eedJZ&eedKZ'dLZ(edMZ)eedNZ*dOefdPYZ+edQZ,edRZ-e,Z.edSZ/defdTYZ0dUgZ1defdVYZ2e2Z3yddWl4m5Z5e5edX(treprRtid(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__repr__scCs|j||S(N(t __class__(RRR,((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt makeelementscCs;|j|j|j}|j|_|j|_||(|S(N(R4RR,Rttail(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR*s   cCs t|jS(N(tlenR-(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__len__scCs)tjdtddt|jdkS(NsyThe behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.t stacklevelii(twarningstwarnt FutureWarningR6R-(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt __nonzero__s cCs |j|S(N(R-(Rtindex((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt __getitem__ scCs||j||D]6}x|jD] }|VqWW|jrD|jVqDqDWdS(N(RR(t basestringRRtitertextR5(RRRQts((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRUs      N(!R%R&RRR,RR5R/R2R4R*R7R<R>R?R@RARBRDRERGRR R$R"RIRJRMRNROR!RSRU(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRs<             cKs<|j}|j||j||}|j||S(N(R*R+R4RA(tparentRR,R.R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR s    cCstt}||_|S(N(RRR(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR"s  cCs6tt}||_|r2|jd||_n|S(Nt (RR R(ttargetRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR 1s   cBs/eZddZdZdZdZRS(cCs&|rd||f}n||_dS(Ns{%s}%s(R(Rt text_or_uriR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/EscCs|jS(N(R(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__str__IscCs t|jS(N(thashR(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__hash__KscCs2t|tr"t|j|jSt|j|S(N(R(R tcmpR(Rtother((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__cmp__MsN(R%R&RR/R[R]R`(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR Ds   cBseZd d dZdZdZd dZd dZd dZd dZ d d dZ d dZ d d Z d d d d d Z d ZRS( cCs#||_|r|j|ndS(N(t_rootR(RRtfile((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/_s cCs|jS(N(Ra(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytgetrootkscCs ||_dS(N(Ra(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt_setrootuscCst}t|ds-t|d}t}nzb|sKtdt}nx*|jd}|sgPn|j|qNW|j|_ |j SWd|r|jnXdS(NtreadtrbRYi( tFalseR)topentTrueRRRetfeedtcloseRa(Rtsourcetparsert close_sourcetdata((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRs   cCs|jj|S(N(RaR!(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR!scCs)tjdtddt|j|S(NsbThis method will be removed in future versions. Use 'tree.iter()' or 'list(tree.iter())' instead.R8i(R9R:RRR#R!(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRSs cCsJ|d dkr7d|}tjd|tddn|jj||S(Nit/t.sThis 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 %rR8i(R9R:R;RaR(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRs cCsM|d dkr7d|}tjd|tddn|jj|||S(NiRpRqsThis 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 %rR8i(R9R:R;RaR (RRHRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR s cCsJ|d dkr7d|}tjd|tddn|jj||S(NiRpRqsThis 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 %rR8i(R9R:R;RaR$(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR$s cCsJ|d dkr7d|}tjd|tddn|jj||S(NiRpRqsThis 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 %rR8i(R9R:R;RaR"(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR"s c Cs=|sd}n|tkr.td|nt|drF|}nt|d}|j}|s|dkryd}qd}n>|s|dkr|d kr|dkr|d|qn|d krt||j|n>t|j||\}} t|} | ||j||| ||k r9|j ndS( Ntxmlsunknown method %rtwritetwbtc14nsutf-8sus-asciis$ R(sutf-8sus-ascii( t _serializet ValueErrorR)RhRsRt_serialize_textRat _namespacesRk( Rtfile_or_filenametencodingtxml_declarationtdefault_namespacetmethodRbRstqnamesRt serialize((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRss0            cCs|j|ddS(NR~Ru(Rs(RRb((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt write_c14n8sN(R%R&RR/RcRdRR!RSRR R$R"RsR(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR]s        c sidd6ir&d       $     c Css|j}|j}|tkr8|dt||n|tkr^|dt||n||}|dkr|r|t||nx|D]}t||||dqWn|d||j}|s|r|rNxet |jddD]E\} } | r!d| } n|d| j |t | |fqWnx~t |D]m\} } t | t r| j} nt | t r|| j} nt | |} |d|| | fq[Wn|st|rC|d |r|t||nx$|D]}t||||dqW|d |d n |d |jro|t|j|ndS( Ns stRt:s xmlns%s="%s"s %s="%s"t>s(RRRt_encodeR Rt _escape_cdatat_serialize_xmlROtsortedRt_escape_attribR(R R6R5( RsRR{RRRRRQROtvtk((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRsP                tareatbasetbasefonttbrtcoltframethrtimgtinputtisindextlinktmetatparamc Cs|j}|j}|tkr8|dt||n?|tkr^|dt||n||}|dkr|r|t||nx|D]}t||||dqWn|d||j}|s|r|rNxet|jddD]E\} } | r!d| } n|d| j |t | |fqWnx~t|D]m\} } t | t r| j} nt | t r|| j} nt | |} |d|| | fq[Wn|d |j} |r/| d ks| d kr|t||q/|t||nx$|D]}t||||dq6W| tkrw|d |d n|jr|t|j|ndS( Ns sRRKcSs|dS(Ni((R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRRRs xmlns%s="%s"s %s="%s"Rtscripttstyles;s       U      D /  2           b   M  __init__.pyo000064400000000201152530264050007027 0ustar00 {fc@sdS(N((((s*/usr/lib64/python2.7/xml/etree/__init__.pyttElementPath.pyc000064400000016702152530264050007477 0ustar00 {fc@sddlZejdZddZdZdZdZdZdZ d Z d Z ied 6ed 6ed 6e d6e d6e d6Z iZ dddYZddZddZddZdddZdS(iNsY('[^']*'|"[^"]*"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+ccsxtj|D]}|d}|r|ddkrd|kryH|jdd\}}|sltn|dd|||ffVWqtk rtd|qXq|VqWdS(Niit{t:s{%s}%ss!prefix %r not found in prefix map(txpath_tokenizer_retfindalltsplittKeyErrort SyntaxError(tpatternt namespacesttokenttagtprefixturi((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytxpath_tokenizerIs " ! cCs^|j}|dkrZi|_}x5|jjD]!}x|D]}|||tjd |d r>|dfd}|S|dkrtjd |d r|d|dfd}|S|dks|dks|dkrQ|dkrt|ddnl|ddkrtdn|dkr8yt|ddWq>tk r4tdq>Xndfd}|StddS(Nit]is'"t'it-ts@-c3s2x+|D]#}|jdk r|VqqWdS(N(tgetR(RRR(tkey(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs s@-='c3s2x+|D]#}|jkr|VqqWdS(N(R&(RRR(R'tvalue(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs s\d+$c3s2x+|D]#}|jdk r|VqqWdS(N(tfindR(RRR(R (s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs s-='c3sSxL|D]D}x;|jD]*}dj|jkr|VPqqWqWdS(NR%(Rtjointitertext(RRRR(R R((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs  s-()s-()-tlastsunsupported functionisunsupported expressionc3syt|}xf|D]^}y>||}t|j|j}||krV|VnWqttfk rpqXqWdS(N(RtlistRR t IndexErrorR(RRRRR telems(tindex(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs    sinvalid predicate(tappendR*tretmatchtintRt ValueError(RR t signaturet predicateR((R0R'R R(s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_predicatesV      # #  $    R%Rt.s..s//t[t_SelectorContextcBseZdZdZRS(cCs ||_dS(N(R(tselfR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyt__init__sN(t__name__t __module__RRR=(((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR;sc Csn|ddkr|d}nyt|}Wntk r4ttdkrZtjn|d dkrytdntt||j}|}g}xy"|jt |d||Wnt k rtdnXy)|}|ddkr |}nWqt k r"PqXqW|t|;s.      P  $ ElementPath.py000064400000033624152530264050007336 0ustar00# # ElementTree # $Id: ElementPath.py 3375 2008-02-13 08:05:08Z fredrik $ # # limited xpath support for element trees # # history: # 2003-05-23 fl created # 2003-05-28 fl added support for // etc # 2003-08-27 fl fixed parsing of periods in element names # 2007-09-10 fl new selection engine # 2007-09-12 fl fixed parent selector # 2007-09-13 fl added iterfind; changed findall to return a list # 2007-11-30 fl added namespaces support # 2009-10-30 fl added child element value filter # # Copyright (c) 2003-2009 by Fredrik Lundh. All rights reserved. # # fredrik@pythonware.com # http://www.pythonware.com # # -------------------------------------------------------------------- # The ElementTree toolkit is # # Copyright (c) 1999-2009 by Fredrik Lundh # # By obtaining, using, and/or copying this software and/or its # associated documentation, you agree that you have read, understood, # and will comply with the following terms and conditions: # # Permission to use, copy, modify, and distribute this software and # its associated documentation for any purpose and without fee is # hereby granted, provided that the above copyright notice appears in # all copies, and that both that copyright notice and this permission # notice appear in supporting documentation, and that the name of # Secret Labs AB or the author not be used in advertising or publicity # pertaining to distribution of the software without specific, written # prior permission. # # SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD # TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- # ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE # OF THIS SOFTWARE. # -------------------------------------------------------------------- # Licensed to PSF under a Contributor Agreement. # See https://www.python.org/psf/license for licensing details. ## # Implementation module for XPath support. There's usually no reason # to import this module directly; the ElementTree does this for # you, if needed. ## import re xpath_tokenizer_re = re.compile( r"(" r"'[^']*'|\"[^\"]*\"|" r"::|" r"//?|" r"\.\.|" r"\(\)|" r"!=|" r"[/.*:\[\]\(\)@=])|" r"((?:\{[^}]+\})?[^/\[\]\(\)@!=\s]+)|" r"\s+" ) def xpath_tokenizer(pattern, namespaces=None): default_namespace = namespaces.get('') if namespaces else None parsing_attribute = False for token in xpath_tokenizer_re.findall(pattern): ttype, tag = token if tag and tag[0] != "{": if ":" in tag: prefix, uri = tag.split(":", 1) try: if not namespaces: raise KeyError yield ttype, "{%s}%s" % (namespaces[prefix], uri) except KeyError: raise SyntaxError("prefix %r not found in prefix map" % prefix) from None elif default_namespace and not parsing_attribute: yield ttype, "{%s}%s" % (default_namespace, tag) else: yield token parsing_attribute = False else: yield token parsing_attribute = ttype == '@' def get_parent_map(context): parent_map = context.parent_map if parent_map is None: context.parent_map = parent_map = {} for p in context.root.iter(): for e in p: parent_map[e] = p return parent_map def _is_wildcard_tag(tag): return tag[:3] == '{*}' or tag[-2:] == '}*' def _prepare_tag(tag): _isinstance, _str = isinstance, str if tag == '{*}*': # Same as '*', but no comments or processing instructions. # It can be a surprise that '*' includes those, but there is no # justification for '{*}*' doing the same. def select(context, result): for elem in result: if _isinstance(elem.tag, _str): yield elem elif tag == '{}*': # Any tag that is not in a namespace. def select(context, result): for elem in result: el_tag = elem.tag if _isinstance(el_tag, _str) and el_tag[0] != '{': yield elem elif tag[:3] == '{*}': # The tag in any (or no) namespace. suffix = tag[2:] # '}name' no_ns = slice(-len(suffix), None) tag = tag[3:] def select(context, result): for elem in result: el_tag = elem.tag if el_tag == tag or _isinstance(el_tag, _str) and el_tag[no_ns] == suffix: yield elem elif tag[-2:] == '}*': # Any tag in the given namespace. ns = tag[:-1] ns_only = slice(None, len(ns)) def select(context, result): for elem in result: el_tag = elem.tag if _isinstance(el_tag, _str) and el_tag[ns_only] == ns: yield elem else: raise RuntimeError(f"internal parser error, got {tag}") return select def prepare_child(next, token): tag = token[1] if _is_wildcard_tag(tag): select_tag = _prepare_tag(tag) def select(context, result): def select_child(result): for elem in result: yield from elem return select_tag(context, select_child(result)) else: if tag[:2] == '{}': tag = tag[2:] # '{}tag' == 'tag' def select(context, result): for elem in result: for e in elem: if e.tag == tag: yield e return select def prepare_star(next, token): def select(context, result): for elem in result: yield from elem return select def prepare_self(next, token): def select(context, result): yield from result return select def prepare_descendant(next, token): try: token = next() except StopIteration: return if token[0] == "*": tag = "*" elif not token[0]: tag = token[1] else: raise SyntaxError("invalid descendant") if _is_wildcard_tag(tag): select_tag = _prepare_tag(tag) def select(context, result): def select_child(result): for elem in result: for e in elem.iter(): if e is not elem: yield e return select_tag(context, select_child(result)) else: if tag[:2] == '{}': tag = tag[2:] # '{}tag' == 'tag' def select(context, result): for elem in result: for e in elem.iter(tag): if e is not elem: yield e return select def prepare_parent(next, token): def select(context, result): # FIXME: raise error if .. is applied at toplevel? parent_map = get_parent_map(context) result_map = {} for elem in result: if elem in parent_map: parent = parent_map[elem] if parent not in result_map: result_map[parent] = None yield parent return select def prepare_predicate(next, token): # FIXME: replace with real parser!!! refs: # http://javascript.crockford.com/tdop/tdop.html signature = [] predicate = [] while 1: try: token = next() except StopIteration: return if token[0] == "]": break if token == ('', ''): # ignore whitespace continue if token[0] and token[0][:1] in "'\"": token = "'", token[0][1:-1] signature.append(token[0] or "-") predicate.append(token[1]) signature = "".join(signature) # use signature to determine predicate type if signature == "@-": # [@attribute] predicate key = predicate[1] def select(context, result): for elem in result: if elem.get(key) is not None: yield elem return select if signature == "@-='" or signature == "@-!='": # [@attribute='value'] or [@attribute!='value'] key = predicate[1] value = predicate[-1] def select(context, result): for elem in result: if elem.get(key) == value: yield elem def select_negated(context, result): for elem in result: if (attr_value := elem.get(key)) is not None and attr_value != value: yield elem return select_negated if '!=' in signature else select if signature == "-" and not re.match(r"\-?\d+$", predicate[0]): # [tag] tag = predicate[0] def select(context, result): for elem in result: if elem.find(tag) is not None: yield elem return select if signature == ".='" or signature == ".!='" or ( (signature == "-='" or signature == "-!='") and not re.match(r"\-?\d+$", predicate[0])): # [.='value'] or [tag='value'] or [.!='value'] or [tag!='value'] tag = predicate[0] value = predicate[-1] if tag: def select(context, result): for elem in result: for e in elem.findall(tag): if "".join(e.itertext()) == value: yield elem break def select_negated(context, result): for elem in result: for e in elem.iterfind(tag): if "".join(e.itertext()) != value: yield elem break else: def select(context, result): for elem in result: if "".join(elem.itertext()) == value: yield elem def select_negated(context, result): for elem in result: if "".join(elem.itertext()) != value: yield elem return select_negated if '!=' in signature else select if signature == "-" or signature == "-()" or signature == "-()-": # [index] or [last()] or [last()-index] if signature == "-": # [index] index = int(predicate[0]) - 1 if index < 0: raise SyntaxError("XPath position >= 1 expected") else: if predicate[0] != "last": raise SyntaxError("unsupported function") if signature == "-()-": try: index = int(predicate[2]) - 1 except ValueError: raise SyntaxError("unsupported expression") if index > -2: raise SyntaxError("XPath offset from last() must be negative") else: index = -1 def select(context, result): parent_map = get_parent_map(context) cache = {} for elem in result: try: parent = parent_map[elem] except KeyError: continue key = (parent, elem.tag) if key not in cache: # FIXME: what if the selector is "*" ? elems = parent.findall(elem.tag) try: cache[key] = elems[index] except IndexError: cache[key] = None if cache[key] is elem: yield elem return select raise SyntaxError("invalid predicate") ops = { "": prepare_child, "*": prepare_star, ".": prepare_self, "..": prepare_parent, "//": prepare_descendant, "[": prepare_predicate, } _cache = {} class _SelectorContext: parent_map = None def __init__(self, root): self.root = root # -------------------------------------------------------------------- ## # Generate all matching objects. def iterfind(elem, path, namespaces=None): # compile selector pattern if path[-1:] == "/": path = path + "*" # implicit all (FIXME: keep this?) cache_key = (path,) if namespaces: cache_key += tuple(sorted(namespaces.items())) try: selector = _cache[cache_key] except KeyError: if len(_cache) > 100: _cache.clear() if path[:1] == "/": raise SyntaxError("cannot use absolute path on element") next = iter(xpath_tokenizer(path, namespaces)).__next__ try: token = next() except StopIteration: return selector = [] while 1: try: selector.append(ops[token[0]](next, token)) except StopIteration: raise SyntaxError("invalid path") from None try: token = next() if token[0] == "/": token = next() except StopIteration: break _cache[cache_key] = selector # execute selector pattern result = [elem] context = _SelectorContext(elem) for select in selector: result = select(context, result) return result ## # Find first matching object. def find(elem, path, namespaces=None): return next(iterfind(elem, path, namespaces), None) ## # Find all matching objects. def findall(elem, path, namespaces=None): return list(iterfind(elem, path, namespaces)) ## # Find text for first matching object. def findtext(elem, path, default=None, namespaces=None): try: elem = next(iterfind(elem, path, namespaces)) if elem.text is None: return "" return elem.text except StopIteration: return default ElementPath.pyo000064400000016702152530264050007513 0ustar00 {fc@sddlZejdZddZdZdZdZdZdZ d Z d Z ied 6ed 6ed 6e d6e d6e d6Z iZ dddYZddZddZddZdddZdS(iNsY('[^']*'|"[^"]*"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+ccsxtj|D]}|d}|r|ddkrd|kryH|jdd\}}|sltn|dd|||ffVWqtk rtd|qXq|VqWdS(Niit{t:s{%s}%ss!prefix %r not found in prefix map(txpath_tokenizer_retfindalltsplittKeyErrort SyntaxError(tpatternt namespacesttokenttagtprefixturi((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytxpath_tokenizerIs " ! cCs^|j}|dkrZi|_}x5|jjD]!}x|D]}|||tjd |d r>|dfd}|S|dkrtjd |d r|d|dfd}|S|dks|dks|dkrQ|dkrt|ddnl|ddkrtdn|dkr8yt|ddWq>tk r4tdq>Xndfd}|StddS(Nit]is'"t'it-ts@-c3s2x+|D]#}|jdk r|VqqWdS(N(tgetR(RRR(tkey(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs s@-='c3s2x+|D]#}|jkr|VqqWdS(N(R&(RRR(R'tvalue(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs s\d+$c3s2x+|D]#}|jdk r|VqqWdS(N(tfindR(RRR(R (s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs s-='c3sSxL|D]D}x;|jD]*}dj|jkr|VPqqWqWdS(NR%(Rtjointitertext(RRRR(R R((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs  s-()s-()-tlastsunsupported functionisunsupported expressionc3syt|}xf|D]^}y>||}t|j|j}||krV|VnWqttfk rpqXqWdS(N(RtlistRR t IndexErrorR(RRRRR telems(tindex(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs    sinvalid predicate(tappendR*tretmatchtintRt ValueError(RR t signaturet predicateR((R0R'R R(s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_predicatesV      # #  $    R%Rt.s..s//t[t_SelectorContextcBseZdZdZRS(cCs ||_dS(N(R(tselfR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyt__init__sN(t__name__t __module__RRR=(((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR;sc Csn|ddkr|d}nyt|}Wntk r4ttdkrZtjn|d dkrytdntt||j}|}g}xy"|jt |d||Wnt k rtdnXy)|}|ddkr |}nWqt k r"PqXqW|t|;s.      P  $ ElementTree.py000064400000220441152530264050007334 0ustar00"""Lightweight 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. """ #--------------------------------------------------------------------- # Licensed to PSF under a Contributor Agreement. # See https://www.python.org/psf/license for licensing details. # # ElementTree # Copyright (c) 1999-2008 by Fredrik Lundh. All rights reserved. # # fredrik@pythonware.com # http://www.pythonware.com # -------------------------------------------------------------------- # The ElementTree toolkit is # # Copyright (c) 1999-2008 by Fredrik Lundh # # By obtaining, using, and/or copying this software and/or its # associated documentation, you agree that you have read, understood, # and will comply with the following terms and conditions: # # Permission to use, copy, modify, and distribute this software and # its associated documentation for any purpose and without fee is # hereby granted, provided that the above copyright notice appears in # all copies, and that both that copyright notice and this permission # notice appear in supporting documentation, and that the name of # Secret Labs AB or the author not be used in advertising or publicity # pertaining to distribution of the software without specific, written # prior permission. # # SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD # TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- # ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE # OF THIS SOFTWARE. # -------------------------------------------------------------------- __all__ = [ # public symbols "Comment", "dump", "Element", "ElementTree", "fromstring", "fromstringlist", "indent", "iselement", "iterparse", "parse", "ParseError", "PI", "ProcessingInstruction", "QName", "SubElement", "tostring", "tostringlist", "TreeBuilder", "VERSION", "XML", "XMLID", "XMLParser", "XMLPullParser", "register_namespace", "canonicalize", "C14NWriterTarget", ] VERSION = "1.3.0" import sys import re import warnings import io import collections import collections.abc import contextlib import weakref from . import ElementPath class ParseError(SyntaxError): """An 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 """ pass # -------------------------------------------------------------------- def iselement(element): """Return True if *element* appears to be an Element.""" return hasattr(element, 'tag') class Element: """An 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 """ tag = None """The element's name.""" attrib = None """Dictionary of the element's attributes.""" text = None """ Text before first subelement. This is either a string or the value None. Note that if there is no text, this attribute may be either None or the empty string, depending on the parser. """ tail = None """ Text after this element's end tag, but before the next sibling element's start tag. This is either a string or the value None. Note that if there was no text, this attribute may be either None or an empty string, depending on the parser. """ def __init__(self, tag, attrib={}, **extra): if not isinstance(attrib, dict): raise TypeError("attrib must be dict, not %s" % ( attrib.__class__.__name__,)) self.tag = tag self.attrib = {**attrib, **extra} self._children = [] def __repr__(self): return "<%s %r at %#x>" % (self.__class__.__name__, self.tag, id(self)) def makeelement(self, tag, attrib): """Create 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. """ return self.__class__(tag, attrib) def __copy__(self): elem = self.makeelement(self.tag, self.attrib) elem.text = self.text elem.tail = self.tail elem[:] = self return elem def __len__(self): return len(self._children) def __bool__(self): warnings.warn( "Testing an element's truth value will always return True in " "future versions. " "Use specific 'len(elem)' or 'elem is not None' test instead.", DeprecationWarning, stacklevel=2 ) return len(self._children) != 0 # emulate old behaviour, for now def __getitem__(self, index): return self._children[index] def __setitem__(self, index, element): if isinstance(index, slice): for elt in element: self._assert_is_element(elt) else: self._assert_is_element(element) self._children[index] = element def __delitem__(self, index): del self._children[index] def append(self, subelement): """Add *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. """ self._assert_is_element(subelement) self._children.append(subelement) def extend(self, elements): """Append subelements from a sequence. *elements* is a sequence with zero or more elements. """ for element in elements: self._assert_is_element(element) self._children.append(element) def insert(self, index, subelement): """Insert *subelement* at position *index*.""" self._assert_is_element(subelement) self._children.insert(index, subelement) def _assert_is_element(self, e): # Need to refer to the actual Python implementation, not the # shadowing C implementation. if not isinstance(e, _Element_Py): raise TypeError('expected an Element, not %s' % type(e).__name__) def remove(self, subelement): """Remove matching subelement. Unlike the find methods, this method compares elements based on identity, NOT ON tag value or contents. To remove subelements by other means, the easiest way is to use a list comprehension to select what elements to keep, and then use slice assignment to update the parent element. ValueError is raised if a matching element could not be found. """ # assert iselement(element) self._children.remove(subelement) def find(self, path, namespaces=None): """Find first matching element by tag name or path. *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. """ return ElementPath.find(self, path, namespaces) def findtext(self, path, default=None, namespaces=None): """Find text for first matching element by tag name or path. *path* is a string having either an element tag or an XPath, *default* is the value to return if the element was not found, *namespaces* is an optional mapping from namespace prefix to full name. Return text content of first matching element, or default value if none was found. Note that if an element is found having no text content, the empty string is returned. """ return ElementPath.findtext(self, path, default, namespaces) def findall(self, path, namespaces=None): """Find all matching subelements by tag name or path. *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Returns list containing all matching elements in document order. """ return ElementPath.findall(self, path, namespaces) def iterfind(self, path, namespaces=None): """Find all matching subelements by tag name or path. *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. """ return ElementPath.iterfind(self, path, namespaces) def clear(self): """Reset element. This function removes all subelements, clears all attributes, and sets the text and tail attributes to None. """ self.attrib.clear() self._children = [] self.text = self.tail = None def get(self, key, default=None): """Get element attribute. Equivalent to attrib.get, but some implementations may handle this a bit more efficiently. *key* is what attribute to look for, and *default* is what to return if the attribute was not found. Returns a string containing the attribute value, or the default if attribute was not found. """ return self.attrib.get(key, default) def set(self, key, value): """Set element attribute. Equivalent to attrib[key] = value, but some implementations may handle this a bit more efficiently. *key* is what attribute to set, and *value* is the attribute value to set it to. """ self.attrib[key] = value def keys(self): """Get list of attribute names. Names are returned in an arbitrary order, just like an ordinary Python dict. Equivalent to attrib.keys() """ return self.attrib.keys() def items(self): """Get element attributes as a sequence. The attributes are returned in arbitrary order. Equivalent to attrib.items(). Return a list of (name, value) tuples. """ return self.attrib.items() def iter(self, tag=None): """Create tree iterator. The iterator loops over the element and all subelements in document order, returning all elements with a matching tag. If the tree structure is modified during iteration, new or removed elements may or may not be included. To get a stable set, use the list() function on the iterator, and loop over the resulting list. *tag* is what tags to look for (default is to return all elements) Return an iterator containing all the matching elements. """ if tag == "*": tag = None if tag is None or self.tag == tag: yield self for e in self._children: yield from e.iter(tag) def itertext(self): """Create text iterator. The iterator loops over the element and all subelements in document order, returning all inner text. """ tag = self.tag if not isinstance(tag, str) and tag is not None: return t = self.text if t: yield t for e in self: yield from e.itertext() t = e.tail if t: yield t def SubElement(parent, tag, attrib={}, **extra): """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. """ attrib = {**attrib, **extra} element = parent.makeelement(tag, attrib) parent.append(element) return element def Comment(text=None): """Comment 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. """ element = Element(Comment) element.text = text return element def ProcessingInstruction(target, text=None): """Processing 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. """ element = Element(ProcessingInstruction) element.text = target if text: element.text = element.text + " " + text return element PI = ProcessingInstruction class QName: """Qualified 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. """ def __init__(self, text_or_uri, tag=None): if tag: text_or_uri = "{%s}%s" % (text_or_uri, tag) self.text = text_or_uri def __str__(self): return self.text def __repr__(self): return '<%s %r>' % (self.__class__.__name__, self.text) def __hash__(self): return hash(self.text) def __le__(self, other): if isinstance(other, QName): return self.text <= other.text return self.text <= other def __lt__(self, other): if isinstance(other, QName): return self.text < other.text return self.text < other def __ge__(self, other): if isinstance(other, QName): return self.text >= other.text return self.text >= other def __gt__(self, other): if isinstance(other, QName): return self.text > other.text return self.text > other def __eq__(self, other): if isinstance(other, QName): return self.text == other.text return self.text == other # -------------------------------------------------------------------- class ElementTree: """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. """ def __init__(self, element=None, file=None): # assert element is None or iselement(element) self._root = element # first node if file: self.parse(file) def getroot(self): """Return root element of this tree.""" return self._root def _setroot(self, element): """Replace root element of this tree. This will discard the current contents of the tree and replace it with the given element. Use with care! """ # assert iselement(element) self._root = element def parse(self, source, parser=None): """Load 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. """ close_source = False if not hasattr(source, "read"): source = open(source, "rb") close_source = True try: if parser is None: # If no parser was specified, create a default XMLParser parser = XMLParser() if hasattr(parser, '_parse_whole'): # The default XMLParser, when it comes from an accelerator, # can define an internal _parse_whole API for efficiency. # It can be used to parse the whole source without feeding # it with chunks. self._root = parser._parse_whole(source) return self._root while data := source.read(65536): parser.feed(data) self._root = parser.close() return self._root finally: if close_source: source.close() def iter(self, tag=None): """Create 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). """ # assert self._root is not None return self._root.iter(tag) def find(self, path, namespaces=None): """Find 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. """ # assert self._root is not None if path[:1] == "/": path = "." + path warnings.warn( "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 %r" % path, FutureWarning, stacklevel=2 ) return self._root.find(path, namespaces) def findtext(self, path, default=None, namespaces=None): """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. """ # assert self._root is not None if path[:1] == "/": path = "." + path warnings.warn( "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 %r" % path, FutureWarning, stacklevel=2 ) return self._root.findtext(path, default, namespaces) def findall(self, path, namespaces=None): """Find 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. """ # assert self._root is not None if path[:1] == "/": path = "." + path warnings.warn( "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 %r" % path, FutureWarning, stacklevel=2 ) return self._root.findall(path, namespaces) def iterfind(self, path, namespaces=None): """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. """ # assert self._root is not None if path[:1] == "/": path = "." + path warnings.warn( "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 %r" % path, FutureWarning, stacklevel=2 ) return self._root.iterfind(path, namespaces) def write(self, file_or_filename, encoding=None, xml_declaration=None, default_namespace=None, method=None, *, short_empty_elements=True): """Write 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 """ if not method: method = "xml" elif method not in _serialize: raise ValueError("unknown method %r" % method) if not encoding: if method == "c14n": encoding = "utf-8" else: encoding = "us-ascii" with _get_writer(file_or_filename, encoding) as (write, declared_encoding): if method == "xml" and (xml_declaration or (xml_declaration is None and encoding.lower() != "unicode" and declared_encoding.lower() not in ("utf-8", "us-ascii"))): write("\n" % ( declared_encoding,)) if method == "text": _serialize_text(write, self._root) else: qnames, namespaces = _namespaces(self._root, default_namespace) serialize = _serialize[method] serialize(write, self._root, qnames, namespaces, short_empty_elements=short_empty_elements) def write_c14n(self, file): # lxml.etree compatibility. use output method instead return self.write(file, method="c14n") # -------------------------------------------------------------------- # serialization support @contextlib.contextmanager def _get_writer(file_or_filename, encoding): # returns text write method and release all resources after using try: write = file_or_filename.write except AttributeError: # file_or_filename is a file name if encoding.lower() == "unicode": encoding="utf-8" with open(file_or_filename, "w", encoding=encoding, errors="xmlcharrefreplace") as file: yield file.write, encoding else: # file_or_filename is a file-like object # encoding determines if it is a text or binary writer if encoding.lower() == "unicode": # use a text writer as is yield write, getattr(file_or_filename, "encoding", None) or "utf-8" else: # wrap a binary writer with TextIOWrapper with contextlib.ExitStack() as stack: if isinstance(file_or_filename, io.BufferedIOBase): file = file_or_filename elif isinstance(file_or_filename, io.RawIOBase): file = io.BufferedWriter(file_or_filename) # Keep the original file open when the BufferedWriter is # destroyed stack.callback(file.detach) else: # This is to handle passed objects that aren't in the # IOBase hierarchy, but just have a write method file = io.BufferedIOBase() file.writable = lambda: True file.write = write try: # TextIOWrapper uses this methods to determine # if BOM (for UTF-16, etc) should be added file.seekable = file_or_filename.seekable file.tell = file_or_filename.tell except AttributeError: pass file = io.TextIOWrapper(file, encoding=encoding, errors="xmlcharrefreplace", newline="\n") # Keep the original file open when the TextIOWrapper is # destroyed stack.callback(file.detach) yield file.write, encoding def _namespaces(elem, default_namespace=None): # identify namespaces used in this tree # maps qnames to *encoded* prefix:local names qnames = {None: None} # maps uri:s to prefixes namespaces = {} if default_namespace: namespaces[default_namespace] = "" def add_qname(qname): # calculate serialized qname representation try: if qname[:1] == "{": uri, tag = qname[1:].rsplit("}", 1) prefix = namespaces.get(uri) if prefix is None: prefix = _namespace_map.get(uri) if prefix is None: prefix = "ns%d" % len(namespaces) if prefix != "xml": namespaces[uri] = prefix if prefix: qnames[qname] = "%s:%s" % (prefix, tag) else: qnames[qname] = tag # default element else: if default_namespace: # FIXME: can this be handled in XML 1.0? raise ValueError( "cannot use non-qualified names with " "default_namespace option" ) qnames[qname] = qname except TypeError: _raise_serialization_error(qname) # populate qname and namespaces table for elem in elem.iter(): tag = elem.tag if isinstance(tag, QName): if tag.text not in qnames: add_qname(tag.text) elif isinstance(tag, str): if tag not in qnames: add_qname(tag) elif tag is not None and tag is not Comment and tag is not PI: _raise_serialization_error(tag) for key, value in elem.items(): if isinstance(key, QName): key = key.text if key not in qnames: add_qname(key) if isinstance(value, QName) and value.text not in qnames: add_qname(value.text) text = elem.text if isinstance(text, QName) and text.text not in qnames: add_qname(text.text) return qnames, namespaces def _serialize_xml(write, elem, qnames, namespaces, short_empty_elements, **kwargs): tag = elem.tag text = elem.text if tag is Comment: write("" % text) elif tag is ProcessingInstruction: write("" % text) else: tag = qnames[tag] if tag is None: if text: write(_escape_cdata(text)) for e in elem: _serialize_xml(write, e, qnames, None, short_empty_elements=short_empty_elements) else: write("<" + tag) items = list(elem.items()) if items or namespaces: if namespaces: for v, k in sorted(namespaces.items(), key=lambda x: x[1]): # sort on prefix if k: k = ":" + k write(" xmlns%s=\"%s\"" % ( k, _escape_attrib(v) )) for k, v in items: if isinstance(k, QName): k = k.text if isinstance(v, QName): v = qnames[v.text] else: v = _escape_attrib(v) write(" %s=\"%s\"" % (qnames[k], v)) if text or len(elem) or not short_empty_elements: write(">") if text: write(_escape_cdata(text)) for e in elem: _serialize_xml(write, e, qnames, None, short_empty_elements=short_empty_elements) write("") else: write(" />") if elem.tail: write(_escape_cdata(elem.tail)) HTML_EMPTY = {"area", "base", "basefont", "br", "col", "embed", "frame", "hr", "img", "input", "isindex", "link", "meta", "param", "source", "track", "wbr"} def _serialize_html(write, elem, qnames, namespaces, **kwargs): tag = elem.tag text = elem.text if tag is Comment: write("" % _escape_cdata(text)) elif tag is ProcessingInstruction: write("" % _escape_cdata(text)) else: tag = qnames[tag] if tag is None: if text: write(_escape_cdata(text)) for e in elem: _serialize_html(write, e, qnames, None) else: write("<" + tag) items = list(elem.items()) if items or namespaces: if namespaces: for v, k in sorted(namespaces.items(), key=lambda x: x[1]): # sort on prefix if k: k = ":" + k write(" xmlns%s=\"%s\"" % ( k, _escape_attrib(v) )) for k, v in items: if isinstance(k, QName): k = k.text if isinstance(v, QName): v = qnames[v.text] else: v = _escape_attrib_html(v) # FIXME: handle boolean attributes write(" %s=\"%s\"" % (qnames[k], v)) write(">") ltag = tag.lower() if text: if ltag == "script" or ltag == "style": write(text) else: write(_escape_cdata(text)) for e in elem: _serialize_html(write, e, qnames, None) if ltag not in HTML_EMPTY: write("") if elem.tail: write(_escape_cdata(elem.tail)) def _serialize_text(write, elem): for part in elem.itertext(): write(part) if elem.tail: write(elem.tail) _serialize = { "xml": _serialize_xml, "html": _serialize_html, "text": _serialize_text, # this optional method is imported at the end of the module # "c14n": _serialize_c14n, } def register_namespace(prefix, uri): """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. """ if re.match(r"ns\d+$", prefix): raise ValueError("Prefix format reserved for internal use") for k, v in list(_namespace_map.items()): if k == uri or v == prefix: del _namespace_map[k] _namespace_map[uri] = prefix _namespace_map = { # "well-known" namespace prefixes "http://www.w3.org/XML/1998/namespace": "xml", "http://www.w3.org/1999/xhtml": "html", "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", "http://schemas.xmlsoap.org/wsdl/": "wsdl", # xml schema "http://www.w3.org/2001/XMLSchema": "xs", "http://www.w3.org/2001/XMLSchema-instance": "xsi", # dublin core "http://purl.org/dc/elements/1.1/": "dc", } # For tests and troubleshooting register_namespace._namespace_map = _namespace_map def _raise_serialization_error(text): raise TypeError( "cannot serialize %r (type %s)" % (text, type(text).__name__) ) def _escape_cdata(text): # escape character data try: # it's worth avoiding do-nothing calls for strings that are # shorter than 500 characters, or so. assume that's, by far, # the most common case in most applications. if "&" in text: text = text.replace("&", "&") if "<" in text: text = text.replace("<", "<") if ">" in text: text = text.replace(">", ">") return text except (TypeError, AttributeError): _raise_serialization_error(text) def _escape_attrib(text): # escape attribute value try: if "&" in text: text = text.replace("&", "&") if "<" in text: text = text.replace("<", "<") if ">" in text: text = text.replace(">", ">") if "\"" in text: text = text.replace("\"", """) # Although section 2.11 of the XML specification states that CR or # CR LN should be replaced with just LN, it applies only to EOLNs # which take part of organizing file into lines. Within attributes, # we are replacing these with entity numbers, so they do not count. # http://www.w3.org/TR/REC-xml/#sec-line-ends # The current solution, contained in following six lines, was # discussed in issue 17582 and 39011. if "\r" in text: text = text.replace("\r", " ") if "\n" in text: text = text.replace("\n", " ") if "\t" in text: text = text.replace("\t", " ") return text except (TypeError, AttributeError): _raise_serialization_error(text) def _escape_attrib_html(text): # escape attribute value try: if "&" in text: text = text.replace("&", "&") if ">" in text: text = text.replace(">", ">") if "\"" in text: text = text.replace("\"", """) return text except (TypeError, AttributeError): _raise_serialization_error(text) # -------------------------------------------------------------------- def tostring(element, encoding=None, method=None, *, xml_declaration=None, default_namespace=None, short_empty_elements=True): """Generate 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. """ stream = io.StringIO() if encoding == 'unicode' else io.BytesIO() ElementTree(element).write(stream, encoding, xml_declaration=xml_declaration, default_namespace=default_namespace, method=method, short_empty_elements=short_empty_elements) return stream.getvalue() class _ListDataStream(io.BufferedIOBase): """An auxiliary stream accumulating into a list reference.""" def __init__(self, lst): self.lst = lst def writable(self): return True def seekable(self): return True def write(self, b): self.lst.append(b) def tell(self): return len(self.lst) def tostringlist(element, encoding=None, method=None, *, xml_declaration=None, default_namespace=None, short_empty_elements=True): lst = [] stream = _ListDataStream(lst) ElementTree(element).write(stream, encoding, xml_declaration=xml_declaration, default_namespace=default_namespace, method=method, short_empty_elements=short_empty_elements) return lst def dump(elem): """Write 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. """ # debugging if not isinstance(elem, ElementTree): elem = ElementTree(elem) elem.write(sys.stdout, encoding="unicode") tail = elem.getroot().tail if not tail or tail[-1] != "\n": sys.stdout.write("\n") def indent(tree, space=" ", level=0): """Indent 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. """ if isinstance(tree, ElementTree): tree = tree.getroot() if level < 0: raise ValueError(f"Initial indentation level must be >= 0, got {level}") if not len(tree): return # Reduce the memory consumption by reusing indentation strings. indentations = ["\n" + level * space] def _indent_children(elem, level): # Start a new indentation level for the first child. child_level = level + 1 try: child_indentation = indentations[child_level] except IndexError: child_indentation = indentations[level] + space indentations.append(child_indentation) if not elem.text or not elem.text.strip(): elem.text = child_indentation for child in elem: if len(child): _indent_children(child, child_level) if not child.tail or not child.tail.strip(): child.tail = child_indentation # Dedent after the last child by overwriting the previous indentation. if not child.tail.strip(): child.tail = indentations[level] _indent_children(tree, 0) # -------------------------------------------------------------------- # parsing def parse(source, parser=None): """Parse 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. """ tree = ElementTree() tree.parse(source, parser) return tree def iterparse(source, events=None, parser=None): """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. """ # Use the internal, undocumented _parser argument for now; When the # parser argument of iterparse is removed, this can be killed. pullparser = XMLPullParser(events=events, _parser=parser) if not hasattr(source, "read"): source = open(source, "rb") close_source = True else: close_source = False def iterator(source): try: while True: yield from pullparser.read_events() # load event buffer data = source.read(16 * 1024) if not data: break pullparser.feed(data) root = pullparser._close_and_return_root() yield from pullparser.read_events() it = wr() if it is not None: it.root = root finally: if close_source: source.close() class IterParseIterator(collections.abc.Iterator): __next__ = iterator(source).__next__ def __del__(self): if close_source: source.close() it = IterParseIterator() it.root = None wr = weakref.ref(it) return it class XMLPullParser: def __init__(self, events=None, *, _parser=None): # The _parser argument is for internal use only and must not be relied # upon in user code. It will be removed in a future release. # See https://bugs.python.org/issue17741 for more details. self._events_queue = collections.deque() self._parser = _parser or XMLParser(target=TreeBuilder()) # wire up the parser for event reporting if events is None: events = ("end",) self._parser._setevents(self._events_queue, events) def feed(self, data): """Feed encoded data to parser.""" if self._parser is None: raise ValueError("feed() called after end of stream") if data: try: self._parser.feed(data) except SyntaxError as exc: self._events_queue.append(exc) def _close_and_return_root(self): # iterparse needs this to set its root attribute properly :( root = self._parser.close() self._parser = None return root def close(self): """Finish feeding data to parser. Unlike XMLParser, does not return the root element. Use read_events() to consume elements from XMLPullParser. """ self._close_and_return_root() def read_events(self): """Return an iterator over currently available (event, elem) pairs. Events are consumed from the internal event queue as they are retrieved from the iterator. """ events = self._events_queue while events: event = events.popleft() if isinstance(event, Exception): raise event else: yield event def flush(self): if self._parser is None: raise ValueError("flush() called after end of stream") self._parser.flush() def XML(text, parser=None): """Parse XML document from string constant. This function can be used to embed "XML Literals" in Python code. *text* is a string containing XML data, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an Element instance. """ if not parser: parser = XMLParser(target=TreeBuilder()) parser.feed(text) return parser.close() def XMLID(text, parser=None): """Parse 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. """ if not parser: parser = XMLParser(target=TreeBuilder()) parser.feed(text) tree = parser.close() ids = {} for elem in tree.iter(): id = elem.get("id") if id: ids[id] = elem return tree, ids # Parse XML document from string constant. Alias for XML(). fromstring = XML def fromstringlist(sequence, parser=None): """Parse 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. """ if not parser: parser = XMLParser(target=TreeBuilder()) for text in sequence: parser.feed(text) return parser.close() # -------------------------------------------------------------------- class TreeBuilder: """Generic 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. """ def __init__(self, element_factory=None, *, comment_factory=None, pi_factory=None, insert_comments=False, insert_pis=False): self._data = [] # data collector self._elem = [] # element stack self._last = None # last element self._root = None # root element self._tail = None # true if we're after an end tag if comment_factory is None: comment_factory = Comment self._comment_factory = comment_factory self.insert_comments = insert_comments if pi_factory is None: pi_factory = ProcessingInstruction self._pi_factory = pi_factory self.insert_pis = insert_pis if element_factory is None: element_factory = Element self._factory = element_factory def close(self): """Flush builder buffers and return toplevel document Element.""" assert len(self._elem) == 0, "missing end tags" assert self._root is not None, "missing toplevel element" return self._root def _flush(self): if self._data: if self._last is not None: text = "".join(self._data) if self._tail: assert self._last.tail is None, "internal error (tail)" self._last.tail = text else: assert self._last.text is None, "internal error (text)" self._last.text = text self._data = [] def data(self, data): """Add text to current element.""" self._data.append(data) def start(self, tag, attrs): """Open new element and return it. *tag* is the element name, *attrs* is a dict containing element attributes. """ self._flush() self._last = elem = self._factory(tag, attrs) if self._elem: self._elem[-1].append(elem) elif self._root is None: self._root = elem self._elem.append(elem) self._tail = 0 return elem def end(self, tag): """Close and return current Element. *tag* is the element name. """ self._flush() self._last = self._elem.pop() assert self._last.tag == tag,\ "end tag mismatch (expected %s, got %s)" % ( self._last.tag, tag) self._tail = 1 return self._last def comment(self, text): """Create a comment using the comment_factory. *text* is the text of the comment. """ return self._handle_single( self._comment_factory, self.insert_comments, text) def pi(self, target, text=None): """Create 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 ''. """ return self._handle_single( self._pi_factory, self.insert_pis, target, text) def _handle_single(self, factory, insert, *args): elem = factory(*args) if insert: self._flush() self._last = elem if self._elem: self._elem[-1].append(elem) self._tail = 1 return elem # also see ElementTree and TreeBuilder class XMLParser: """Element 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 """ def __init__(self, *, target=None, encoding=None): try: from xml.parsers import expat except ImportError: try: import pyexpat as expat except ImportError: raise ImportError( "No module named expat; use SimpleXMLTreeBuilder instead" ) parser = expat.ParserCreate(encoding, "}") if target is None: target = TreeBuilder() # underscored names are provided for compatibility only self.parser = self._parser = parser self.target = self._target = target self._error = expat.error self._names = {} # name memo cache # main callbacks parser.DefaultHandlerExpand = self._default if hasattr(target, 'start'): parser.StartElementHandler = self._start if hasattr(target, 'end'): parser.EndElementHandler = self._end if hasattr(target, 'start_ns'): parser.StartNamespaceDeclHandler = self._start_ns if hasattr(target, 'end_ns'): parser.EndNamespaceDeclHandler = self._end_ns if hasattr(target, 'data'): parser.CharacterDataHandler = target.data # miscellaneous callbacks if hasattr(target, 'comment'): parser.CommentHandler = target.comment if hasattr(target, 'pi'): parser.ProcessingInstructionHandler = target.pi # Configure pyexpat: buffering, new-style attribute handling. parser.buffer_text = 1 parser.ordered_attributes = 1 self._doctype = None self.entity = {} try: self.version = "Expat %d.%d.%d" % expat.version_info except AttributeError: pass # unknown def _setevents(self, events_queue, events_to_report): # Internal API for XMLPullParser # events_to_report: a list of events to report during parsing (same as # the *events* of XMLPullParser's constructor. # events_queue: a list of actual parsing events that will be populated # by the underlying parser. # parser = self._parser append = events_queue.append for event_name in events_to_report: if event_name == "start": parser.ordered_attributes = 1 def handler(tag, attrib_in, event=event_name, append=append, start=self._start): append((event, start(tag, attrib_in))) parser.StartElementHandler = handler elif event_name == "end": def handler(tag, event=event_name, append=append, end=self._end): append((event, end(tag))) parser.EndElementHandler = handler elif event_name == "start-ns": # TreeBuilder does not implement .start_ns() if hasattr(self.target, "start_ns"): def handler(prefix, uri, event=event_name, append=append, start_ns=self._start_ns): append((event, start_ns(prefix, uri))) else: def handler(prefix, uri, event=event_name, append=append): append((event, (prefix or '', uri or ''))) parser.StartNamespaceDeclHandler = handler elif event_name == "end-ns": # TreeBuilder does not implement .end_ns() if hasattr(self.target, "end_ns"): def handler(prefix, event=event_name, append=append, end_ns=self._end_ns): append((event, end_ns(prefix))) else: def handler(prefix, event=event_name, append=append): append((event, None)) parser.EndNamespaceDeclHandler = handler elif event_name == 'comment': def handler(text, event=event_name, append=append, self=self): append((event, self.target.comment(text))) parser.CommentHandler = handler elif event_name == 'pi': def handler(pi_target, data, event=event_name, append=append, self=self): append((event, self.target.pi(pi_target, data))) parser.ProcessingInstructionHandler = handler else: raise ValueError("unknown event %r" % event_name) def _raiseerror(self, value): err = ParseError(value) err.code = value.code err.position = value.lineno, value.offset raise err def _fixname(self, key): # expand qname, and convert name string to ascii, if possible try: name = self._names[key] except KeyError: name = key if "}" in name: name = "{" + name self._names[key] = name return name def _start_ns(self, prefix, uri): return self.target.start_ns(prefix or '', uri or '') def _end_ns(self, prefix): return self.target.end_ns(prefix or '') def _start(self, tag, attr_list): # Handler for expat's StartElementHandler. Since ordered_attributes # is set, the attributes are reported as a list of alternating # attribute name,value. fixname = self._fixname tag = fixname(tag) attrib = {} if attr_list: for i in range(0, len(attr_list), 2): attrib[fixname(attr_list[i])] = attr_list[i+1] return self.target.start(tag, attrib) def _end(self, tag): return self.target.end(self._fixname(tag)) def _default(self, text): prefix = text[:1] if prefix == "&": # deal with undefined entities try: data_handler = self.target.data except AttributeError: return try: data_handler(self.entity[text[1:-1]]) except KeyError: from xml.parsers import expat err = expat.error( "undefined entity %s: line %d, column %d" % (text, self.parser.ErrorLineNumber, self.parser.ErrorColumnNumber) ) err.code = 11 # XML_ERROR_UNDEFINED_ENTITY err.lineno = self.parser.ErrorLineNumber err.offset = self.parser.ErrorColumnNumber raise err elif prefix == "<" and text[:9] == "": self._doctype = None return text = text.strip() if not text: return self._doctype.append(text) n = len(self._doctype) if n > 2: type = self._doctype[1] if type == "PUBLIC" and n == 4: name, type, pubid, system = self._doctype if pubid: pubid = pubid[1:-1] elif type == "SYSTEM" and n == 3: name, type, system = self._doctype pubid = None else: return if hasattr(self.target, "doctype"): self.target.doctype(name, pubid, system[1:-1]) elif hasattr(self, "doctype"): warnings.warn( "The doctype() method of XMLParser is ignored. " "Define doctype() method on the TreeBuilder target.", RuntimeWarning) self._doctype = None def feed(self, data): """Feed encoded data to parser.""" try: self.parser.Parse(data, False) except self._error as v: self._raiseerror(v) def close(self): """Finish feeding data to parser and return element structure.""" try: self.parser.Parse(b"", True) # end of data except self._error as v: self._raiseerror(v) try: close_handler = self.target.close except AttributeError: pass else: return close_handler() finally: # get rid of circular references del self.parser, self._parser del self.target, self._target def flush(self): was_enabled = self.parser.GetReparseDeferralEnabled() try: self.parser.SetReparseDeferralEnabled(False) self.parser.Parse(b"", False) except self._error as v: self._raiseerror(v) finally: self.parser.SetReparseDeferralEnabled(was_enabled) # -------------------------------------------------------------------- # C14N 2.0 def canonicalize(xml_data=None, *, out=None, from_file=None, **options): """Convert 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``. """ if xml_data is None and from_file is None: raise ValueError("Either 'xml_data' or 'from_file' must be provided as input") sio = None if out is None: sio = out = io.StringIO() parser = XMLParser(target=C14NWriterTarget(out.write, **options)) if xml_data is not None: parser.feed(xml_data) parser.close() elif from_file is not None: parse(from_file, parser=parser) return sio.getvalue() if sio is not None else None _looks_like_prefix_name = re.compile(r'^\w+:\w+$', re.UNICODE).match class C14NWriterTarget: """ 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 """ def __init__(self, write, *, with_comments=False, strip_text=False, rewrite_prefixes=False, qname_aware_tags=None, qname_aware_attrs=None, exclude_attrs=None, exclude_tags=None): self._write = write self._data = [] self._with_comments = with_comments self._strip_text = strip_text self._exclude_attrs = set(exclude_attrs) if exclude_attrs else None self._exclude_tags = set(exclude_tags) if exclude_tags else None self._rewrite_prefixes = rewrite_prefixes if qname_aware_tags: self._qname_aware_tags = set(qname_aware_tags) else: self._qname_aware_tags = None if qname_aware_attrs: self._find_qname_aware_attrs = set(qname_aware_attrs).intersection else: self._find_qname_aware_attrs = None # Stack with globally and newly declared namespaces as (uri, prefix) pairs. self._declared_ns_stack = [[ ("http://www.w3.org/XML/1998/namespace", "xml"), ]] # Stack with user declared namespace prefixes as (uri, prefix) pairs. self._ns_stack = [] if not rewrite_prefixes: self._ns_stack.append(list(_namespace_map.items())) self._ns_stack.append([]) self._prefix_map = {} self._preserve_space = [False] self._pending_start = None self._root_seen = False self._root_done = False self._ignored_depth = 0 def _iter_namespaces(self, ns_stack, _reversed=reversed): for namespaces in _reversed(ns_stack): if namespaces: # almost no element declares new namespaces yield from namespaces def _resolve_prefix_name(self, prefixed_name): prefix, name = prefixed_name.split(':', 1) for uri, p in self._iter_namespaces(self._ns_stack): if p == prefix: return f'{{{uri}}}{name}' raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope') def _qname(self, qname, uri=None): if uri is None: uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname) else: tag = qname prefixes_seen = set() for u, prefix in self._iter_namespaces(self._declared_ns_stack): if u == uri and prefix not in prefixes_seen: return f'{prefix}:{tag}' if prefix else tag, tag, uri prefixes_seen.add(prefix) # Not declared yet => add new declaration. if self._rewrite_prefixes: if uri in self._prefix_map: prefix = self._prefix_map[uri] else: prefix = self._prefix_map[uri] = f'n{len(self._prefix_map)}' self._declared_ns_stack[-1].append((uri, prefix)) return f'{prefix}:{tag}', tag, uri if not uri and '' not in prefixes_seen: # No default namespace declared => no prefix needed. return tag, tag, uri for u, prefix in self._iter_namespaces(self._ns_stack): if u == uri: self._declared_ns_stack[-1].append((uri, prefix)) return f'{prefix}:{tag}' if prefix else tag, tag, uri if not uri: # As soon as a default namespace is defined, # anything that has no namespace (and thus, no prefix) goes there. return tag, tag, uri raise ValueError(f'Namespace "{uri}" is not declared in scope') def data(self, data): if not self._ignored_depth: self._data.append(data) def _flush(self, _join_text=''.join): data = _join_text(self._data) del self._data[:] if self._strip_text and not self._preserve_space[-1]: data = data.strip() if self._pending_start is not None: args, self._pending_start = self._pending_start, None qname_text = data if data and _looks_like_prefix_name(data) else None self._start(*args, qname_text) if qname_text is not None: return if data and self._root_seen: self._write(_escape_cdata_c14n(data)) def start_ns(self, prefix, uri): if self._ignored_depth: return # we may have to resolve qnames in text content if self._data: self._flush() self._ns_stack[-1].append((uri, prefix)) def start(self, tag, attrs): if self._exclude_tags is not None and ( self._ignored_depth or tag in self._exclude_tags): self._ignored_depth += 1 return if self._data: self._flush() new_namespaces = [] self._declared_ns_stack.append(new_namespaces) if self._qname_aware_tags is not None and tag in self._qname_aware_tags: # Need to parse text first to see if it requires a prefix declaration. self._pending_start = (tag, attrs, new_namespaces) return self._start(tag, attrs, new_namespaces) def _start(self, tag, attrs, new_namespaces, qname_text=None): if self._exclude_attrs is not None and attrs: attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs} qnames = {tag, *attrs} resolved_names = {} # Resolve prefixes in attribute and tag text. if qname_text is not None: qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text) qnames.add(qname) if self._find_qname_aware_attrs is not None and attrs: qattrs = self._find_qname_aware_attrs(attrs) if qattrs: for attr_name in qattrs: value = attrs[attr_name] if _looks_like_prefix_name(value): qname = resolved_names[value] = self._resolve_prefix_name(value) qnames.add(qname) else: qattrs = None else: qattrs = None # Assign prefixes in lexicographical order of used URIs. parse_qname = self._qname parsed_qnames = {n: parse_qname(n) for n in sorted( qnames, key=lambda n: n.split('}', 1))} # Write namespace declarations in prefix order ... if new_namespaces: attr_list = [ ('xmlns:' + prefix if prefix else 'xmlns', uri) for uri, prefix in new_namespaces ] attr_list.sort() else: # almost always empty attr_list = [] # ... followed by attributes in URI+name order if attrs: for k, v in sorted(attrs.items()): if qattrs is not None and k in qattrs and v in resolved_names: v = parsed_qnames[resolved_names[v]][0] attr_qname, attr_name, uri = parsed_qnames[k] # No prefix for attributes in default ('') namespace. attr_list.append((attr_qname if uri else attr_name, v)) # Honour xml:space attributes. space_behaviour = attrs.get('{http://www.w3.org/XML/1998/namespace}space') self._preserve_space.append( space_behaviour == 'preserve' if space_behaviour else self._preserve_space[-1]) # Write the tag. write = self._write write('<' + parsed_qnames[tag][0]) if attr_list: write(''.join([f' {k}="{_escape_attrib_c14n(v)}"' for k, v in attr_list])) write('>') # Write the resolved qname text content. if qname_text is not None: write(_escape_cdata_c14n(parsed_qnames[resolved_names[qname_text]][0])) self._root_seen = True self._ns_stack.append([]) def end(self, tag): if self._ignored_depth: self._ignored_depth -= 1 return if self._data: self._flush() self._write(f'') self._preserve_space.pop() self._root_done = len(self._preserve_space) == 1 self._declared_ns_stack.pop() self._ns_stack.pop() def comment(self, text): if not self._with_comments: return if self._ignored_depth: return if self._root_done: self._write('\n') elif self._root_seen and self._data: self._flush() self._write(f'') if not self._root_seen: self._write('\n') def pi(self, target, data): if self._ignored_depth: return if self._root_done: self._write('\n') elif self._root_seen and self._data: self._flush() self._write( f'' if data else f'') if not self._root_seen: self._write('\n') def _escape_cdata_c14n(text): # escape character data try: # it's worth avoiding do-nothing calls for strings that are # shorter than 500 character, or so. assume that's, by far, # the most common case in most applications. if '&' in text: text = text.replace('&', '&') if '<' in text: text = text.replace('<', '<') if '>' in text: text = text.replace('>', '>') if '\r' in text: text = text.replace('\r', ' ') return text except (TypeError, AttributeError): _raise_serialization_error(text) def _escape_attrib_c14n(text): # escape attribute value try: if '&' in text: text = text.replace('&', '&') if '<' in text: text = text.replace('<', '<') if '"' in text: text = text.replace('"', '"') if '\t' in text: text = text.replace('\t', ' ') if '\n' in text: text = text.replace('\n', ' ') if '\r' in text: text = text.replace('\r', ' ') return text except (TypeError, AttributeError): _raise_serialization_error(text) # -------------------------------------------------------------------- # Import the C accelerators try: # Element is going to be shadowed by the C implementation. We need to keep # the Python version of it accessible for some "creative" by external code # (see tests) _Element_Py = Element # Element, SubElement, ParseError, TreeBuilder, XMLParser, _set_factories from _elementtree import * from _elementtree import _set_factories except ImportError: pass else: _set_factories(Comment, ProcessingInstruction) ElementInclude.py000064400000015450152530264050010022 0ustar00# # ElementTree # $Id: ElementInclude.py 3375 2008-02-13 08:05:08Z fredrik $ # # limited xinclude support for element trees # # history: # 2003-08-15 fl created # 2003-11-14 fl fixed default loader # # Copyright (c) 2003-2004 by Fredrik Lundh. All rights reserved. # # fredrik@pythonware.com # http://www.pythonware.com # # -------------------------------------------------------------------- # The ElementTree toolkit is # # Copyright (c) 1999-2008 by Fredrik Lundh # # By obtaining, using, and/or copying this software and/or its # associated documentation, you agree that you have read, understood, # and will comply with the following terms and conditions: # # Permission to use, copy, modify, and distribute this software and # its associated documentation for any purpose and without fee is # hereby granted, provided that the above copyright notice appears in # all copies, and that both that copyright notice and this permission # notice appear in supporting documentation, and that the name of # Secret Labs AB or the author not be used in advertising or publicity # pertaining to distribution of the software without specific, written # prior permission. # # SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD # TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- # ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE # OF THIS SOFTWARE. # -------------------------------------------------------------------- # Licensed to PSF under a Contributor Agreement. # See https://www.python.org/psf/license for licensing details. ## # Limited XInclude support for the ElementTree package. ## import copy from . import ElementTree from urllib.parse import urljoin XINCLUDE = "{http://www.w3.org/2001/XInclude}" XINCLUDE_INCLUDE = XINCLUDE + "include" XINCLUDE_FALLBACK = XINCLUDE + "fallback" # For security reasons, the inclusion depth is limited to this read-only value by default. DEFAULT_MAX_INCLUSION_DEPTH = 6 ## # Fatal include error. class FatalIncludeError(SyntaxError): pass class LimitedRecursiveIncludeError(FatalIncludeError): pass ## # Default loader. This loader reads an included resource from disk. # # @param href Resource reference. # @param parse Parse mode. Either "xml" or "text". # @param encoding Optional text encoding (UTF-8 by default for "text"). # @return The expanded resource. If the parse mode is "xml", this # is an Element instance. If the parse mode is "text", this # is a string. If the loader fails, it can return None # or raise an OSError exception. # @throws OSError If the loader fails to load the resource. def default_loader(href, parse, encoding=None): if parse == "xml": with open(href, 'rb') as file: data = ElementTree.parse(file).getroot() else: if not encoding: encoding = 'UTF-8' with open(href, 'r', encoding=encoding) as file: data = file.read() return data ## # Expand XInclude directives. # # @param elem Root Element or any ElementTree of a tree to be expanded # @param loader Optional resource loader. If omitted, it defaults # to {@link default_loader}. If given, it should be a callable # that implements the same interface as default_loader. # @param base_url The base URL of the original file, to resolve # relative include file references. # @param max_depth The maximum number of recursive inclusions. # Limited to reduce the risk of malicious content explosion. # Pass None to disable the limitation. # @throws LimitedRecursiveIncludeError If the {@link max_depth} was exceeded. # @throws FatalIncludeError If the function fails to include a given # resource, or if the tree contains malformed XInclude elements. # @throws OSError If the function fails to load a given resource. # @throws ValueError If negative {@link max_depth} is passed. # @returns None. Modifies tree pointed by {@link elem} def include(elem, loader=None, base_url=None, max_depth=DEFAULT_MAX_INCLUSION_DEPTH): if max_depth is None: max_depth = -1 elif max_depth < 0: raise ValueError("expected non-negative depth or None for 'max_depth', got %r" % max_depth) if hasattr(elem, 'getroot'): elem = elem.getroot() if loader is None: loader = default_loader _include(elem, loader, base_url, max_depth, set()) def _include(elem, loader, base_url, max_depth, _parent_hrefs): # look for xinclude elements i = 0 while i < len(elem): e = elem[i] if e.tag == XINCLUDE_INCLUDE: # process xinclude directive href = e.get("href") if base_url: href = urljoin(base_url, href) parse = e.get("parse", "xml") if parse == "xml": if href in _parent_hrefs: raise FatalIncludeError("recursive include of %s" % href) if max_depth == 0: raise LimitedRecursiveIncludeError( "maximum xinclude depth reached when including file %s" % href) _parent_hrefs.add(href) node = loader(href, parse) if node is None: raise FatalIncludeError( "cannot load %r as %r" % (href, parse) ) node = copy.copy(node) # FIXME: this makes little sense with recursive includes _include(node, loader, href, max_depth - 1, _parent_hrefs) _parent_hrefs.remove(href) if e.tail: node.tail = (node.tail or "") + e.tail elem[i] = node elif parse == "text": text = loader(href, parse, e.get("encoding")) if text is None: raise FatalIncludeError( "cannot load %r as %r" % (href, parse) ) if e.tail: text += e.tail if i: node = elem[i-1] node.tail = (node.tail or "") + text else: elem.text = (elem.text or "") + text del elem[i] continue else: raise FatalIncludeError( "unknown parse type in xi:include tag (%r)" % parse ) elif e.tag == XINCLUDE_FALLBACK: raise FatalIncludeError( "xi:fallback tag must be child of xi:include (%r)" % e.tag ) else: _include(e, loader, base_url, max_depth, _parent_hrefs) i += 1 __init__.py000064400000003105152530264050006656 0ustar00# $Id: __init__.py 3375 2008-02-13 08:05:08Z fredrik $ # elementtree package # -------------------------------------------------------------------- # The ElementTree toolkit is # # Copyright (c) 1999-2008 by Fredrik Lundh # # By obtaining, using, and/or copying this software and/or its # associated documentation, you agree that you have read, understood, # and will comply with the following terms and conditions: # # Permission to use, copy, modify, and distribute this software and # its associated documentation for any purpose and without fee is # hereby granted, provided that the above copyright notice appears in # all copies, and that both that copyright notice and this permission # notice appear in supporting documentation, and that the name of # Secret Labs AB or the author not be used in advertising or publicity # pertaining to distribution of the software without specific, written # prior permission. # # SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD # TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- # ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE # OF THIS SOFTWARE. # -------------------------------------------------------------------- # Licensed to PSF under a Contributor Agreement. # See https://www.python.org/psf/license for licensing details. ElementTree.pyc000064400000104574152530264050007507 0ustar00 {fc@s>dddddddddd d d d d dddddddgZdZddlZddlZddlZdefdYZyddlmZWne k reZnXd e fdYZ dZ defdYZ e ZZidZed Zed!ZeZd efd"YZdefd#YZed$Zd%Zd&d'd(d)d*d+d,d-d.d/d0d1d2f ZyeeZWnek rnXd3Zd4Zied56ed66ed76Zd8Zid5d96d6d:6d;d<6d=d>6d?d@6dAdB6dCdD6Z dEZ!dFZ"dGZ#dHZ$dIZ%eedJZ&eedKZ'dLZ(edMZ)eedNZ*dOefdPYZ+edQZ,edRZ-e,Z.edSZ/defdTYZ0dUgZ1defdVYZ2e2Z3yddWl4m5Z5e5edX(treprRtid(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__repr__scCs|j||S(N(t __class__(RRR,((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt makeelementscCs;|j|j|j}|j|_|j|_||(|S(N(R4RR,Rttail(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR*s   cCs t|jS(N(tlenR-(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__len__scCs)tjdtddt|jdkS(NsyThe behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.t stacklevelii(twarningstwarnt FutureWarningR6R-(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt __nonzero__s cCs |j|S(N(R-(Rtindex((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt __getitem__ scCs||j||D]6}x|jD] }|VqWW|jrD|jVqDqDWdS(N(RR(t basestringRRtitertextR5(RRRQts((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRUs      N(!R%R&RRR,RR5R/R2R4R*R7R<R>R?R@RARBRDRERGRR R$R"RIRJRMRNROR!RSRU(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRs<             cKs<|j}|j||j||}|j||S(N(R*R+R4RA(tparentRR,R.R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR s    cCstt}||_|S(N(RRR(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR"s  cCs6tt}||_|r2|jd||_n|S(Nt (RR R(ttargetRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR 1s   cBs/eZddZdZdZdZRS(cCs&|rd||f}n||_dS(Ns{%s}%s(R(Rt text_or_uriR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/EscCs|jS(N(R(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__str__IscCs t|jS(N(thashR(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__hash__KscCs2t|tr"t|j|jSt|j|S(N(R(R tcmpR(Rtother((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__cmp__MsN(R%R&RR/R[R]R`(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR Ds   cBseZd d dZdZdZd dZd dZd dZd dZ d d dZ d dZ d d Z d d d d d Z d ZRS( cCs#||_|r|j|ndS(N(t_rootR(RRtfile((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/_s cCs|jS(N(Ra(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytgetrootkscCs ||_dS(N(Ra(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt_setrootuscCst}t|ds-t|d}t}nzb|sKtdt}nx*|jd}|sgPn|j|qNW|j|_ |j SWd|r|jnXdS(NtreadtrbRYi( tFalseR)topentTrueRRRetfeedtcloseRa(Rtsourcetparsert close_sourcetdata((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRs   cCs|jj|S(N(RaR!(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR!scCs)tjdtddt|j|S(NsbThis method will be removed in future versions. Use 'tree.iter()' or 'list(tree.iter())' instead.R8i(R9R:RRR#R!(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRSs cCsJ|d dkr7d|}tjd|tddn|jj||S(Nit/t.sThis 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 %rR8i(R9R:R;RaR(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRs cCsM|d dkr7d|}tjd|tddn|jj|||S(NiRpRqsThis 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 %rR8i(R9R:R;RaR (RRHRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR s cCsJ|d dkr7d|}tjd|tddn|jj||S(NiRpRqsThis 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 %rR8i(R9R:R;RaR$(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR$s cCsJ|d dkr7d|}tjd|tddn|jj||S(NiRpRqsThis 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 %rR8i(R9R:R;RaR"(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR"s c Cs=|sd}n|tkr.td|nt|drF|}nt|d}|j}|s|dkryd}qd}n>|s|dkr|d kr|dkr|d|qn|d krt||j|n>t|j||\}} t|} | ||j||| ||k r9|j ndS( Ntxmlsunknown method %rtwritetwbtc14nsutf-8sus-asciis$ R(sutf-8sus-ascii( t _serializet ValueErrorR)RhRsRt_serialize_textRat _namespacesRk( Rtfile_or_filenametencodingtxml_declarationtdefault_namespacetmethodRbRstqnamesRt serialize((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRss0            cCs|j|ddS(NR~Ru(Rs(RRb((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt write_c14n8sN(R%R&RR/RcRdRR!RSRR R$R"RsR(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR]s        c sidd6ir&d       $     c Css|j}|j}|tkr8|dt||n|tkr^|dt||n||}|dkr|r|t||nx|D]}t||||dqWn|d||j}|s|r|rNxet |jddD]E\} } | r!d| } n|d| j |t | |fqWnx~t |D]m\} } t | t r| j} nt | t r|| j} nt | |} |d|| | fq[Wn|st|rC|d |r|t||nx$|D]}t||||dqW|d |d n |d |jro|t|j|ndS( Ns stRt:s xmlns%s="%s"s %s="%s"t>s(RRRt_encodeR Rt _escape_cdatat_serialize_xmlROtsortedRt_escape_attribR(R R6R5( RsRR{RRRRRQROtvtk((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRsP                tareatbasetbasefonttbrtcoltframethrtimgtinputtisindextlinktmetatparamc Cs|j}|j}|tkr8|dt||n?|tkr^|dt||n||}|dkr|r|t||nx|D]}t||||dqWn|d||j}|s|r|rNxet|jddD]E\} } | r!d| } n|d| j |t | |fqWnx~t|D]m\} } t | t r| j} nt | t r|| j} nt | |} |d|| | fq[Wn|d |j} |r/| d ks| d kr|t||q/|t||nx$|D]}t||||dq6W| tkrw|d |d n|jr|t|j|ndS( Ns sRRKcSs|dS(Ni((R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRRRs xmlns%s="%s"s %s="%s"Rtscripttstyles;s       U      D /  2           b   M  ElementInclude.pyc000064400000003657152530264050010173 0ustar00 {fc@shddlZddlmZdZedZedZdefdYZdd Z dd Z dS( iNi(t ElementTrees!{http://www.w3.org/2001/XInclude}tincludetfallbacktFatalIncludeErrorcBseZRS((t__name__t __module__(((s0/usr/lib64/python2.7/xml/etree/ElementInclude.pyR>scCsat|O}|dkr3tj|j}n$|j}|rW|j|}nWdQX|S(Ntxml(topenRtparsetgetroottreadtdecode(threfRtencodingtfiletdata((s0/usr/lib64/python2.7/xml/etree/ElementInclude.pytdefault_loaderMs  cCs|dkrt}nd}x|t|kr||}|jtkr|jd}|jdd}|dkr|||}|dkrtd||fntj|}|jr|jpd|j|_n|||3s    __pycache__/ElementTree.cpython-36.opt-2.pyc000064400000066760152530375640014604 0ustar003 \@sDdddddddddd d d d d dddddddddgZdZddlZddlZddlZddlZddlZddlZddlm Z Gdd d e Z ddZ GdddZ ifdd Zd]d dZd^d!d ZeZGd"d d ZGd#ddZejd$d%Zd_d&d'Zd(d)Zd`Zy eeZWnek rYnXd7d8Zd9d:Zeeed;Zdd?d@dAdBdCdDZee_dEdFZ dGdHZ!dIdJZ"dKdLZ#dadMdNdOdZ$GdPdQdQej%Z&dbdMdNdRdZ'dSdZ(dcdTdZ)dddUdZ*GdVddZ+dedWdZ,dfdXdZ-e,Z.dgdYdZ/GdZddZ0Gd[ddZ1ye Z2dd\l3TWne4k r>YnXdS)hCommentdumpElement ElementTree fromstringfromstringlist iselement iterparseparse ParseErrorPIProcessingInstructionQName SubElementtostring tostringlist TreeBuilderVERSIONXMLXMLID XMLParser XMLPullParserregister_namespacez1.3.0N) ElementPathc@s eZdZdS)r N)__name__ __module__ __qualname__rr-/usr/lib64/python3.6/xml/etree/ElementTree.pyr hs cCs t|dS)Ntag)hasattr)elementrrrrvsc@seZdZdZdZdZdZifddZddZddZ dd Z d d Z d d Z ddZ ddZddZddZddZddZddZddZddZd8d d!Zd9d"d#Zd:d$d%Zd;d&d'Zd(d)Zdd4d5Z d6d7Z!dS)?rNcKsDt|tstd|jjf|j}|j|||_||_g|_ dS)Nzattrib must be dict, not %s) isinstancedict TypeError __class__rcopyupdater attrib _children)selfr r)extrarrr__init__s  zElement.__init__cCsd|jj|jt|fS)Nz<%s %r at %#x>)r&rr id)r+rrr__repr__szElement.__repr__cCs |j||S)N)r&)r+r r)rrr makeelements zElement.makeelementcCs0|j|j|j}|j|_|j|_||dd<|S)N)r0r r)texttail)r+elemrrrr's  z Element.copycCs t|jS)N)lenr*)r+rrr__len__szElement.__len__cCstjdtddt|jdkS)NzyThe behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.) stacklevelr)warningswarn FutureWarningr4r*)r+rrr__bool__s zElement.__bool__cCs |j|S)N)r*)r+indexrrr __getitem__szElement.__getitem__cCs||j|<dS)N)r*)r+r<r"rrr __setitem__szElement.__setitem__cCs |j|=dS)N)r*)r+r<rrr __delitem__szElement.__delitem__cCs|j||jj|dS)N)_assert_is_elementr*append)r+ subelementrrrrAs zElement.appendcCs(x|D]}|j|qW|jj|dS)N)r@r*extend)r+elementsr"rrrrCs zElement.extendcCs|j||jj||dS)N)r@r*insert)r+r<rBrrrrEs zElement.insertcCs t|tstdt|jdS)Nzexpected an Element, not %s)r# _Element_Pyr%typer)r+errrr@s zElement._assert_is_elementcCs|jj|dS)N)r*remove)r+rBrrrrIs zElement.removecCstjdtdd|jS)NzaThis method will be removed in future versions. Use 'list(elem)' or iteration over elem instead.r6)r7)r8r9DeprecationWarningr*)r+rrr getchildrens zElement.getchildrencCstj|||S)N)rfind)r+path namespacesrrrrL!s z Element.findcCstj||||S)N)rfindtext)r+rMdefaultrNrrrrO,s zElement.findtextcCstj|||S)N)rfindall)r+rMrNrrrrQ:s zElement.findallcCstj|||S)N)riterfind)r+rMrNrrrrREs zElement.iterfindcCs |jjg|_d|_|_dS)N)r)clearr*r1r2)r+rrrrSPs z Element.clearcCs|jj||S)N)r)get)r+keyrPrrrrT[s z Element.getcCs||j|<dS)N)r))r+rUvaluerrrsethsz Element.setcCs |jjS)N)r)keys)r+rrrrXrsz Element.keyscCs |jjS)N)r)items)r+rrrrY{s z Element.itemsccsH|dkr d}|dks|j|kr$|Vx|jD]}|j|EdHq,WdS)N*)r r*iter)r+r rHrrrr[s  z Element.itercCstjdtddt|j|S)NzbThis method will be removed in future versions. Use 'elem.iter()' or 'list(elem.iter())' instead.r6)r7)r8r9PendingDeprecationWarninglistr[)r+r rrr getiterators zElement.getiteratorccs^|j}t|t r|dk rdS|j}|r.|Vx*|D]"}|jEdH|j}|r4|Vq4WdS)N)r r#strr1itertextr2)r+r trHrrrr`s zElement.itertext)N)NN)N)N)N)N)N)"rrrr r)r1r2r-r/r0r'r5r;r=r>r?rArCrEr@rIrKrLrOrQrRrSrTrWrXrYr[r^r`rrrrr{s>            cKs,|j}|j||j||}|j||S)N)r'r(r0rA)parentr r)r,r"rrrrs    cCstt}||_|S)N)rrr1)r1r"rrrrs cCs&tt}||_|r"|jd||_|S)N )rr r1)targetr1r"rrrr s c@sVeZdZdddZddZddZdd Zd d Zd d ZddZ ddZ ddZ dS)r NcCs|rd||f}||_dS)Nz{%s}%s)r1)r+Z text_or_urir rrrr-s zQName.__init__cCs|jS)N)r1)r+rrr__str__sz QName.__str__cCsd|jj|jfS)Nz<%s %r>)r&rr1)r+rrrr/szQName.__repr__cCs t|jS)N)hashr1)r+rrr__hash__szQName.__hash__cCs t|tr|j|jkS|j|kS)N)r#r r1)r+otherrrr__le__s  z QName.__le__cCs t|tr|j|jkS|j|kS)N)r#r r1)r+rhrrr__lt__ s  z QName.__lt__cCs t|tr|j|jkS|j|kS)N)r#r r1)r+rhrrr__ge__s  z QName.__ge__cCs t|tr|j|jkS|j|kS)N)r#r r1)r+rhrrr__gt__s  z QName.__gt__cCs t|tr|j|jkS|j|kS)N)r#r r1)r+rhrrr__eq__s  z QName.__eq__)N) rrrr-rer/rgrirjrkrlrmrrrrr s c@seZdZdddZddZddZddd Zdd d Zdd d Zd ddZ d!ddZ d"ddZ d#ddZ d$ddddZ ddZdS)%rNcCs||_|r|j|dS)N)_rootr )r+r"filerrrr-)szElementTree.__init__cCs|jS)N)rn)r+rrrgetroot/szElementTree.getrootcCs ||_dS)N)rn)r+r"rrr_setroot3szElementTree._setrootc Csd}t|dst|d}d}zZ|dkrHt}t|drH|j||_|jSx|jd}|sZP|j|qJW|j|_|jS|r|jXdS)NFreadrbT _parse_wholei)r!openrrtrnrrfeedclose)r+sourceparser close_sourcedatarrrr =s&       zElementTree.parsecCs |jj|S)N)rnr[)r+r rrrr[bs zElementTree.itercCstjdtddt|j|S)NzbThis method will be removed in future versions. Use 'tree.iter()' or 'list(tree.iter())' instead.r6)r7)r8r9r\r]r[)r+r rrrr^os zElementTree.getiteratorcCs:|dddkr,d|}tjd|tdd|jj||S)Nr/.zThis 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 %rr6)r7)r8r9r:rnrL)r+rMrNrrrrLxs  zElementTree.findcCs<|dddkr,d|}tjd|tdd|jj|||S)Nrr|r}zThis 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 %rr6)r7)r8r9r:rnrO)r+rMrPrNrrrrOs  zElementTree.findtextcCs:|dddkr,d|}tjd|tdd|jj||S)Nrr|r}zThis 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 %rr6)r7)r8r9r:rnrQ)r+rMrNrrrrQs  zElementTree.findallcCs:|dddkr,d|}tjd|tdd|jj||S)Nrr|r}zThis 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 %rr6)r7)r8r9r:rnrR)r+rMrNrrrrRs  zElementTree.iterfindT)short_empty_elementscCs|s d}n|tkrtd||s4|dkr0d}nd}|j}t||}|dkr|sd|dkr|d kr|} |dkrddl} | j} |d| f|d krt||jn,t|j|\} } t|} | ||j| | |d WdQRXdS) Nxmlzunknown method %rc14nutf-8us-asciiunicoderz$ r1)r~)rrr) _serialize ValueErrorlower _get_writerlocalegetpreferredencoding_serialize_textrn _namespaces)r+file_or_filenameencodingZxml_declarationdefault_namespacemethodr~Z enc_lowerwriteZdeclared_encodingrqnamesrNZ serializerrrrs2     zElementTree.writecCs|j|ddS)Nr)r)r)r+rorrr write_c14n szElementTree.write_c14n)NN)N)N)N)N)NN)N)N)NNNN)rrrr-rprqr r[r^rLrOrQrRrrrrrrrs   %    5ccs"y |j}WnPtk rZ|dkr.t|d}nt|d|dd}||jVWdQRXYnX|dkrl|Vntj}t|tjr|}nft|tjrtj |}|j |j nBtj}dd|_ ||_y|j |_ |j|_Wntk rYnXtj||ddd}|j |j |jVWdQRXdS) Nrwxmlcharrefreplace)rerrorscSsdS)NTrrrrr3sz_get_writer.. )rrnewline)rAttributeErrorru contextlib ExitStackr#ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletell TextIOWrapper)rrrrostackrrrrs>         rcsddiird<fdd}x|jD]}|j}t|tr\|jkr||jn.add_qname) r[r r#r r1r_rr rrY)r3rrr rUrVr1r)rrNrrrEs4      rc Ks|j}|j}|tkr$|d|n|tkr<|d|nv||}|dkr|r\|t|x|D]}t|||d|dqbWn2|d|t|j} | s|rD|rx@t|jdddD](\} } | rd| } |d | t | fqWxZt| D]N\} } t | t r | j} t | t r$|| j} nt | } |d || | fqW|s\t |s\| r|d |rv|t|x |D]}t|||d|dq|W|d |d n|d |j r|t|j dS)Nz z)r~.)rU:z xmlns%s="%s"z %s="%s">z)r r1rr _escape_cdata_serialize_xmlr]rYsorted_escape_attribr#r r4r2) rr3rrNr~kwargsr r1rHrYvkrrrrsT             rareabasebasefontbrcolframehrimginputisindexlinkmetaparamc Ks|j}|j}|tkr(|dt|n|tkrD|dt|n|||}|dkr|rd|t|x|D]}t|||dqjWn<|d|t|j}|s|rH|rx@t|jdddD](\} } | rd| } |d| t | fqWxZt|D]N\} } t | t r| j} t | t r(|| j} nt | } |d || | fqW|d |j } |r| d ksr| d kr|||n |t|x|D]}t|||dqW| tkr|d |d |jr|t|jdS)Nz zrcSs|dS)Nrr)rrrrrsz!_serialize_html..)rUrz xmlns%s="%s"z %s="%s"rZscriptZstylez|jdd}|Sttfk r`t|YnXdS)N&z&rz<rz>)replacer%rr)r1rrrr$s   rc Csyd|kr|jdd}d|kr*|jdd}d|kr>|jdd}d|krR|jdd}d |krf|jd d }d |krz|jd d }d |kr|jd d }d |kr|jd d}|Sttfk rt|YnXdS)Nrz&rz<rz>"z"z r z  z )rr%rr)r1rrrr4s(        rc Csfy@d|kr|jdd}d|kr*|jdd}d|kr>|jdd}|Sttfk r`t|YnXdS)Nrz&rz>rz")rr%rr)r1rrrrPs   rT)r~cCs6|dkrtjntj}t|j||||d|jS)Nr)rr~)rStringIOBytesIOrrgetvalue)r"rrr~streamrrrr_sc@s4eZdZddZddZddZddZd d Zd S) _ListDataStreamcCs ||_dS)N)lst)r+rrrrr-tsz_ListDataStream.__init__cCsdS)NTr)r+rrrrwsz_ListDataStream.writablecCsdS)NTr)r+rrrrzsz_ListDataStream.seekablecCs|jj|dS)N)rrA)r+brrrr}sz_ListDataStream.writecCs t|jS)N)r4r)r+rrrrsz_ListDataStream.tellN)rrrr-rrrrrrrrrrs rcCs&g}t|}t|j||||d|S)N)rr~)rrr)r"rrr~rrrrrrs cCsNt|tst|}|jtjdd|jj}| s>|ddkrJtjjddS)Nr)rrr)r#rrsysstdoutrpr2)r3r2rrrrs  cCst}|j|||S)N)rr )rxrytreerrrr s  csdt||dfddGfdddtj}|d_~dtds`tdd S) N)events_parserc 3sbzNx,jEdHjd}|s"Pj|qWj}jEdH|_Wdr\jXdS)Nii@) read_eventsrrrv_close_and_return_rootrootrw)r{r)rzit pullparserrxrriterators  ziterparse..iteratorcseZdZjZdS)z$iterparse..IterParseIteratorN)rrr__next__r)rrrIterParseIteratorsrFrrrsT)r collectionsIteratorrr!ru)rxrryrr)rzrrrrxrrs   c@s<eZdZd ddddZddZddZd d Zd d ZdS)rN)rcCs<tj|_|pttd|_|dkr(d}|jj|j|dS)N)rdend)r)rdeque _events_queuerrr _setevents)r+rrrrrr-s  zXMLPullParser.__init__cCsZ|jdkrtd|rVy|jj|Wn.tk rT}z|jj|WYdd}~XnXdS)Nz!feed() called after end of stream)rrrv SyntaxErrorrrA)r+r{excrrrrvs zXMLPullParser.feedcCs|jj}d|_|S)N)rrw)r+rrrrrs z$XMLPullParser._close_and_return_rootcCs |jdS)N)r)r+rrrrwszXMLPullParser.closeccs2|j}x&|r,|j}t|tr$|q|VqWdS)N)rpopleftr# Exception)r+reventrrrrs  zXMLPullParser.read_events)N)rrrr-rvrrwrrrrrrs   cCs"|sttd}|j||jS)N)rd)rrrvrw)r1ryrrrrs   cCsV|sttd}|j||j}i}x&|jD]}|jd}|r0|||<q0W||fS)N)rdr.)rrrvrwr[rT)r1ryrZidsr3r.rrrr&s     cCs0|sttd}x|D]}|j|qW|jS)N)rd)rrrvrw)Zsequenceryr1rrrr>s   c@s>eZdZdddZddZddZdd Zd d Zd d ZdS)rNcCs.g|_g|_d|_d|_|dkr$t}||_dS)N)_data_elem_last_tailr_factory)r+Zelement_factoryrrrr-]szTreeBuilder.__init__cCs|jS)N)r)r+rrrrwfszTreeBuilder.closecCs>|jr:|jdk r4dj|j}|jr,||j_n||j_g|_dS)Nr)rrjoinrr2r1)r+r1rrr_flushls   zTreeBuilder._flushcCs|jj|dS)N)rrA)r+r{rrrr{xszTreeBuilder.datacCsF|j|j|||_}|jr0|jdj||jj|d|_|S)Nrrr)rrrrrAr)r+r Zattrsr3rrrstart|s zTreeBuilder.startcCs |j|jj|_d|_|jS)Nr)rrpoprr)r+r rrrrs zTreeBuilder.end)N) rrrr-rwrr{rrrrrrrPs   c@sbeZdZdddZddZddZd d Zd d Zd dZddZ ddZ e Z ddZ ddZ dS)rrNcCs<yddlm}Wn>tk rNy ddl}Wntk rHtdYnXYnX|j|d}|dkrjt}||_|_||_|_ |j |_ i|_ |j |_t|dr|j|_t|dr|j|_t|dr|j|_t|dr|j|_t|d r|j|_d |_d |_d |_d|_i|_yd |j|_ Wnt!k r6YnXdS) Nr)expatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrr{commentpirzExpat %d.%d.%d)" xml.parsersr ImportErrorZpyexpatZ ParserCreaterryrrd_targeterror_error_names_defaultZDefaultHandlerExpandr!_startStartElementHandler_endEndElementHandlerr{ZCharacterDataHandlerrZCommentHandlerrZProcessingInstructionHandlerZ buffer_textordered_attributesspecified_attributes_doctypeentity version_infoversionr)r+rrdrrryrrrr-sF         zXMLParser.__init__cCs|j}|j}x|D]}|dkrDd|_d|_|||jfdd}||_q|dkrf|||jfdd}||_q|dkr||fdd}||_q|d kr||fd d}||_ qt d |qWdS) NrrcSs|||||fdS)Nr)r Z attrib_inrrArrrrhandlersz%XMLParser._setevents..handlerrcSs||||fdS)Nr)r rrArrrrrszstart-nscSs|||p d|pdffdS)Nrr)rrrrArrrrszend-nscSs||dfdS)Nr)rrrArrrrszunknown event %r) rrAr r rr r r ZStartNamespaceDeclHandlerZEndNamespaceDeclHandlerr)r+Z events_queueZevents_to_reportryrAZ event_namerrrrrs( zXMLParser._seteventscCs&t|}|j|_|j|jf|_|dS)N)r codelinenooffsetZposition)r+rVerrrrr _raiseerrorszXMLParser._raiseerrorc CsFy|j|}Wn2tk r@|}d|kr2d|}||j|<YnX|S)Nrr)rKeyError)r+rUnamerrr_fixnameszXMLParser._fixnamecCsV|j}||}i}|rHx0tdt|dD]}||d||||<q(W|jj||S)Nrr6r)rranger4rdr)r+r Z attr_listZfixnamer)irrrrszXMLParser._startcCs|jj|j|S)N)rdrr)r+r rrrr szXMLParser._endc Cs|dd}|dkry |jj}Wntk r4dSXy||j|ddWnZtk rddlm}|jd||jj |jj f}d|_ |jj |_ |jj |_ |YnXnD|dkr|ddd krg|_n"|jdk r|d krd|_dS|j}|sdS|jj|t|j}|d kr|jd}|d krb|d krb|j\}}} } | r| dd} n*|dkr|dkr|j\}}} d} ndSt|jdr|jj|| | ddn:|j|jkr|j|| | dd|j|| | ddd|_dS)Nrrr)rz'undefined entity %s: line %d, column %d r z Ks A   0t4 =2 2  05   KU __pycache__/ElementInclude.cpython-36.opt-1.pyc000064400000003031152530375640015245 0ustar003 \@sPddlZddlmZdZedZedZGdddeZd d d Zd d dZ dS)N) ElementTreez!{http://www.w3.org/2001/XInclude}includeZfallbackc@s eZdZdS)FatalIncludeErrorN)__name__ __module__ __qualname__r r 0/usr/lib64/python3.6/xml/etree/ElementInclude.pyr>src Cs\|dkr.t|d}tj|j}WdQRXn*|s6d}t|d|d}|j}WdQRX|S)NxmlrbzUTF-8r)encoding)openrparseZgetrootread)hrefrrfiledatar r r default_loaderMs rcCsp|dkr t}d}xX|t|krj||}|jtkr:|jd}|jdd}|dkr|||}|dkrvtd||ftj|}|jr|jpd|j|_|||<n|dkr,||||jd}|dkrtd||f|r||d }|jpd||jpd|_n|jpd||jpd|_||=qn td |n&|jt krVtd |jn t |||d }qWdS) Nrrrr zcannot load %r as %rtextrrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r)) rlentagXINCLUDE_INCLUDEgetrcopytailrXINCLUDE_FALLBACKr)elemloaderierrZnoderr r r rcsF           )N)N) rrrZXINCLUDErr SyntaxErrorrrrr r r r 3s  __pycache__/ElementTree.cpython-36.pyc000064400000127272152530375640013640 0ustar003 \@sHdZddddddddd d d d d ddddddddddgZdZddlZddlZddlZddlZddlZddlZddl m Z Gdd d e Z ddZ GdddZifd dZd^d!dZd_d"d ZeZGd#d d ZGd$ddZejd%d&Zd`d'd(Zd)d*ZdaZy eeZWnek r"YnXd8d9Zd:d;Zeeed<Zd=dZd>d?d@dAdBdCdDdEZ e e_ dFdGZ!dHdIZ"dJdKZ#dLdMZ$dbdNdOdPdZ%GdQdRdRej&Z'dcdNdOdSdZ(dTdZ)dddUd Z*dedVdZ+GdWddZ,dfdXdZ-dgdYdZ.e-Z/dhdZdZ0Gd[ddZ1Gd\ddZ2yeZ3dd]l4TWne5k rBYnXdS)iaLightweight 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 fromstringfromstringlist iselement iterparseparse ParseErrorPIProcessingInstructionQName SubElementtostring tostringlist TreeBuilderVERSIONXMLXMLID XMLParser XMLPullParserregister_namespacez1.3.0N) ElementPathc@seZdZdZdS)r zAn 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____doc__rr-/usr/lib64/python3.6/xml/etree/ElementTree.pyr hscCs t|dS)z2Return True if *element* appears to be an Element.tag)hasattr)elementrrr rvsc@s eZdZdZdZdZdZdZifddZddZ ddZ d d Z d d Z d dZ ddZddZddZddZddZddZddZddZdd Zd9d!d"Zd:d#d$Zd;d%d&Zdd3d4Z d?d5d6Z!d7d8Z"dS)@rahAn 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 NcKsDt|tstd|jjf|j}|j|||_||_g|_ dS)Nzattrib must be dict, not %s) isinstancedict TypeError __class__rcopyupdater!attrib _children)selfr!r*extrarrr __init__s  zElement.__init__cCsd|jj|jt|fS)Nz<%s %r at %#x>)r'rr!id)r,rrr __repr__szElement.__repr__cCs |j||S)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. )r')r,r!r*rrr makeelements zElement.makeelementcCs0|j|j|j}|j|_|j|_||dd<|S)zReturn copy of current element. This creates a shallow copy. Subelements will be shared with the original tree. N)r1r!r*texttail)r,elemrrr r(s  z Element.copycCs t|jS)N)lenr+)r,rrr __len__szElement.__len__cCstjdtddt|jdkS)NzyThe behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.) stacklevelr)warningswarn FutureWarningr5r+)r,rrr __bool__s zElement.__bool__cCs |j|S)N)r+)r,indexrrr __getitem__szElement.__getitem__cCs||j|<dS)N)r+)r,r=r#rrr __setitem__szElement.__setitem__cCs |j|=dS)N)r+)r,r=rrr __delitem__szElement.__delitem__cCs|j||jj|dS)aAdd *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. N)_assert_is_elementr+append)r, subelementrrr rBs zElement.appendcCs(x|D]}|j|qW|jj|dS)zkAppend subelements from a sequence. *elements* is a sequence with zero or more elements. N)rAr+extend)r,elementsr#rrr rDs zElement.extendcCs|j||jj||dS)z(Insert *subelement* at position *index*.N)rAr+insert)r,r=rCrrr rFs zElement.insertcCs t|tstdt|jdS)Nzexpected an Element, not %s)r$ _Element_Pyr&typer)r,errr rAs zElement._assert_is_elementcCs|jj|dS)aRemove matching subelement. Unlike the find methods, this method compares elements based on identity, NOT ON tag value or contents. To remove subelements by other means, the easiest way is to use a list comprehension to select what elements to keep, and then use slice assignment to update the parent element. ValueError is raised if a matching element could not be found. N)r+remove)r,rCrrr rJs zElement.removecCstjdtdd|jS)z`(Deprecated) Return all subelements. Elements are returned in document order. zaThis method will be removed in future versions. Use 'list(elem)' or iteration over elem instead.r7)r8)r9r:DeprecationWarningr+)r,rrr getchildrens zElement.getchildrencCstj|||S)aFind first matching element by tag name or path. *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. )rfind)r,path namespacesrrr rM!s z Element.findcCstj||||S)aFind text for first matching element by tag name or path. *path* is a string having either an element tag or an XPath, *default* is the value to return if the element was not found, *namespaces* is an optional mapping from namespace prefix to full name. Return text content of first matching element, or default value if none was found. Note that if an element is found having no text content, the empty string is returned. )rfindtext)r,rNdefaultrOrrr rP,s zElement.findtextcCstj|||S)aFind all matching subelements by tag name or path. *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Returns list containing all matching elements in document order. )rfindall)r,rNrOrrr rR:s zElement.findallcCstj|||S)a Find all matching subelements by tag name or path. *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. )riterfind)r,rNrOrrr rSEs zElement.iterfindcCs |jjg|_d|_|_dS)zReset element. This function removes all subelements, clears all attributes, and sets the text and tail attributes to None. N)r*clearr+r2r3)r,rrr rTPs z Element.clearcCs|jj||S)agGet element attribute. Equivalent to attrib.get, but some implementations may handle this a bit more efficiently. *key* is what attribute to look for, and *default* is what to return if the attribute was not found. Returns a string containing the attribute value, or the default if attribute was not found. )r*get)r,keyrQrrr rU[s z Element.getcCs||j|<dS)zSet element attribute. Equivalent to attrib[key] = value, but some implementations may handle this a bit more efficiently. *key* is what attribute to set, and *value* is the attribute value to set it to. N)r*)r,rVvaluerrr sethsz Element.setcCs |jjS)zGet list of attribute names. Names are returned in an arbitrary order, just like an ordinary Python dict. Equivalent to attrib.keys() )r*keys)r,rrr rYrsz Element.keyscCs |jjS)zGet element attributes as a sequence. The attributes are returned in arbitrary order. Equivalent to attrib.items(). Return a list of (name, value) tuples. )r*items)r,rrr rZ{s z Element.itemsccsH|dkr d}|dks|j|kr$|Vx|jD]}|j|EdHq,WdS)aCreate tree iterator. The iterator loops over the element and all subelements in document order, returning all elements with a matching tag. If the tree structure is modified during iteration, new or removed elements may or may not be included. To get a stable set, use the list() function on the iterator, and loop over the resulting list. *tag* is what tags to look for (default is to return all elements) Return an iterator containing all the matching elements. *N)r!r+iter)r,r!rIrrr r\s  z Element.itercCstjdtddt|j|S)NzbThis method will be removed in future versions. Use 'elem.iter()' or 'list(elem.iter())' instead.r7)r8)r9r:PendingDeprecationWarninglistr\)r,r!rrr getiterators zElement.getiteratorccs^|j}t|t r|dk rdS|j}|r.|Vx*|D]"}|jEdH|j}|r4|Vq4WdS)zCreate text iterator. The iterator loops over the element and all subelements in document order, returning all inner text. N)r!r$strr2itertextr3)r,r!trIrrr ras zElement.itertext)N)NN)N)N)N)N)N)#rrrrr!r*r2r3r.r0r1r(r6r<r>r?r@rBrDrFrArJrLrMrPrRrSrTrUrXrYrZr\r_rarrrr r{s@            cKs,|j}|j||j||}|j||S)aSubelement 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. )r(r)r1rB)parentr!r*r-r#rrr rs    cCstt}||_|S)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. )rrr2)r2r#rrr rs cCs&tt}||_|r"|jd||_|S)a*Processing 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.  )rr r2)targetr2r#rrr r s c@sZeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)r aQualified 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. NcCs|rd||f}||_dS)Nz{%s}%s)r2)r,Z text_or_urir!rrr r.s zQName.__init__cCs|jS)N)r2)r,rrr __str__sz QName.__str__cCsd|jj|jfS)Nz<%s %r>)r'rr2)r,rrr r0szQName.__repr__cCs t|jS)N)hashr2)r,rrr __hash__szQName.__hash__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,otherrrr __le__s  z QName.__le__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __lt__ s  z QName.__lt__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __ge__s  z QName.__ge__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __gt__s  z QName.__gt__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __eq__s  z QName.__eq__)N) rrrrr.rfr0rhrjrkrlrmrnrrrr r s  c@seZdZdZdddZddZddZdd d Zdd d Zd d dZ d!ddZ d"ddZ d#ddZ d$ddZ d%ddddZddZdS)&ra%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. NcCs||_|r|j|dS)N)_rootr )r,r#filerrr r.)szElementTree.__init__cCs|jS)z!Return root element of this tree.)ro)r,rrr getroot/szElementTree.getrootcCs ||_dS)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! N)ro)r,r#rrr _setroot3szElementTree._setrootc Csd}t|dst|d}d}zZ|dkrHt}t|drH|j||_|jSx|jd}|sZP|j|qJW|j|_|jS|r|jXdS)a=Load 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. FreadrbTN _parse_wholei)r"openrrurorsfeedclose)r,sourceparser close_sourcedatarrr r =s&       zElementTree.parsecCs |jj|S)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). )ror\)r,r!rrr r\bs zElementTree.itercCstjdtddt|j|S)NzbThis method will be removed in future versions. Use 'tree.iter()' or 'list(tree.iter())' instead.r7)r8)r9r:r]r^r\)r,r!rrr r_os zElementTree.getiteratorcCs:|dddkr,d|}tjd|tdd|jj||S)a\Find 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/.zThis 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 %rr7)r8)r9r:r;rorM)r,rNrOrrr rMxs  zElementTree.findcCs<|dddkr,d|}tjd|tdd|jj|||S)aeFind 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. Nrr}r~zThis 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 %rr7)r8)r9r:r;rorP)r,rNrQrOrrr rPs  zElementTree.findtextcCs:|dddkr,d|}tjd|tdd|jj||S)aaFind 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. Nrr}r~zThis 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 %rr7)r8)r9r:r;rorR)r,rNrOrrr rRs  zElementTree.findallcCs:|dddkr,d|}tjd|tdd|jj||S)agFind 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. Nrr}r~zThis 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 %rr7)r8)r9r:r;rorS)r,rNrOrrr rSs  zElementTree.iterfindT)short_empty_elementscCs|s d}n|tkrtd||s4|dkr0d}nd}|j}t||}|dkr|sd|dkr|d kr|} |dkrddl} | j} |d | f|d krt||jn,t|j|\} } t|} | ||j| | |d WdQRXdS) aWrite 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-asciiNunicoderz$ r2)r)rrr) _serialize ValueErrorlower _get_writerlocalegetpreferredencoding_serialize_textro _namespaces)r,file_or_filenameencodingZxml_declarationdefault_namespacemethodrZ enc_lowerwriteZdeclared_encodingrqnamesrOZ serializerrr rs2     zElementTree.writecCs|j|ddS)Nr)r)r)r,rprrr write_c14n szElementTree.write_c14n)NN)N)N)N)N)NN)N)N)NNNN)rrrrr.rqrrr r\r_rMrPrRrSrrrrrr rs"   %    5ccs"y |j}WnPtk rZ|dkr.t|d}nt|d|dd}||jVWdQRXYnX|dkrl|Vntj}t|tjr|}nft|tjrtj |}|j |j nBtj}dd|_ ||_y|j |_ |j|_Wntk rYnXtj||ddd}|j |j |jVWdQRXdS) Nrwxmlcharrefreplace)rerrorscSsdS)NTrrrrr 3sz_get_writer.. )rrnewline)rAttributeErrorrv contextlib ExitStackr$ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletell TextIOWrapper)rrrrpstackrrr rs>         rcsddiird<fdd}x|jD]}|j}t|tr\|jkr||jn.add_qname) r\r!r$r r2r`rr rrZ)r4rrr!rVrWr2r)rrOrr rEs4      rc Ks|j}|j}|tkr$|d|n|tkr<|d|nv||}|dkr|r\|t|x|D]}t|||d|dqbWn2|d|t|j} | s|rD|rx@t|jdddD](\} } | rd| } |d | t | fqWxZt| D]N\} } t | t r | j} t | t r$|| j} nt | } |d || | fqW|s\t |s\| r|d |rv|t|x |D]}t|||d|dq|W|d |d n|d |j r|t|j dS)Nz z)r.)rV:z xmlns%s="%s"z %s="%s">z)r!r2rr _escape_cdata_serialize_xmlr^rZsorted_escape_attribr$r r5r3) rr4rrOrkwargsr!r2rIrZvkrrr rsT             rareabasebasefontbrcolframehrimginputisindexlinkmetaparamc Ks|j}|j}|tkr(|dt|n|tkrD|dt|n|||}|dkr|rd|t|x|D]}t|||dqjWn<|d|t|j}|s|rH|rx@t|jdddD](\} } | rd| } |d| t | fqWxZt|D]N\} } t | t r| j} t | t r(|| j} nt | } |d || | fqW|d |j } |r| d ksr| d kr|||n |t|x|D]}t|||dqW| tkr|d |d |jr|t|jdS)Nz zrcSs|dS)Nrr)rrrr rsz!_serialize_html..)rVrz xmlns%s="%s"z %s="%s"rZscriptZstylez|jdd}|Sttfk r`t|YnXdS)N&z&rz<rz>)replacer&rr)r2rrr r$s   rc Csyd|kr|jdd}d|kr*|jdd}d|kr>|jdd}d|krR|jdd}d |krf|jd d }d |krz|jd d }d |kr|jd d }d |kr|jd d}|Sttfk rt|YnXdS)Nrz&rz<rz>"z"z r z  z )rr&rr)r2rrr r4s(        rc Csfy@d|kr|jdd}d|kr*|jdd}d|kr>|jdd}|Sttfk r`t|YnXdS)Nrz&rz>rz")rr&rr)r2rrr rPs   rT)rcCs6|dkrtjntj}t|j||||d|jS)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". Returns an (optionally) encoded string containing the XML data. r)rr)rStringIOBytesIOrrgetvalue)r#rrrstreamrrr r_sc@s8eZdZdZddZddZddZdd Zd d Zd S) _ListDataStreamz7An auxiliary stream accumulating into a list reference.cCs ||_dS)N)lst)r,rrrr r.tsz_ListDataStream.__init__cCsdS)NTr)r,rrr rwsz_ListDataStream.writablecCsdS)NTr)r,rrr rzsz_ListDataStream.seekablecCs|jj|dS)N)rrB)r,brrr r}sz_ListDataStream.writecCs t|jS)N)r5r)r,rrr rsz_ListDataStream.tellN) rrrrr.rrrrrrrr rrs rcCs&g}t|}t|j||||d|S)N)rr)rrr)r#rrrrrrrr rs cCsNt|tst|}|jtjdd|jj}| s>|ddkrJtjjddS)a#Write 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)rrrN)r$rrsysstdoutrqr3)r4r3rrr rs  cCst}|j|||S)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 )ryrztreerrr r s  csdt||dfddGfdddtj}|d_~dtds`td d S) aJIncrementally 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_parserc 3sbzNx,jEdHjd}|s"Pj|qWj}jEdH|_Wdr\jXdS)Nii@) read_eventsrsrw_close_and_return_rootrootrx)r|r)r{it pullparserryrr iterators  ziterparse..iteratorcseZdZjZdS)z$iterparse..IterParseIteratorN)rrr__next__r)rrr IterParseIteratorsrNFrsrtT)r collectionsIteratorrr"rv)ryrrzrr)r{rrrryr rs   c@s<eZdZd ddddZddZddZd d Zd d ZdS)rN)rcCs<tj|_|pttd|_|dkr(d}|jj|j|dS)N)reend)r)rdeque _events_queuerrr _setevents)r,rrrrr r.s  zXMLPullParser.__init__cCsZ|jdkrtd|rVy|jj|Wn.tk rT}z|jj|WYdd}~XnXdS)zFeed encoded data to parser.Nz!feed() called after end of stream)rrrw SyntaxErrorrrB)r,r|excrrr rws zXMLPullParser.feedcCs|jj}d|_|S)N)rrx)r,rrrr rs z$XMLPullParser._close_and_return_rootcCs |jdS)zFinish feeding data to parser. Unlike XMLParser, does not return the root element. Use read_events() to consume elements from XMLPullParser. N)r)r,rrr rxszXMLPullParser.closeccs2|j}x&|r,|j}t|tr$|q|VqWdS)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)rpopleftr$ Exception)r,reventrrr rs  zXMLPullParser.read_events)N)rrrr.rwrrxrrrrr rs   cCs"|sttd}|j||jS)aParse XML document from string constant. This function can be used to embed "XML Literals" in Python code. *text* is a string containing XML data, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an Element instance. )re)rrrwrx)r2rzrrr rs   cCsV|sttd}|j||j}i}x&|jD]}|jd}|r0|||<q0W||fS)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. )rer/)rrrwrxr\rU)r2rzrZidsr4r/rrr r&s     cCs0|sttd}x|D]}|j|qW|jS)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. )re)rrrwrx)Zsequencerzr2rrr r>s   c@sBeZdZdZdddZddZddZd d Zd d Zd dZ dS)raGeneric 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. NcCs.g|_g|_d|_d|_|dkr$t}||_dS)N)_data_elem_last_tailr_factory)r,Zelement_factoryrrr r.]szTreeBuilder.__init__cCs.t|jdkstd|jdk s(td|jS)z;Flush builder buffers and return toplevel document Element.rzmissing end tagsNzmissing toplevel element)r5rAssertionErrorr)r,rrr rxfszTreeBuilder.closecCsf|jrb|jdk r\dj|j}|jr@|jjdks6td||j_n|jjdksTtd||j_g|_dS)Nrzinternal error (tail)zinternal error (text))rrjoinrr3rr2)r,r2rrr _flushls   zTreeBuilder._flushcCs|jj|dS)zAdd text to current element.N)rrB)r,r|rrr r|xszTreeBuilder.datacCsF|j|j|||_}|jr0|jdj||jj|d|_|S)zOpen new element and return it. *tag* is the element name, *attrs* is a dict containing element attributes. rrr)rrrrrBr)r,r!attrsr4rrr start|s zTreeBuilder.startcCs@|j|jj|_|jj|ks4td|jj|fd|_|jS)zOClose and return current Element. *tag* is the element name. z&end tag mismatch (expected %s, got %s)r)rrpoprr!rr)r,r!rrr rs zTreeBuilder.end)N) rrrrr.rxrr|rrrrrr rPs   c@sfeZdZdZdddZddZdd Zd d Zd d ZddZ ddZ ddZ e Z ddZ ddZdS)raElement structure builder for XML source data based on the expat parser. *html* are predefined HTML entities (deprecated and not supported), *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 rNcCs<yddlm}Wn>tk rNy ddl}Wntk rHtdYnXYnX|j|d}|dkrjt}||_|_||_|_ |j |_ i|_ |j |_t|dr|j|_t|dr|j|_t|dr|j|_t|dr|j|_t|d r|j|_d |_d |_d |_d|_i|_yd |j|_ Wnt!k r6YnXdS) Nr)expatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrr|commentpirzExpat %d.%d.%d)" xml.parsersr ImportErrorZpyexpatZ ParserCreaterrzrre_targeterror_error_names_defaultZDefaultHandlerExpandr"_startStartElementHandler_endEndElementHandlerr|ZCharacterDataHandlerrZCommentHandlerrZProcessingInstructionHandlerZ buffer_textordered_attributesspecified_attributes_doctypeentity version_infoversionr)r,rrerrrzrrr r.sF         zXMLParser.__init__cCs|j}|j}x|D]}|dkrDd|_d|_|||jfdd}||_q|dkrf|||jfdd}||_q|dkr||fdd}||_q|d kr||fd d}||_ qt d |qWdS) NrrcSs|||||fdS)Nr)r!Z attrib_inrrBrrrr handlersz%XMLParser._setevents..handlerrcSs||||fdS)Nr)r!rrBrrrr rszstart-nscSs|||p d|pdffdS)Nrr)rrrrBrrr rszend-nscSs||dfdS)Nr)rrrBrrr rszunknown event %r) rrBrrr r r rZStartNamespaceDeclHandlerZEndNamespaceDeclHandlerr)r,Z events_queueZevents_to_reportrzrBZ event_namerrrr rs( zXMLParser._seteventscCs&t|}|j|_|j|jf|_|dS)N)r codelinenooffsetZposition)r,rWerrrrr _raiseerrorszXMLParser._raiseerrorc CsFy|j|}Wn2tk r@|}d|kr2d|}||j|<YnX|S)Nrr)r KeyError)r,rVnamerrr _fixnameszXMLParser._fixnamecCsV|j}||}i}|rHx0tdt|dD]}||d||||<q(W|jj||S)Nrr7r)rranger5rer)r,r!Z attr_listZfixnamer*irrr r szXMLParser._startcCs|jj|j|S)N)rerr)r,r!rrr r szXMLParser._endc Cs|dd}|dkry |jj}Wntk r4dSXy||j|ddWnZtk rddlm}|jd||jj |jj f}d|_ |jj |_ |jj |_ |YnXnD|dkr|ddd krg|_n"|jdk r|d krd|_dS|j}|sdS|jj|t|j}|d kr|jd}|d krb|d krb|j\}}} } | r| dd} n*|dkr|dkr|j\}}} d} ndSt|jdr|jj|| | ddn:|j|jkr|j|| | dd|j|| | ddd|_dS)Nrrr)rz'undefined entity %s: line %d, column %d r z "s) A   0t4 =2 2  05   KU __pycache__/cElementTree.cpython-36.pyc000064400000000247152530375640013773 0ustar003 \R@s ddlTdS))*N)Zxml.etree.ElementTreerr./usr/lib64/python3.6/xml/etree/cElementTree.pys__pycache__/__init__.cpython-36.opt-1.pyc000064400000000175152530375640014115 0ustar003 \D@sdS)Nrrr*/usr/lib64/python3.6/xml/etree/__init__.pys__pycache__/cElementTree.cpython-36.opt-2.pyc000064400000000247152530375640014733 0ustar003 \R@s ddlTdS))*N)Zxml.etree.ElementTreerr./usr/lib64/python3.6/xml/etree/cElementTree.pys__pycache__/ElementInclude.cpython-36.pyc000064400000003031152530375640014306 0ustar003 \@sPddlZddlmZdZedZedZGdddeZd d d Zd d dZ dS)N) ElementTreez!{http://www.w3.org/2001/XInclude}includeZfallbackc@s eZdZdS)FatalIncludeErrorN)__name__ __module__ __qualname__r r 0/usr/lib64/python3.6/xml/etree/ElementInclude.pyr>src Cs\|dkr.t|d}tj|j}WdQRXn*|s6d}t|d|d}|j}WdQRX|S)NxmlrbzUTF-8r)encoding)openrparseZgetrootread)hrefrrfiledatar r r default_loaderMs rcCsp|dkr t}d}xX|t|krj||}|jtkr:|jd}|jdd}|dkr|||}|dkrvtd||ftj|}|jr|jpd|j|_|||<n|dkr,||||jd}|dkrtd||f|r||d }|jpd||jpd|_n|jpd||jpd|_||=qn td |n&|jt krVtd |jn t |||d }qWdS) Nrrrr zcannot load %r as %rtextrrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r)) rlentagXINCLUDE_INCLUDEgetrcopytailrXINCLUDE_FALLBACKr)elemloaderierrZnoderr r r rcsF           )N)N) rrrZXINCLUDErr SyntaxErrorrrrr r r r 3s  __pycache__/ElementPath.cpython-36.opt-2.pyc000064400000013771152530375640014573 0ustar003 \&@sddlZejdZdddZddZddZd d Zd d Zd dZddZ ddZ eeee ee dZ iZ GdddZ dddZd ddZd!ddZd"ddZdS)#Nz\('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+c csxtj|D]}|d}|r|ddkrd|kry6|jdd\}}|sJt|dd|||ffVWqtk rtd|YqXq |Vq WdS)Nr{:z{%s}%sz!prefix %r not found in prefix map)xpath_tokenizer_refindallsplitKeyError SyntaxError)pattern namespacestokentagprefixZurir-/usr/lib64/python3.6/xml/etree/ElementPath.pyxpath_tokenizerIsrcCsF|j}|dkrBi|_}x(|jjD]}x|D] }|||<q.Wq$W|S)N) parent_maprootiter)contextrperrrget_parent_mapWs  rcs|dfdd}|S)Nrc3s0x*|D]"}x|D]}|jkr|VqWqWdS)N)r )rresultelemr)r rrselectbs   zprepare_child..selectr)nextr rr)r r prepare_child`s rcCs dd}|S)Ncssx|D]}|EdHqWdS)Nr)rrrrrrrjs zprepare_star..selectr)rr rrrr prepare_starisrcCs dd}|S)Ncss|EdHdS)Nr)rrrrrrpszprepare_self..selectr)rr rrrr prepare_selfosrc s\y |}Wntk rdSX|ddkr2dn|dsD|dntdfdd}|S)Nr*rzinvalid descendantc3s4x.|D]&}x |jD]}||k r|VqWqWdS)N)r)rrrr)r rrrs z"prepare_descendant..select) StopIterationr )rr rr)r rprepare_descendantts    r"cCs dd}|S)NcssDt|}i}x2|D]*}||kr||}||krd||<|VqWdS)N)r)rrrZ result_maprparentrrrrs zprepare_parent..selectr)rr rrrrprepare_parents r$c s*g}g}xy |}Wntk r(dSX|ddkr8P|drh|ddddkrhd|dddf}|j|dpvd|j|dq Wdj|}|dkr|dfd d }|S|d kr|d|dfd d }|S|dkrtjd |d r|dfdd }|S|dkrVtjd |d rV|d|dfdd }|S|dkst|dkst|dkr|dkrt|dddkrtdnl|ddkrtd|dkr yt|ddWntk rtdYnXdkrtdndfdd }|StddS) Nr]rz'"'-z@-c3s&x |D]}|jdk r|VqWdS)N)get)rrr)keyrrrs z!prepare_predicate..selectz@-='c3s&x |D]}|jkr|VqWdS)N)r))rrr)r*valuerrrs z\-?\d+$c3s&x |D]}|jdk r|VqWdS)N)find)rrr)r rrrs z-='c3s@x:|D]2}x,|jD]}dj|jkr|VPqWqWdS)Nr()rjoinZitertext)rrrr)r r+rrrs  z-()z-()-zXPath position >= 1 expectedZlastzunsupported functionzunsupported expressionz)XPath offset from last() must be negativec 3sbt|}xT|D]L}y.||}t|j|j}||kr>|VWqttfk rXYqXqWdS)N)rlistrr IndexErrorr)rrrrr#Zelems)indexrrrs   zinvalid predicater2r2r2)r!appendr-rematchintr ValueError)rr Z signatureZ predicaterr)r1r*r r+rprepare_predicatesd            r9)r(r .z..z//[c@seZdZdZddZdS)_SelectorContextNcCs ||_dS)N)r)selfrrrr__init__sz_SelectorContext.__init__)__name__ __module__ __qualname__rr>rrrrr<sr<c !Csh||dkrdntt|jf}|dddkr8|d}y t|}Wntk r:ttdkrjtj|dddkrtdtt ||j }y |}Wnt k rdSXg}xvy|j t |d||Wnt k rtdYnXy|}|ddkr|}Wqt k r(PYqXqW|t|<YnX|g}t|}x|D]} | ||}qPW|S) Nr/r dz#cannot use absolute path on elementrz invalid pathr2)tuplesorteditems_cacherlenclearr rr__next__r!r4opsr<) rpathr Z cache_keyZselectorrr rrrrrriterfindsD      rMcCstt|||dS)N)rrM)rrLr rrrr,)sr,cCstt|||S)N)r/rM)rrLr rrrr/src Cs4ytt|||}|jpdStk r.|SXdS)Nr()rrMtextr!)rrLdefaultr rrrfindtext5s  rP)N)N)N)N)NN)r5compilerrrrrrr"r$r9rKrGr<rMr,rrPrrrr;s,    Y )  __pycache__/ElementPath.cpython-36.pyc000064400000013771152530375640013633 0ustar003 \&@sddlZejdZdddZddZddZd d Zd d Zd dZddZ ddZ eeee ee dZ iZ GdddZ dddZd ddZd!ddZd"ddZdS)#Nz\('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+c csxtj|D]}|d}|r|ddkrd|kry6|jdd\}}|sJt|dd|||ffVWqtk rtd|YqXq |Vq WdS)Nr{:z{%s}%sz!prefix %r not found in prefix map)xpath_tokenizer_refindallsplitKeyError SyntaxError)pattern namespacestokentagprefixZurir-/usr/lib64/python3.6/xml/etree/ElementPath.pyxpath_tokenizerIsrcCsF|j}|dkrBi|_}x(|jjD]}x|D] }|||<q.Wq$W|S)N) parent_maprootiter)contextrperrrget_parent_mapWs  rcs|dfdd}|S)Nrc3s0x*|D]"}x|D]}|jkr|VqWqWdS)N)r )rresultelemr)r rrselectbs   zprepare_child..selectr)nextr rr)r r prepare_child`s rcCs dd}|S)Ncssx|D]}|EdHqWdS)Nr)rrrrrrrjs zprepare_star..selectr)rr rrrr prepare_starisrcCs dd}|S)Ncss|EdHdS)Nr)rrrrrrpszprepare_self..selectr)rr rrrr prepare_selfosrc s\y |}Wntk rdSX|ddkr2dn|dsD|dntdfdd}|S)Nr*rzinvalid descendantc3s4x.|D]&}x |jD]}||k r|VqWqWdS)N)r)rrrr)r rrrs z"prepare_descendant..select) StopIterationr )rr rr)r rprepare_descendantts    r"cCs dd}|S)NcssDt|}i}x2|D]*}||kr||}||krd||<|VqWdS)N)r)rrrZ result_maprparentrrrrs zprepare_parent..selectr)rr rrrrprepare_parents r$c s*g}g}xy |}Wntk r(dSX|ddkr8P|drh|ddddkrhd|dddf}|j|dpvd|j|dq Wdj|}|dkr|dfd d }|S|d kr|d|dfd d }|S|dkrtjd |d r|dfdd }|S|dkrVtjd |d rV|d|dfdd }|S|dkst|dkst|dkr|dkrt|dddkrtdnl|ddkrtd|dkr yt|ddWntk rtdYnXdkrtdndfdd }|StddS) Nr]rz'"'-z@-c3s&x |D]}|jdk r|VqWdS)N)get)rrr)keyrrrs z!prepare_predicate..selectz@-='c3s&x |D]}|jkr|VqWdS)N)r))rrr)r*valuerrrs z\-?\d+$c3s&x |D]}|jdk r|VqWdS)N)find)rrr)r rrrs z-='c3s@x:|D]2}x,|jD]}dj|jkr|VPqWqWdS)Nr()rjoinZitertext)rrrr)r r+rrrs  z-()z-()-zXPath position >= 1 expectedZlastzunsupported functionzunsupported expressionz)XPath offset from last() must be negativec 3sbt|}xT|D]L}y.||}t|j|j}||kr>|VWqttfk rXYqXqWdS)N)rlistrr IndexErrorr)rrrrr#Zelems)indexrrrs   zinvalid predicater2r2r2)r!appendr-rematchintr ValueError)rr Z signatureZ predicaterr)r1r*r r+rprepare_predicatesd            r9)r(r .z..z//[c@seZdZdZddZdS)_SelectorContextNcCs ||_dS)N)r)selfrrrr__init__sz_SelectorContext.__init__)__name__ __module__ __qualname__rr>rrrrr<sr<c !Csh||dkrdntt|jf}|dddkr8|d}y t|}Wntk r:ttdkrjtj|dddkrtdtt ||j }y |}Wnt k rdSXg}xvy|j t |d||Wnt k rtdYnXy|}|ddkr|}Wqt k r(PYqXqW|t|<YnX|g}t|}x|D]} | ||}qPW|S) Nr/r dz#cannot use absolute path on elementrz invalid pathr2)tuplesorteditems_cacherlenclearr rr__next__r!r4opsr<) rpathr Z cache_keyZselectorrr rrrrrriterfindsD      rMcCstt|||dS)N)rrM)rrLr rrrr,)sr,cCstt|||S)N)r/rM)rrLr rrrr/src Cs4ytt|||}|jpdStk r.|SXdS)Nr()rrMtextr!)rrLdefaultr rrrfindtext5s  rP)N)N)N)N)NN)r5compilerrrrrrr"r$r9rKrGr<rMr,rrPrrrr;s,    Y )  __pycache__/ElementPath.cpython-36.opt-1.pyc000064400000013771152530375640014572 0ustar003 \&@sddlZejdZdddZddZddZd d Zd d Zd dZddZ ddZ eeee ee dZ iZ GdddZ dddZd ddZd!ddZd"ddZdS)#Nz\('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+c csxtj|D]}|d}|r|ddkrd|kry6|jdd\}}|sJt|dd|||ffVWqtk rtd|YqXq |Vq WdS)Nr{:z{%s}%sz!prefix %r not found in prefix map)xpath_tokenizer_refindallsplitKeyError SyntaxError)pattern namespacestokentagprefixZurir-/usr/lib64/python3.6/xml/etree/ElementPath.pyxpath_tokenizerIsrcCsF|j}|dkrBi|_}x(|jjD]}x|D] }|||<q.Wq$W|S)N) parent_maprootiter)contextrperrrget_parent_mapWs  rcs|dfdd}|S)Nrc3s0x*|D]"}x|D]}|jkr|VqWqWdS)N)r )rresultelemr)r rrselectbs   zprepare_child..selectr)nextr rr)r r prepare_child`s rcCs dd}|S)Ncssx|D]}|EdHqWdS)Nr)rrrrrrrjs zprepare_star..selectr)rr rrrr prepare_starisrcCs dd}|S)Ncss|EdHdS)Nr)rrrrrrpszprepare_self..selectr)rr rrrr prepare_selfosrc s\y |}Wntk rdSX|ddkr2dn|dsD|dntdfdd}|S)Nr*rzinvalid descendantc3s4x.|D]&}x |jD]}||k r|VqWqWdS)N)r)rrrr)r rrrs z"prepare_descendant..select) StopIterationr )rr rr)r rprepare_descendantts    r"cCs dd}|S)NcssDt|}i}x2|D]*}||kr||}||krd||<|VqWdS)N)r)rrrZ result_maprparentrrrrs zprepare_parent..selectr)rr rrrrprepare_parents r$c s*g}g}xy |}Wntk r(dSX|ddkr8P|drh|ddddkrhd|dddf}|j|dpvd|j|dq Wdj|}|dkr|dfd d }|S|d kr|d|dfd d }|S|dkrtjd |d r|dfdd }|S|dkrVtjd |d rV|d|dfdd }|S|dkst|dkst|dkr|dkrt|dddkrtdnl|ddkrtd|dkr yt|ddWntk rtdYnXdkrtdndfdd }|StddS) Nr]rz'"'-z@-c3s&x |D]}|jdk r|VqWdS)N)get)rrr)keyrrrs z!prepare_predicate..selectz@-='c3s&x |D]}|jkr|VqWdS)N)r))rrr)r*valuerrrs z\-?\d+$c3s&x |D]}|jdk r|VqWdS)N)find)rrr)r rrrs z-='c3s@x:|D]2}x,|jD]}dj|jkr|VPqWqWdS)Nr()rjoinZitertext)rrrr)r r+rrrs  z-()z-()-zXPath position >= 1 expectedZlastzunsupported functionzunsupported expressionz)XPath offset from last() must be negativec 3sbt|}xT|D]L}y.||}t|j|j}||kr>|VWqttfk rXYqXqWdS)N)rlistrr IndexErrorr)rrrrr#Zelems)indexrrrs   zinvalid predicater2r2r2)r!appendr-rematchintr ValueError)rr Z signatureZ predicaterr)r1r*r r+rprepare_predicatesd            r9)r(r .z..z//[c@seZdZdZddZdS)_SelectorContextNcCs ||_dS)N)r)selfrrrr__init__sz_SelectorContext.__init__)__name__ __module__ __qualname__rr>rrrrr<sr<c !Csh||dkrdntt|jf}|dddkr8|d}y t|}Wntk r:ttdkrjtj|dddkrtdtt ||j }y |}Wnt k rdSXg}xvy|j t |d||Wnt k rtdYnXy|}|ddkr|}Wqt k r(PYqXqW|t|<YnX|g}t|}x|D]} | ||}qPW|S) Nr/r dz#cannot use absolute path on elementrz invalid pathr2)tuplesorteditems_cacherlenclearr rr__next__r!r4opsr<) rpathr Z cache_keyZselectorrr rrrrrriterfindsD      rMcCstt|||dS)N)rrM)rrLr rrrr,)sr,cCstt|||S)N)r/rM)rrLr rrrr/src Cs4ytt|||}|jpdStk r.|SXdS)Nr()rrMtextr!)rrLdefaultr rrrfindtext5s  rP)N)N)N)N)NN)r5compilerrrrrrr"r$r9rKrGr<rMr,rrPrrrr;s,    Y )  __pycache__/ElementTree.cpython-36.opt-1.pyc000064400000126613152530375640014575 0ustar003 \@sHdZddddddddd d d d d ddddddddddgZdZddlZddlZddlZddlZddlZddlZddl m Z Gdd d e Z ddZ GdddZifd dZd^d!dZd_d"d ZeZGd#d d ZGd$ddZejd%d&Zd`d'd(Zd)d*ZdaZy eeZWnek r"YnXd8d9Zd:d;Zeeed<Zd=dZd>d?d@dAdBdCdDdEZ e e_ dFdGZ!dHdIZ"dJdKZ#dLdMZ$dbdNdOdPdZ%GdQdRdRej&Z'dcdNdOdSdZ(dTdZ)dddUd Z*dedVdZ+GdWddZ,dfdXdZ-dgdYdZ.e-Z/dhdZdZ0Gd[ddZ1Gd\ddZ2yeZ3dd]l4TWne5k rBYnXdS)iaLightweight 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 fromstringfromstringlist iselement iterparseparse ParseErrorPIProcessingInstructionQName SubElementtostring tostringlist TreeBuilderVERSIONXMLXMLID XMLParser XMLPullParserregister_namespacez1.3.0N) ElementPathc@seZdZdZdS)r zAn 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____doc__rr-/usr/lib64/python3.6/xml/etree/ElementTree.pyr hscCs t|dS)z2Return True if *element* appears to be an Element.tag)hasattr)elementrrr rvsc@s eZdZdZdZdZdZdZifddZddZ ddZ d d Z d d Z d dZ ddZddZddZddZddZddZddZddZdd Zd9d!d"Zd:d#d$Zd;d%d&Zdd3d4Z d?d5d6Z!d7d8Z"dS)@rahAn 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 NcKsDt|tstd|jjf|j}|j|||_||_g|_ dS)Nzattrib must be dict, not %s) isinstancedict TypeError __class__rcopyupdater!attrib _children)selfr!r*extrarrr __init__s  zElement.__init__cCsd|jj|jt|fS)Nz<%s %r at %#x>)r'rr!id)r,rrr __repr__szElement.__repr__cCs |j||S)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. )r')r,r!r*rrr makeelements zElement.makeelementcCs0|j|j|j}|j|_|j|_||dd<|S)zReturn copy of current element. This creates a shallow copy. Subelements will be shared with the original tree. N)r1r!r*texttail)r,elemrrr r(s  z Element.copycCs t|jS)N)lenr+)r,rrr __len__szElement.__len__cCstjdtddt|jdkS)NzyThe behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.) stacklevelr)warningswarn FutureWarningr5r+)r,rrr __bool__s zElement.__bool__cCs |j|S)N)r+)r,indexrrr __getitem__szElement.__getitem__cCs||j|<dS)N)r+)r,r=r#rrr __setitem__szElement.__setitem__cCs |j|=dS)N)r+)r,r=rrr __delitem__szElement.__delitem__cCs|j||jj|dS)aAdd *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. N)_assert_is_elementr+append)r, subelementrrr rBs zElement.appendcCs(x|D]}|j|qW|jj|dS)zkAppend subelements from a sequence. *elements* is a sequence with zero or more elements. N)rAr+extend)r,elementsr#rrr rDs zElement.extendcCs|j||jj||dS)z(Insert *subelement* at position *index*.N)rAr+insert)r,r=rCrrr rFs zElement.insertcCs t|tstdt|jdS)Nzexpected an Element, not %s)r$ _Element_Pyr&typer)r,errr rAs zElement._assert_is_elementcCs|jj|dS)aRemove matching subelement. Unlike the find methods, this method compares elements based on identity, NOT ON tag value or contents. To remove subelements by other means, the easiest way is to use a list comprehension to select what elements to keep, and then use slice assignment to update the parent element. ValueError is raised if a matching element could not be found. N)r+remove)r,rCrrr rJs zElement.removecCstjdtdd|jS)z`(Deprecated) Return all subelements. Elements are returned in document order. zaThis method will be removed in future versions. Use 'list(elem)' or iteration over elem instead.r7)r8)r9r:DeprecationWarningr+)r,rrr getchildrens zElement.getchildrencCstj|||S)aFind first matching element by tag name or path. *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. )rfind)r,path namespacesrrr rM!s z Element.findcCstj||||S)aFind text for first matching element by tag name or path. *path* is a string having either an element tag or an XPath, *default* is the value to return if the element was not found, *namespaces* is an optional mapping from namespace prefix to full name. Return text content of first matching element, or default value if none was found. Note that if an element is found having no text content, the empty string is returned. )rfindtext)r,rNdefaultrOrrr rP,s zElement.findtextcCstj|||S)aFind all matching subelements by tag name or path. *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Returns list containing all matching elements in document order. )rfindall)r,rNrOrrr rR:s zElement.findallcCstj|||S)a Find all matching subelements by tag name or path. *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. )riterfind)r,rNrOrrr rSEs zElement.iterfindcCs |jjg|_d|_|_dS)zReset element. This function removes all subelements, clears all attributes, and sets the text and tail attributes to None. N)r*clearr+r2r3)r,rrr rTPs z Element.clearcCs|jj||S)agGet element attribute. Equivalent to attrib.get, but some implementations may handle this a bit more efficiently. *key* is what attribute to look for, and *default* is what to return if the attribute was not found. Returns a string containing the attribute value, or the default if attribute was not found. )r*get)r,keyrQrrr rU[s z Element.getcCs||j|<dS)zSet element attribute. Equivalent to attrib[key] = value, but some implementations may handle this a bit more efficiently. *key* is what attribute to set, and *value* is the attribute value to set it to. N)r*)r,rVvaluerrr sethsz Element.setcCs |jjS)zGet list of attribute names. Names are returned in an arbitrary order, just like an ordinary Python dict. Equivalent to attrib.keys() )r*keys)r,rrr rYrsz Element.keyscCs |jjS)zGet element attributes as a sequence. The attributes are returned in arbitrary order. Equivalent to attrib.items(). Return a list of (name, value) tuples. )r*items)r,rrr rZ{s z Element.itemsccsH|dkr d}|dks|j|kr$|Vx|jD]}|j|EdHq,WdS)aCreate tree iterator. The iterator loops over the element and all subelements in document order, returning all elements with a matching tag. If the tree structure is modified during iteration, new or removed elements may or may not be included. To get a stable set, use the list() function on the iterator, and loop over the resulting list. *tag* is what tags to look for (default is to return all elements) Return an iterator containing all the matching elements. *N)r!r+iter)r,r!rIrrr r\s  z Element.itercCstjdtddt|j|S)NzbThis method will be removed in future versions. Use 'elem.iter()' or 'list(elem.iter())' instead.r7)r8)r9r:PendingDeprecationWarninglistr\)r,r!rrr getiterators zElement.getiteratorccs^|j}t|t r|dk rdS|j}|r.|Vx*|D]"}|jEdH|j}|r4|Vq4WdS)zCreate text iterator. The iterator loops over the element and all subelements in document order, returning all inner text. N)r!r$strr2itertextr3)r,r!trIrrr ras zElement.itertext)N)NN)N)N)N)N)N)#rrrrr!r*r2r3r.r0r1r(r6r<r>r?r@rBrDrFrArJrLrMrPrRrSrTrUrXrYrZr\r_rarrrr r{s@            cKs,|j}|j||j||}|j||S)aSubelement 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. )r(r)r1rB)parentr!r*r-r#rrr rs    cCstt}||_|S)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. )rrr2)r2r#rrr rs cCs&tt}||_|r"|jd||_|S)a*Processing 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.  )rr r2)targetr2r#rrr r s c@sZeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)r aQualified 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. NcCs|rd||f}||_dS)Nz{%s}%s)r2)r,Z text_or_urir!rrr r.s zQName.__init__cCs|jS)N)r2)r,rrr __str__sz QName.__str__cCsd|jj|jfS)Nz<%s %r>)r'rr2)r,rrr r0szQName.__repr__cCs t|jS)N)hashr2)r,rrr __hash__szQName.__hash__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,otherrrr __le__s  z QName.__le__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __lt__ s  z QName.__lt__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __ge__s  z QName.__ge__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __gt__s  z QName.__gt__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __eq__s  z QName.__eq__)N) rrrrr.rfr0rhrjrkrlrmrnrrrr r s  c@seZdZdZdddZddZddZdd d Zdd d Zd d dZ d!ddZ d"ddZ d#ddZ d$ddZ d%ddddZddZdS)&ra%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. NcCs||_|r|j|dS)N)_rootr )r,r#filerrr r.)szElementTree.__init__cCs|jS)z!Return root element of this tree.)ro)r,rrr getroot/szElementTree.getrootcCs ||_dS)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! N)ro)r,r#rrr _setroot3szElementTree._setrootc Csd}t|dst|d}d}zZ|dkrHt}t|drH|j||_|jSx|jd}|sZP|j|qJW|j|_|jS|r|jXdS)a=Load 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. FreadrbTN _parse_wholei)r"openrrurorsfeedclose)r,sourceparser close_sourcedatarrr r =s&       zElementTree.parsecCs |jj|S)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). )ror\)r,r!rrr r\bs zElementTree.itercCstjdtddt|j|S)NzbThis method will be removed in future versions. Use 'tree.iter()' or 'list(tree.iter())' instead.r7)r8)r9r:r]r^r\)r,r!rrr r_os zElementTree.getiteratorcCs:|dddkr,d|}tjd|tdd|jj||S)a\Find 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/.zThis 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 %rr7)r8)r9r:r;rorM)r,rNrOrrr rMxs  zElementTree.findcCs<|dddkr,d|}tjd|tdd|jj|||S)aeFind 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. Nrr}r~zThis 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 %rr7)r8)r9r:r;rorP)r,rNrQrOrrr rPs  zElementTree.findtextcCs:|dddkr,d|}tjd|tdd|jj||S)aaFind 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. Nrr}r~zThis 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 %rr7)r8)r9r:r;rorR)r,rNrOrrr rRs  zElementTree.findallcCs:|dddkr,d|}tjd|tdd|jj||S)agFind 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. Nrr}r~zThis 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 %rr7)r8)r9r:r;rorS)r,rNrOrrr rSs  zElementTree.iterfindT)short_empty_elementscCs|s d}n|tkrtd||s4|dkr0d}nd}|j}t||}|dkr|sd|dkr|d kr|} |dkrddl} | j} |d | f|d krt||jn,t|j|\} } t|} | ||j| | |d WdQRXdS) aWrite 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-asciiNunicoderz$ r2)r)rrr) _serialize ValueErrorlower _get_writerlocalegetpreferredencoding_serialize_textro _namespaces)r,file_or_filenameencodingZxml_declarationdefault_namespacemethodrZ enc_lowerwriteZdeclared_encodingrqnamesrOZ serializerrr rs2     zElementTree.writecCs|j|ddS)Nr)r)r)r,rprrr write_c14n szElementTree.write_c14n)NN)N)N)N)N)NN)N)N)NNNN)rrrrr.rqrrr r\r_rMrPrRrSrrrrrr rs"   %    5ccs"y |j}WnPtk rZ|dkr.t|d}nt|d|dd}||jVWdQRXYnX|dkrl|Vntj}t|tjr|}nft|tjrtj |}|j |j nBtj}dd|_ ||_y|j |_ |j|_Wntk rYnXtj||ddd}|j |j |jVWdQRXdS) Nrwxmlcharrefreplace)rerrorscSsdS)NTrrrrr 3sz_get_writer.. )rrnewline)rAttributeErrorrv contextlib ExitStackr$ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletell TextIOWrapper)rrrrpstackrrr rs>         rcsddiird<fdd}x|jD]}|j}t|tr\|jkr||jn.add_qname) r\r!r$r r2r`rr rrZ)r4rrr!rVrWr2r)rrOrr rEs4      rc Ks|j}|j}|tkr$|d|n|tkr<|d|nv||}|dkr|r\|t|x|D]}t|||d|dqbWn2|d|t|j} | s|rD|rx@t|jdddD](\} } | rd| } |d | t | fqWxZt| D]N\} } t | t r | j} t | t r$|| j} nt | } |d || | fqW|s\t |s\| r|d |rv|t|x |D]}t|||d|dq|W|d |d n|d |j r|t|j dS)Nz z)r.)rV:z xmlns%s="%s"z %s="%s">z)r!r2rr _escape_cdata_serialize_xmlr^rZsorted_escape_attribr$r r5r3) rr4rrOrkwargsr!r2rIrZvkrrr rsT             rareabasebasefontbrcolframehrimginputisindexlinkmetaparamc Ks|j}|j}|tkr(|dt|n|tkrD|dt|n|||}|dkr|rd|t|x|D]}t|||dqjWn<|d|t|j}|s|rH|rx@t|jdddD](\} } | rd| } |d| t | fqWxZt|D]N\} } t | t r| j} t | t r(|| j} nt | } |d || | fqW|d |j } |r| d ksr| d kr|||n |t|x|D]}t|||dqW| tkr|d |d |jr|t|jdS)Nz zrcSs|dS)Nrr)rrrr rsz!_serialize_html..)rVrz xmlns%s="%s"z %s="%s"rZscriptZstylez|jdd}|Sttfk r`t|YnXdS)N&z&rz<rz>)replacer&rr)r2rrr r$s   rc Csyd|kr|jdd}d|kr*|jdd}d|kr>|jdd}d|krR|jdd}d |krf|jd d }d |krz|jd d }d |kr|jd d }d |kr|jd d}|Sttfk rt|YnXdS)Nrz&rz<rz>"z"z r z  z )rr&rr)r2rrr r4s(        rc Csfy@d|kr|jdd}d|kr*|jdd}d|kr>|jdd}|Sttfk r`t|YnXdS)Nrz&rz>rz")rr&rr)r2rrr rPs   rT)rcCs6|dkrtjntj}t|j||||d|jS)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". Returns an (optionally) encoded string containing the XML data. r)rr)rStringIOBytesIOrrgetvalue)r#rrrstreamrrr r_sc@s8eZdZdZddZddZddZdd Zd d Zd S) _ListDataStreamz7An auxiliary stream accumulating into a list reference.cCs ||_dS)N)lst)r,rrrr r.tsz_ListDataStream.__init__cCsdS)NTr)r,rrr rwsz_ListDataStream.writablecCsdS)NTr)r,rrr rzsz_ListDataStream.seekablecCs|jj|dS)N)rrB)r,brrr r}sz_ListDataStream.writecCs t|jS)N)r5r)r,rrr rsz_ListDataStream.tellN) rrrrr.rrrrrrrr rrs rcCs&g}t|}t|j||||d|S)N)rr)rrr)r#rrrrrrrr rs cCsNt|tst|}|jtjdd|jj}| s>|ddkrJtjjddS)a#Write 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)rrrN)r$rrsysstdoutrqr3)r4r3rrr rs  cCst}|j|||S)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 )ryrztreerrr r s  csdt||dfddGfdddtj}|d_~dtds`td d S) aJIncrementally 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_parserc 3sbzNx,jEdHjd}|s"Pj|qWj}jEdH|_Wdr\jXdS)Nii@) read_eventsrsrw_close_and_return_rootrootrx)r|r)r{it pullparserryrr iterators  ziterparse..iteratorcseZdZjZdS)z$iterparse..IterParseIteratorN)rrr__next__r)rrr IterParseIteratorsrNFrsrtT)r collectionsIteratorrr"rv)ryrrzrr)r{rrrryr rs   c@s<eZdZd ddddZddZddZd d Zd d ZdS)rN)rcCs<tj|_|pttd|_|dkr(d}|jj|j|dS)N)reend)r)rdeque _events_queuerrr _setevents)r,rrrrr r.s  zXMLPullParser.__init__cCsZ|jdkrtd|rVy|jj|Wn.tk rT}z|jj|WYdd}~XnXdS)zFeed encoded data to parser.Nz!feed() called after end of stream)rrrw SyntaxErrorrrB)r,r|excrrr rws zXMLPullParser.feedcCs|jj}d|_|S)N)rrx)r,rrrr rs z$XMLPullParser._close_and_return_rootcCs |jdS)zFinish feeding data to parser. Unlike XMLParser, does not return the root element. Use read_events() to consume elements from XMLPullParser. N)r)r,rrr rxszXMLPullParser.closeccs2|j}x&|r,|j}t|tr$|q|VqWdS)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)rpopleftr$ Exception)r,reventrrr rs  zXMLPullParser.read_events)N)rrrr.rwrrxrrrrr rs   cCs"|sttd}|j||jS)aParse XML document from string constant. This function can be used to embed "XML Literals" in Python code. *text* is a string containing XML data, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an Element instance. )re)rrrwrx)r2rzrrr rs   cCsV|sttd}|j||j}i}x&|jD]}|jd}|r0|||<q0W||fS)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. )rer/)rrrwrxr\rU)r2rzrZidsr4r/rrr r&s     cCs0|sttd}x|D]}|j|qW|jS)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. )re)rrrwrx)Zsequencerzr2rrr r>s   c@sBeZdZdZdddZddZddZd d Zd d Zd dZ dS)raGeneric 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. NcCs.g|_g|_d|_d|_|dkr$t}||_dS)N)_data_elem_last_tailr_factory)r,Zelement_factoryrrr r.]szTreeBuilder.__init__cCs|jS)z;Flush builder buffers and return toplevel document Element.)r)r,rrr rxfszTreeBuilder.closecCs>|jr:|jdk r4dj|j}|jr,||j_n||j_g|_dS)Nr)rrjoinrr3r2)r,r2rrr _flushls   zTreeBuilder._flushcCs|jj|dS)zAdd text to current element.N)rrB)r,r|rrr r|xszTreeBuilder.datacCsF|j|j|||_}|jr0|jdj||jj|d|_|S)zOpen new element and return it. *tag* is the element name, *attrs* is a dict containing element attributes. rrr)rrrrrBr)r,r!Zattrsr4rrr start|s zTreeBuilder.startcCs |j|jj|_d|_|jS)zOClose and return current Element. *tag* is the element name. r)rrpoprr)r,r!rrr rs zTreeBuilder.end)N) rrrrr.rxrr|rrrrrr rPs   c@sfeZdZdZdddZddZdd Zd d Zd d ZddZ ddZ ddZ e Z ddZ ddZdS)raElement structure builder for XML source data based on the expat parser. *html* are predefined HTML entities (deprecated and not supported), *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 rNcCs<yddlm}Wn>tk rNy ddl}Wntk rHtdYnXYnX|j|d}|dkrjt}||_|_||_|_ |j |_ i|_ |j |_t|dr|j|_t|dr|j|_t|dr|j|_t|dr|j|_t|d r|j|_d |_d |_d |_d|_i|_yd |j|_ Wnt!k r6YnXdS) Nr)expatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrr|commentpirzExpat %d.%d.%d)" xml.parsersr ImportErrorZpyexpatZ ParserCreaterrzrre_targeterror_error_names_defaultZDefaultHandlerExpandr"_startStartElementHandler_endEndElementHandlerr|ZCharacterDataHandlerrZCommentHandlerrZProcessingInstructionHandlerZ buffer_textordered_attributesspecified_attributes_doctypeentity version_infoversionr)r,rrerrrzrrr r.sF         zXMLParser.__init__cCs|j}|j}x|D]}|dkrDd|_d|_|||jfdd}||_q|dkrf|||jfdd}||_q|dkr||fdd}||_q|d kr||fd d}||_ qt d |qWdS) NrrcSs|||||fdS)Nr)r!Z attrib_inrrBrrrr handlersz%XMLParser._setevents..handlerrcSs||||fdS)Nr)r!rrBrrrr rszstart-nscSs|||p d|pdffdS)Nrr)rrrrBrrr rszend-nscSs||dfdS)Nr)rrrBrrr rszunknown event %r) rrBr rr r r r ZStartNamespaceDeclHandlerZEndNamespaceDeclHandlerr)r,Z events_queueZevents_to_reportrzrBZ event_namerrrr rs( zXMLParser._seteventscCs&t|}|j|_|j|jf|_|dS)N)r codelinenooffsetZposition)r,rWerrrrr _raiseerrorszXMLParser._raiseerrorc CsFy|j|}Wn2tk r@|}d|kr2d|}||j|<YnX|S)Nrr)rKeyError)r,rVnamerrr _fixnameszXMLParser._fixnamecCsV|j}||}i}|rHx0tdt|dD]}||d||||<q(W|jj||S)Nrr7r)rranger5rer)r,r!Z attr_listZfixnamer*irrr r szXMLParser._startcCs|jj|j|S)N)rerr)r,r!rrr r szXMLParser._endc Cs|dd}|dkry |jj}Wntk r4dSXy||j|ddWnZtk rddlm}|jd||jj |jj f}d|_ |jj |_ |jj |_ |YnXnD|dkr|ddd krg|_n"|jdk r|d krd|_dS|j}|sdS|jj|t|j}|d kr|jd}|d krb|d krb|j\}}} } | r| dd} n*|dkr|dkr|j\}}} d} ndSt|jdr|jj|| | ddn:|j|jkr|j|| | dd|j|| | ddd|_dS)Nrrr)rz'undefined entity %s: line %d, column %d r z "s) A   0t4 =2 2  05   KU __pycache__/ElementInclude.cpython-36.opt-2.pyc000064400000003031152530375640015246 0ustar003 \@sPddlZddlmZdZedZedZGdddeZd d d Zd d dZ dS)N) ElementTreez!{http://www.w3.org/2001/XInclude}includeZfallbackc@s eZdZdS)FatalIncludeErrorN)__name__ __module__ __qualname__r r 0/usr/lib64/python3.6/xml/etree/ElementInclude.pyr>src Cs\|dkr.t|d}tj|j}WdQRXn*|s6d}t|d|d}|j}WdQRX|S)NxmlrbzUTF-8r)encoding)openrparseZgetrootread)hrefrrfiledatar r r default_loaderMs rcCsp|dkr t}d}xX|t|krj||}|jtkr:|jd}|jdd}|dkr|||}|dkrvtd||ftj|}|jr|jpd|j|_|||<n|dkr,||||jd}|dkrtd||f|r||d }|jpd||jpd|_n|jpd||jpd|_||=qn td |n&|jt krVtd |jn t |||d }qWdS) Nrrrr zcannot load %r as %rtextrrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r)) rlentagXINCLUDE_INCLUDEgetrcopytailrXINCLUDE_FALLBACKr)elemloaderierrZnoderr r r rcsF           )N)N) rrrZXINCLUDErr SyntaxErrorrrrr r r r 3s  __pycache__/__init__.cpython-36.opt-2.pyc000064400000000175152530375640014116 0ustar003 \D@sdS)Nrrr*/usr/lib64/python3.6/xml/etree/__init__.pys__pycache__/cElementTree.cpython-36.opt-1.pyc000064400000000247152530375640014732 0ustar003 \R@s ddlTdS))*N)Zxml.etree.ElementTreerr./usr/lib64/python3.6/xml/etree/cElementTree.pys__pycache__/__init__.cpython-36.pyc000064400000000175152530375640013156 0ustar003 \D@sdS)Nrrr*/usr/lib64/python3.6/xml/etree/__init__.pys__pycache__/ElementPath.cpython-311.opt-1.pyc000064400000041537152531452610014641 0ustar00 f6ddlZejdZddZdZdZdZdZdZd Z d Z d Z d Z eee e e e d Z iZGddZddZddZddZddZdS)Nz`('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|!=|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@!=\s]+)|\s+c#K|r|dnd}d}t|D]}|\}}|r|ddkrsd|vrW|dd\}} |st|d||d|fVn6#t$rt d|zdwxYw|r|s |d|d|fVn|Vd}|V|d k}dS) NFr{:}z!prefix %r not found in prefix map@)getxpath_tokenizer_refindallsplitKeyError SyntaxError) pattern namespacesdefault_namespaceparsing_attributetokenttypetagprefixuris .selectvs@  ;tx..JJJ  r$z{}*c3\K|D]%}|j}|r|ddkr|V&dS)Nrrr+)r r/r0el_tagr1r2s rr3z_prepare_tag..select|sS  ;vt,,c1A1AJJJ  r$r&r'c3hK|D]+}|j}|ks|r|kr|V,dSrr+) r r/r0r5r1r2no_nssuffixrs rr3z_prepare_tag..selectsY  S==KK$=$==&-SYBYBYJJJ  r$r(r)c3\K|D]%}|j}|r|kr|V&dSrr+)r r/r0r5r1r2nsns_onlys rr3z_prepare_tag..selectsS  ;vt,,B1F1FJJJ  r$zinternal parser error, got ) isinstancestrslicelen RuntimeError)rr3r1r2r8r<r=r9s` @@@@@@r _prepare_tagrCpsi"CK f}}                RaRE  QRRs6{{lD))!""g           RSST   "Xc"gg&&          >>>??? Mr$c|dtrtfd}ndddkr ddfd}|S)Nrc4d}|||S)Nc3$K|D] }|Ed{V dSrr*)r/r0s r select_childz3prepare_child..select..select_childs2"$$D#OOOOOOOO$$r$r*r r/rG select_tags rr3zprepare_child..selects0 $ $ $:g||F';';<< K|D]}|D]}|jkr|VdSrr+r r/r0r"rs rr3zprepare_child..selectsI    Au||   r$)r,rCnextrr3rIrs @@r prepare_childrOs (C !#&&  = = = = = = rr7d??abb'C     Mr$c d}|S)Nc3$K|D] }|Ed{V dSrr*)r r/r0s rr3zprepare_star..selects2  DOOOOOOOO  r$r*rNrr3s r prepare_starrSs Mr$c d}|S)Nc3K|Ed{VdSrr*)r r/s rr3zprepare_self..selects$r$r*rRs r prepare_selfrVs Mr$c$ |}n#t$rYdSwxYw|ddkrdn |ds |dntdtrtfd}ndddkr ddfd}|S) Nr*rzinvalid descendantc4d}|||S)Nc3RK|D]!}|D] }||ur|V "dSrr)r/r0r"s rrGz8prepare_descendant..select..select_childsN"$$D!YY[[$$D=="#GGG$$$r$r*rHs rr3z"prepare_descendant..selects0 $ $ $ :g||F';';<< .selectsQ  3  A}}   r$) StopIterationrr,rCrMs @@rprepare_descendantr^s  Qx3 1X0Ah./// !#&&  = = = = = = rr7d??abb'C     Ms  c d}|S)Nc3hKt|}i}|D]}||vr||}||vr d||<|VdSr)r#)r r/r result_mapr0parents rr3zprepare_parent..selectse#G,,   ! !Dz!!#D)++)-Jv& LLL  ! !r$r*rRs rprepare_parentrcs ! ! ! Mr$c g}g} |}n#t$rYdSwxYw|ddkrnl|dkr2|dr$|ddddvrd|dddf}||dpd||dd |}|d kr|dfd }|S|d ks|d kr$|d|d  fd} fd}d|vr|n|S|dkr*tjd|ds|dfd}|S|dks-|dks'|dks|dkrLtjd|ds1|d|d r  fd} fd}n fd} fd}d|vr|n|S|dks |dks|dkr|dkr.t |ddz dkrt dnp|ddkrt d|dkrM t |d dz n#t$rt d!wxYwd"krt d#ndfd$}|St d%)&Nrr])rrz'"'r:-rz@-c3HK|D]}||VdSrr )r r/r0keys rr3z!prepare_predicate..selects:  88C==,JJJ  r$z@-='z@-!='c3PK|D]}|kr|V dSrri)r r/r0rjvalues rr3z!prepare_predicate..selects?  88C==E))JJJ  r$c3XK|D]#}|x} |kr|V$dSrri)r r/r0 attr_valuerjrls rselect_negatedz)prepare_predicate..select_negatedsI  "&((3--/J<uATATJJJ  r$z!=z\-?\d+$c3HK|D]}||VdSr)find)r r/r0rs rr3z!prepare_predicate..selects:  99S>>-JJJ  r$z.='z.!='z-='z-!='c3K|D]K}|D]3}d|kr|Vn4LdSNr)r joinitertextr r/r0r"rrls rr3z!prepare_predicate..selectsn"""D!\\#..""771::<<00E99"&JJJ!E:""r$c3K|D]K}|D]3}d|kr|Vn4LdSrs)iterfindrtrurvs rroz)prepare_predicate..select_negated"sn"""D!]]3//""771::<<00E99"&JJJ!E:""r$c3tK|D]1}d|kr|V2dSrsrtrur r/r0rls rr3z!prepare_predicate..select)I"##Dwwt}}//588" ##r$c3tK|D]1}d|kr|V2dSrsrzr{s rroz)prepare_predicate..select_negated-r|r$z-()z-()-zXPath position >= 1 expectedlastzunsupported functionr6zunsupported expressionr(z)XPath offset from last() must be negativec3Kt|}|D]W} ||}t||j}||ur|VA#tt f$rYTwxYwdSr)r#listr r IndexErrorr)r r/rr0rbelemsindexs rr3z!prepare_predicate..selectEs'00J  '-F !9!9::EU|t++" "H-D  s=AA*)A*zinvalid predicate)r]appendrtrematchintr ValueError) rNr signature predicater3rorrjrrls @@@@rprepare_predicatersII # DFFEE    FF  8s??  H    8 (a! --q!B$'EqS)))q""" # ""IDl      Fi722l"             "&!2!2~~>CYq\ B Bl      EY&00 %  9#6#6HZ166$7l"   # " " " " " "  " " " " " " " # # # # # # # # # #"&!2!2~~>C9--f1D1D    ! %%)Eqyy!"@AAA|v%%!"8999F""@ ! --1EE!@@@%&>???@2::%&QRRR      ) * **s  $$6HH))rrX.z..z//[ceZdZdZdZdS)_SelectorContextNc||_dSr)r)selfrs r__init__z_SelectorContext.__init__`s  r$)__name__ __module__ __qualname__rrr*r$rrr^s(Jr$rcZ|dddkr|dz}|f}|r1|tt|z } t|}n.#t$r t tdkrt|dddkrtdtt||j } |}n#t$rYYdSwxYwg} | t|d||n#t$rtddwxYw |}|ddkr |}n#t$rYnwxYw|t|<YnwxYw|g}t|}|D]} | ||}|S) Nr:/rXdrz#cannot use absolute path on elementrz invalid path)tuplesorteditems_cacherrAclearrrr__next__r]ropsr) r0pathr cache_keyselectorrNrr/r r3s rrxrxhs  BCCyCczI7U6*"2"2"4"455666 %)$ %%% v;;   LLNNN 8s??CDD DOD*5566? DFFEE    FFF   <E!H dE : :;;;;  < < <!.11t; < 8s?? DFFE      %y-%0VFt$$G))(( Mss AA;F C! F! C0+F/C00F7/D'&F'EF E'&F' E41F3E44FFc@tt|||dSr)rNrxr0rrs rrqrqs tZ00$ 7 77r$c>tt|||Sr)rrxrs rr r s tZ00 1 11r$c tt|||}|jdS|jS#t$r|cYSwxYwrs)rNrxtextr])r0rdefaultrs rfindtextrsYHT44455 9 2y s%00 ??r)NN)rcompiler rr#r,rCrOrSrVr^rcrrrrrxrqr rr*r$rrstv RZ    ----0000&&&R&  >   n+n+n+b        ''''X8888 2222 r$__pycache__/ElementInclude.cpython-311.opt-2.pyc000064400000011034152531452610015316 0ustar00 fddlZddlmZddlmZdZedzZedzZdZGd d e Z Gd d e Z dd Z ddefdZ dZdS)N) ElementTree)urljoinz!{http://www.w3.org/2001/XInclude}includefallbackceZdZdS)FatalIncludeErrorN__name__ __module__ __qualname__?/opt/alt/python311/lib64/python3.11/xml/etree/ElementInclude.pyr r CDrr ceZdZdS)LimitedRecursiveIncludeErrorNr rrrrrGrrrc4|dkrOt|d5}tj|}dddn #1swxYwYnB|sd}t|d|5}|}dddn #1swxYwY|S)NxmlrbzUTF-8r)encoding)openrparsegetrootread)hrefrrfiledatas rdefault_loaderr!Ws ~~ $   5$T**2244D 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 H $h / / / 499;;D                Ks#'A  AA,B  BBc|d}n|dkrtd|zt|dr|}|t}t ||||t dS)Nrz;expected non-negative depth or None for 'max_depth', got %rr) ValueErrorhasattrrr!_includeset)elemloaderbase_url max_depths rrrtsv QVYbbccctY||~~ ~ T68Y66666rcNd}|t|kr||}|jtkr|d}|rt ||}|dd}|dkr||vrt d|z|dkrt d|z|||||} | t d|d|tj| } t| |||d z || ||j r| j pd |j z| _ | ||<n|d kr}||||d } | t d|d||j r | |j z } |r||d z } | j pd | z| _ n|j pd | z|_ ||=t d |z|jtkrt d|jzt||||||d z }|t|k dSdS)Nrrrrzrecursive include of %sz5maximum xinclude depth reached when including file %sz cannot load z as rtextrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))lentagXINCLUDE_INCLUDEgetrr raddcopyr&removetailr.XINCLUDE_FALLBACK) r(r)r*r+ _parent_hrefsierrnoder.s rr&r&s A c$ii-- G 5$ $ $55==D /x..EE'5))E~~=((+,E,LMMM>>6ORVVXXX!!$'''vdE**<++26$$>yvtY]MJJJ$$T***6;!%bAF :DIQ&vdE155+<+<==<++26$$>6#AFND9!9D!%bD 8DII!%bD 8DIG'?%GU' ' '#BQUJ  Q)] C C C Qg c$ii------r)N)r4r-r urllib.parserXINCLUDEr1r7DEFAULT_MAX_INCLUSION_DEPTH SyntaxErrorr rr!rr&rrrr@sf  .i'z)               #4      :1 7 7 7 766666r__pycache__/ElementInclude.cpython-311.opt-1.pyc000064400000011034152531452610015315 0ustar00 fddlZddlmZddlmZdZedzZedzZdZGd d e Z Gd d e Z dd Z ddefdZ dZdS)N) ElementTree)urljoinz!{http://www.w3.org/2001/XInclude}includefallbackceZdZdS)FatalIncludeErrorN__name__ __module__ __qualname__?/opt/alt/python311/lib64/python3.11/xml/etree/ElementInclude.pyr r CDrr ceZdZdS)LimitedRecursiveIncludeErrorNr rrrrrGrrrc4|dkrOt|d5}tj|}dddn #1swxYwYnB|sd}t|d|5}|}dddn #1swxYwY|S)NxmlrbzUTF-8r)encoding)openrparsegetrootread)hrefrrfiledatas rdefault_loaderr!Ws ~~ $   5$T**2244D 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 H $h / / / 499;;D                Ks#'A  AA,B  BBc|d}n|dkrtd|zt|dr|}|t}t ||||t dS)Nrz;expected non-negative depth or None for 'max_depth', got %rr) ValueErrorhasattrrr!_includeset)elemloaderbase_url max_depths rrrtsv QVYbbccctY||~~ ~ T68Y66666rcNd}|t|kr||}|jtkr|d}|rt ||}|dd}|dkr||vrt d|z|dkrt d|z|||||} | t d|d|tj| } t| |||d z || ||j r| j pd |j z| _ | ||<n|d kr}||||d } | t d|d||j r | |j z } |r||d z } | j pd | z| _ n|j pd | z|_ ||=t d |z|jtkrt d|jzt||||||d z }|t|k dSdS)Nrrrrzrecursive include of %sz5maximum xinclude depth reached when including file %sz cannot load z as rtextrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))lentagXINCLUDE_INCLUDEgetrr raddcopyr&removetailr.XINCLUDE_FALLBACK) r(r)r*r+ _parent_hrefsierrnoder.s rr&r&s A c$ii-- G 5$ $ $55==D /x..EE'5))E~~=((+,E,LMMM>>6ORVVXXX!!$'''vdE**<++26$$>yvtY]MJJJ$$T***6;!%bAF :DIQ&vdE155+<+<==<++26$$>6#AFND9!9D!%bD 8DII!%bD 8DIG'?%GU' ' '#BQUJ  Q)] C C C Qg c$ii------r)N)r4r-r urllib.parserXINCLUDEr1r7DEFAULT_MAX_INCLUSION_DEPTH SyntaxErrorr rr!rr&rrrr@sf  .i'z)               #4      :1 7 7 7 766666r__pycache__/__init__.cpython-311.opt-2.pyc000064400000000246152531452610014163 0ustar00 fEdS)Nr9/opt/alt/python311/lib64/python3.11/xml/etree/__init__.pyrsr__pycache__/ElementTree.cpython-311.opt-1.pyc000064400000257567152531452610014660 0ustar00 f"dZgdZdZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z Gdde Zd ZGd d Zifd ZdDd ZdDdZeZGddZGddZe jdZdDdZdZhdZdZdZeeedZdZdddddd d!d"Z e e_ d#Z!d$Z"d%Z#d&Z$dEddd'd(d)Z%Gd*d+ej&Z'dEddd'd(d,Z(d-Z)dFd/Z*dDd0Z+dEd1Z,Gd2d3Z-dDd4Z.dDd5Z/e.Z0dDd6Z1Gd7d8Z2Gd9d:Z3dDddd;d<Z4ej5d=ej6j7Z8Gd>d?Z9d@Z:dAZ; eZZ>e>eedS#e?$rYdSwxYw)GaLightweight 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) ElementPathceZdZdZdS)r zAn 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____doc__text...tail Nc t|tstd|jj||_i|||_g|_dS)Nzattrib must be dict, not ) isinstancedict TypeError __class__r r(attrib _children)selfr(r1extras r&__init__zElement.__init__s\&$'' -) )),-- -))5) r%cJd|jj|jt|fzS)Nz<%s %r at %#x>)r0r r(idr3s r&__repr__zElement.__repr__s!4>#:DHbhh"OOOr%c.|||S)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. )r0)r3r(r1s r& makeelementzElement.makeelements~~c6***r%c^tjdt|S)zReturn copy of current element. This creates a shallow copy. Subelements will be shared with the original tree. z7elem.copy() is deprecated. Use copy.copy(elem) instead.)warningswarnDeprecationWarning__copy__r8s r&copyz Element.copys.  E    }}r%c||j|j}|j|_|j|_||dd<|SN)r;r(r1texttail)r3elems r&r@zElement.__copy__s?$+66I I QQQ r%c*t|jSrC)lenr2r8s r&__len__zElement.__len__s4>"""r%cjtjdtdt|jdkS)NzyThe behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. stacklevelr)r=r> FutureWarningrHr2r8s r&__bool__zElement.__bool__s=  K a     4>""a''r%c|j|SrCr2r3indexs r& __getitem__zElement.__getitem__s~e$$r%ct|tr|D]}||n||||j|<dSrC)r-slice_assert_is_elementr2)r3rSr*elts r& __setitem__zElement.__setitem__sg eU # # - - -'',,,, -  # #G , , , 'ur%c|j|=dSrCrQrRs r& __delitem__zElement.__delitem__s N5 ! ! !r%cd|||j|dS)aAdd *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. NrWr2appendr3 subelements r&r^zElement.appends4  +++ j)))))r%cn|D]1}|||j|2dS)zkAppend subelements from a sequence. *elements* is a sequence with zero or more elements. Nr])r3elementsr*s r&extendzElement.extendsJ   + +G  # #G , , , N ! !' * * * * + +r%cf|||j||dS)z(Insert *subelement* at position *index*.N)rWr2insert)r3rSr`s r&rezElement.inserts4  +++ eZ00000r%cxt|ts$tdt|jzdS)Nzexpected an Element, not %s)r- _Element_Pyr/typer )r3es r&rWzElement._assert_is_elements@![)) N9DGG)r0r rDr8s r&r9zQName.__repr__s  N333TYYY??r%c*t|jSrC)hashrDr8s r&__hash__zQName.__hash__sDIr%cbt|tr|j|jkS|j|kSrCr-rrDr3others r&__le__z QName.__le__0 eU # # +9 * *yE!!r%cbt|tr|j|jkS|j|kSrCrrs r&__lt__z QName.__lt__0 eU # # *9uz) )y5  r%cbt|tr|j|jkS|j|kSrCrrs r&__ge__z QName.__ge__rr%cbt|tr|j|jkS|j|kSrCrrs r&__gt__z QName.__gt__rr%cbt|tr|j|jkS|j|kSrCrrs r&__eq__z QName.__eq__rr%rC) r r!r"r#r5rr9rrrrrrr$r%r&rrs      @@@"""!!!"""!!!"""""r%rcreZdZdZddZdZdZddZddZddZ dd Z dd Z dd Z dd d dZ dZdS)ra%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. NcF||_|r||dSdSrC)_rootr )r3r*files r&r5zElementTree.__init__s3   JJt       r%c|jS)z!Return root element of this tree.rr8s r&getrootzElementTree.getroots zr%c||_dS)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)r3r*s r&_setrootzElementTree._setroot#s r%cd}t|dst|d}d} |Vt}t|dr8|||_|j|r|SS |d}|sn||.||_|j|r|SS#|r|wwxYw)a=Load 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. FreadrbTN _parse_wholei)r)openrrrcloserfeed)r3sourceparser close_sourcedatas r&r zElementTree.parse-s vv&& &$''FL ~"6>22& "(!4!4V!AC$$C=c6|j|S)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). )rrr3r(s r&rzElementTree.iterRszs###r%c|dddkr$d|z}tjd|ztd|j||S)a\Find 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 %rrKrL)r=r>rNrrmrns r&rmzElementTree.find^sc 8s??:D M-/34!      ztZ000r%c|dddkr$d|z}tjd|ztd|j|||S)aeFind 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. NrrrrrKrL)r=r>rNrrrrss r&rrzElementTree.findtexttsg 8s??:D M-/34!      z""4*===r%c|dddkr$d|z}tjd|ztd|j||S)aaFind 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. NrrrrrKrL)r=r>rNrrvrns r&rvzElementTree.findallse 8s??:D M-/34!      z!!$ 333r%c|dddkr$d|z}tjd|ztd|j||S)agFind 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. NrrrrrKrL)r=r>rNrrxrns r&rxzElementTree.iterfindse 8s??:D M-/34!      z""4444r%Tshort_empty_elementsc|sd}n|tvrtd|z|s |dkrd}nd}t||5\}}|dkrA|s0|=|dkr%|dvr|d |d |d krt ||jn:t |j|\} } t|} | ||j| | | ddddS#1swxYwYdS) aWrite 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 rDr) _serialize ValueError _get_writerlower_serialize_textr _namespaces) r3file_or_filenameencodingxml_declarationdefault_namespacemethodrwritedeclared_encodingqnamesrp serializes r&rzElementTree.writes: ;FF : % %069:: : &"% )8 4 4 E8R@QO$,^^%%22&,,..6KKK%%%()))tz2222%0=N%O%O" &v.  %VZ/CEEEE E E E E E E E E E E E E E E E E E EsB!C,,C03C0c0||dS)Nr)r)r)r3rs r& write_c14nzElementTree.write_c14nszz$vz...r%rrC)NNNN)r r!r"r#r5rrr rrmrrrvrxrrr$r%r&rrs   ####J $ $ $ $1111,>>>>,4444,5555." $ 3E $( 3E3E3E3E3Ej/////r%rc#xK |j}|dkr|t|ddpdfVdStj5}t |t jr|}nt |t jr/t j |}| |j nLt j}d|_ ||_ |j |_ |j|_n#t$rYnwxYwt j||dd}| |j |j|fVddddS#1swxYwYdS#t$rV|dkrd}t#|d|d 5}|j|fVdddYdS#1swxYwYYdSwxYw) NrrrcdSNTr$r$r%r&z_get_writer..sDr%xmlcharrefreplace )rerrorsnewlinew)rr)rrgetattr contextlib ExitStackr-ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletellAttributeError TextIOWrapperr)rrrstackrs r&rrs-+ & >>  y ( (!1:tDDOO O O O O O%'' +5.0ABB+DD 0",??,-=>>DNN4;////,..D$0LDM!&DJ)9(A $4$9 )'19/B04666 t{+++j(****9 + + + + + + + + + + + + + + + + + + ''' >>  y ( (H "C(,... '15*h& & & & ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'smEB E C21E 2 C?<E >C??AE  EE7F9 F* F9*F. .F91F. 2F98F9cddiird<fd}|D])}|j}t|tr|jvr||jnHt|t r|vr ||n#|!|t ur|turt|| D]^\}}t|tr|j}|vr ||t|tr|jvr||j_|j}t|tr|jvr||j+fS)Nc |dddkr|dddd\}}|}|9t|}|dtz}|dkr||<|r |d||<dS||<dSrt d||<dS#t $rt |YdSwxYw)Nrrrzns%dr:z.add_qname/s .RaRyC 9++C33S#,,>+//44F~!'#j//!9*0 3(/5vvss$;F5MMM$'F5MMM$$3!&u  . . . &u - - - - - - .sB B/B/B//C  C ) rr(r-rrDrrr rr) rFrrr(r}rrDrprs ` @@r&rr$sD\FJ+(* $%.......8 !!h c5 ! ! ,xv%% #(### S ! ! ,&   # _G!3!32 &s + + +**,, & &JC#u%% h&   #%'' &EJf,D,D %*%%%y dE " " !ty'>'> Idi : r%c |j}|j}|tur|d|zn|tur|d|zn||}|5|r|t ||D]}t |||d|na|d|zt |} | s|r|rPt|dD]+\} } | rd| z} |d| d t| d ,| D]k\} } t| tr| j} t| tr|| j} nt| } |d || d | d l|st|s|sP|d |r|t ||D]}t |||d||d |zd zn |d|j r|t |j dSdS)N rrc|dSNrr$xs r&rz _serialize_xml..w QqTr%r}r xmlns=""rr)r(rDrr _escape_cdata_serialize_xmllistrsorted_escape_attribr-rrHrE) rrFrrprkwargsr(rDrirvks r&rras (C 9D g~~ kD !!!! % % % hoSk ; +mD))*** J Jua4HJJJJJ J E#)   &&E 9  9 &z'7'7'9'9+9>!;!;!;1( #aAAA*1----"99DAq!!U++#F!!U++."16N*1--EE&)))QQQ78888 s4yy (< c /E---...NNA"5!VT8LNNNNNdSj3&''''e  y( mDI&&'''''((r%>brhrcolimgwbrareabaselinkmetaembedframeinputparamtrackrisindexbasefontc j|j}|j}|tur|dt|zn|tur|dt|zn||}|3|r|t||D]}t |||dnu|d|zt |}|s|r|rPt|dD]+\} } | rd| z} |d| dt| d ,|D]k\} } t| tr| j} t| tr|| j} nt| } |d || d| d l|d | } |r0| d ks| d kr ||n|t||D]}t |||d| tvr|d|zd z|jr|t|jdSdS)Nr r rc|dSr r$rs r&rz!_serialize_html..rr%rrrrrrrscriptstyler)r(rDrrr_serialize_htmlrrrrr-r_escape_attrib_htmlr HTML_EMPTYrE) rrFrrprr(rDrirrrltags r&r2r2s (C 9D g~~ kM$///0000 % % % ht,,,----Sk ; +mD))*** 8 8q&$7777 8 E#)   &&E 9  9 &z'7'7'9'9+9>!;!;!;1( #aAAA*1----"99DAq!!U++#F!!U++3"16N/22EE&)))QQQ78888 E#JJJ99;;D /8##twE$KKKKE---... 8 8q&$7777:%%dSj3&''' y( mDI&&'''''((r%c||D] }|||jr||jdSdSrC)rrE)rrFparts r&rrsT  d  y dir%)rhtmlrDctjd|rtdttD]\}}||ks||krt|=|t|<dS)atRegister 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)rematchrrrr)rrrrs r&rrsy x 6""DBCCC^))++,,""1 88qF{{q! N3r%rr8rdfwsdlxsxsidc)$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/cRtd|dt|jd)Nzcannot serialize z (type ))r/rhr rs r&rrs1 )+/44d1D1D1DE   r%c d|vr|dd}d|vr|dd}d|vr|dd}|S#ttf$rt|YdSwxYw)N&&r<r>replacer/rrrs r&rrs ) $;;<<W--D $;;<<V,,D $;;<<V,,D ~ &)))"4(((((()AA A65A6c d|vr|dd}d|vr|dd}d|vr|dd}d|vr|dd}d |vr|d d }d |vr|d d }d |vr|d d}|S#ttf$rt|YdSwxYw)NrErFrrGrrHr" z rz  z rIrs r&rrs ) $;;<<W--D $;;<<V,,D $;;<<V,,D 4<<<<h//D 4<<<<g..D 4<<<<g..D 4<<<<g..D ~ &)))"4(((((()sB7B:: CCc d|vr|dd}d|vr|dd}d|vr|dd}|S#ttf$rt|YdSwxYw)NrErFrrHrrMrIrs r&r3r3+s ) $;;<<W--D $;;<<V,,D 4<<<<h//D ~ &)))"4(((((()rKT)rrrc|dkrtjntj}t||||||||S)a Generate 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. rrrrr)rStringIOBytesIOrrgetvalue)r*rrrrrstreams r&rr:sm ')33R[]]]Fvx/>1B&,4H JJJ ??  r%c0eZdZdZdZdZdZdZdZdS)_ListDataStreamz7An auxiliary stream accumulating into a list reference.c||_dSrC)lst)r3rZs r&r5z_ListDataStream.__init__Ts r%cdSrr$r8s r&rz_ListDataStream.writableWtr%cdSrr$r8s r&rz_ListDataStream.seekableZr\r%c:|j|dSrC)rZr^)r3bs r&rz_ListDataStream.write]s r%c*t|jSrC)rHrZr8s r&rz_ListDataStream.tell`s48}}r%N) r r!r"r#r5rrrrr$r%r&rXrXRseAAr%rXcxg}t|}t||||||||S)NrR)rXrr)r*rrrrrrZrVs r&rrcsU C S ! !Fvx/>1B&,4H JJJ Jr%c t|tst|}|tjd|j}|r |ddkr!tjddSdS)a#Write 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)rrN)r-rrsysstdoutrrE)rFrEs r&rrps dK ( (!4  JJszIJ... <<>> D 48t## $#r% ct|tr|}|dkrtd|t |sdSd|zzgfd|ddS)a&Indent 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|dz} |}n0#t$r#|z}|YnwxYw|jr|js||_|D]D}t |r |||jr|js||_E|js||_dSdSr ) IndexErrorr^rDstriprHrE)rFlevel child_levelchild_indentationchild_indent_children indentationsspaces r&roz indent.._indent_childrensai  3 ,[ 9   3 3 3 ,U 3e ;     1 2 2 2 2 2 3y *  1 1 *)DI / /E5zz 5   444: /UZ%5%5%7%7 /. z!! -%e,EJJJ - -s *>>)r-rrrrH)treerqrkrorps ` @@r&rrs$ $$||~~ qyyOOOPPP t9955=()L-------,T1r%cNt}||||S)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 )rrrrs r&r r s& ==DJJvv Kr%ct||tdstddndfdGfddtjj}|}d |_tj||S) aJIncrementally 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_parserrrTFc3K Ed{V|d}|sn|H}Ed{V}|||_r|dSdS#r|wwxYw)NTi@) read_eventsrr_close_and_return_rootrootr)rrrzitr pullparserwrs r&iteratorziterparse..iterators  &%11333333333{{9--%%%  &4466D!--// / / / / / / /B~    |   s B B))Cc<eZdZjZfdZdS)$iterparse..IterParseIteratorc8rdSdSrC)r)r3rrs r&__del__z,iterparse..IterParseIterator.__del__s&    r%N)r r!r"__next__r)rr~rsr&IterParseIteratorrsE8F##,        r%rN) rr)r collectionsabcIteratorrzweakrefref) rrurrr{rr~r|r}s ` @@@@r&r r s"ff===J 66 " "fd##  $KO4    BBG RB Ir%c:eZdZd dddZdZdZdZdZdZdS) rN)rvctj|_|ptt |_|d}|j|j|dS)Nr)end)rdeque _events_queuerrrv _setevents)r3rurvs r&r5zXMLPullParser.__init__s[ ).00A);=="A"A"A >F  2F;;;;;r%c|jtd|rO |j|dS#t$r%}|j|Yd}~dSd}~wwxYwdS)Feed encoded data to parser.Nz!feed() called after end of stream)rvrr SyntaxErrorrr^)r3rexcs r&rzXMLPullParser.feed s < @AA A  / / !!$''''' / / /"))#......... / / /s6 A%A  A%cF|j}d|_|SrC)rvr)r3rzs r&ryz$XMLPullParser._close_and_return_roots!|!!##  r%c.|dS)zFinish feeding data to parser. Unlike XMLParser, does not return the root element. Use read_events() to consume elements from XMLPullParser. N)ryr8s r&rzXMLPullParser.closes ##%%%%%r%c#K|j}|r3|}t|tr||V|1dSdS)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)rpopleftr- Exception)r3ruevents r&rxzXMLPullParser.read_events%se # NN$$E%++        r%cd|jtd|jdS)Nz"flush() called after end of stream)rvrflushr8s r&rzXMLPullParser.flush3s3 < ABB B r%rC) r r!r"r5rryrrxrr$r%r&rrs >r%c|stt}|||}i}|D]}|d}|r|||<||fS)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. rr7)rrrrrr|)rDrrridsrFr7s r&rrJs 1+--000 KK <<>>D C  XXd^^  CG 9r%c|stt}|D]}|||S)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)sequencerrDs r&rrbsR 1+--000 D <<>>r%cXeZdZdZdddddddZdZdZdZd Zd Z d Z dd Z d Z dS)ra8Generic 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_piscg|_g|_d|_d|_d|_|t }||_||_|t}||_ ||_ |t}||_ dSrC) _data_elem_lastr_tailr_comment_factoryrr _pi_factoryrr_factory)r3element_factoryrrrrs r&r5zTreeBuilder.__init__sr      "%O /.  .J%$  "%O' r%c|jS)z;Flush builder buffers and return toplevel document Element.rr8s r&rzTreeBuilder.closes zr%c|jrJ|j:d|j}|jr ||j_n ||j_g|_dSdSNr)rrjoinrrErDr3rDs r&_flushzTreeBuilder._flushs\ : z%wwtz**:+&*DJOO'+DJODJJJ  r%c:|j|dS)zAdd text to current element.N)rr^r3rs r&rzTreeBuilder.datas $r%c||||x|_}|jr!|jd|n|j||_|j|d|_|S)zOpen new element and return it. *tag* is the element name, *attrs* is a dict containing element attributes. rcNr)rrrrr^rr)r3r(attrsrFs r&startzTreeBuilder.starts  MM#u555 T :  JrN ! !$ ' ' ' ' Z DJ $  r%c||j|_d|_|jS)zOClose and return current Element. *tag* is the element name. r)rrpoprrrs r&rzTreeBuilder.ends5 Z^^%%  zr%cD||j|j|S)z`Create a comment using the comment_factory. *text* is the text of the comment. )_handle_singlerrrs r&commentzTreeBuilder.comments) ""  !4#7?? ?r%cF||j|j||S)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 ''. )rrr)r3rrDs r&pizTreeBuilder.pis* ""  dovt== =r%c||}|rI|||_|jr |jd|d|_|S)Nrcr)rrrr^r)r3factoryreargsrFs r&rzTreeBuilder._handle_singlesYw~   KKMMMDJz , 2%%d+++DJ r%rC) r r!r"r#r5rrrrrrrrr$r%r&rrts&(!%$!&5((((((      "   ???====r%rcbeZdZdZddddZdZdZdZdZd Z d Z d Z d Z d Z dZdZdS)raaElement 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)rrc@ ddlm}n3#t$r& ddl}n#t$rtdwxYwYnwxYw||d}|t }|x|_|_|x|_|_ |j |_ i|_ |j |_t|dr |j|_t|dr |j|_t|dr |j|_t|dr |j|_t|d r |j|_t|d r |j|_t|d r |j|_d |_d |_d|_ i|_! d |j"z|_#dS#tH$rYdSwxYw)Nrexpatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrstart_nsend_nsrrrrzExpat %d.%d.%d)% xml.parsersr ImportErrorpyexpat ParserCreaterrrvr_targeterror_error_names_defaultDefaultHandlerExpandr)_startStartElementHandler_endEndElementHandler _start_nsStartNamespaceDeclHandler_end_nsEndNamespaceDeclHandlerrCharacterDataHandlerrCommentHandlerrProcessingInstructionHandler buffer_textordered_attributes_doctypeentity version_infoversionr)r3rrrrs r&r5zXMLParser.__init__s  ) ) ) ) ) ) )    '''''   !M (' ##Hc22 > ]]F%++ dl%++ dlk  &*m# 67 # # 5)-F & 65 ! ! 1'+yF $ 6: & & >/3~F , 68 $ $ :-1\F * 66 " " 6*0+F ' 69 % % 3$*NF ! 64  <28)F /$%!   +e.@@DLLL    DD s. 99399>F FFc|j}|j}|D]}|dkrd|_|||jfd}||_#|dkr|||jfd}||_=|dkr0t|jdr |||j fd}n||fd }||_ s|d kr0t|jd r |||j fd }n||fd }||_ |dkr|||fd}||_ |dkr|||fd}||_td|zdS)Nrrc4|||||fdSrCr$)r( attrib_inrr^rs r&handlerz%XMLParser._setevents..handler1s)FE55i#8#89:::::r%rc2||||fdSrCr$)r(rr^rs r&rz%XMLParser._setevents..handler6s%FE33s88,-----r%zstart-nsrc4|||||fdSrCr$)rrrr^rs r&rz%XMLParser._setevents..handler=s)xx'<'<=>>>>>r%c,|||pd|pdffdSrr$)rrrr^s r&rz%XMLParser._setevents..handlerAs* "ciR'@ABBBBBr%zend-nsrc2||||fdSrCr$)rrr^rs r&rz%XMLParser._setevents..handlerGs%vvf~~677777r%c ||dfdSrCr$)rrr^s r&rz%XMLParser._setevents..handlerKst}-----r%rcP|||j|fdSrC)rr)rDrr^r3s r&rz%XMLParser._setevents..handlerOs-FE4;#6#6t#<#<=>>>>>r%rcR|||j||fdSrC)rr) pi_targetrrr^r3s r&rz%XMLParser._setevents..handlerSs-FE4;>>)T#B#BCDDDDDr%zunknown event %r)rvr^rrrrrr)rrrrrrrr)r3 events_queueevents_to_reportrr^ event_namers r&rzXMLParser._setevents%s$** B* BJW$$,-)2fCCCC3:00x''4;11..8'+|88888/9....18..y(((26????(/%%t##3=f!%EEEE7>33 !3j!@AAAU* B* Br%cbt|}|j|_|j|jf|_|rC)r codelinenooffsetposition)r3rerrs r& _raiseerrorzXMLParser._raiseerrorZs-:|U\1  r%cn |j|}n%#t$r|}d|vrd|z}||j|<YnwxYw|S)Nrr)rKeyError)r3r}names r&_fixnamezXMLParser._fixname`s` $;s#DD $ $ $Dd{{Tz#DK     $  s 22c@|j|pd|pdSr)rrr3rrs r&rzXMLParser._start_nsks"{##FLb#)<<tdt|dD]}||dz||||< |j||S)NrrKr)rrangerHrr)r3r( attr_listfixnamer1is r&rzXMLParser._startqs-gcll  ?1c)nna00 ? ?09!A#wwy|,,--{  f---r%c\|j||SrC)rrrrs r&rzXMLParser._end}s"{t}}S11222r%c|dd}|dkr |jj}n#t$rYdSwxYw ||j|dddS#t$raddlm}|d||jj |jj fz}d|_ |jj |_ |jj |_ |wxYw|dkr|dd d kr g|_dS|j|d kr d|_dS|}|sdS|j|t#|j}|d kr|jd}|d kr|dkr|j\}}} } | r | dd} n|dkr|dkr|j\}}} d} ndSt%|jdr%|j|| | ddn*t%|drt)jdt,d|_dSdSdS)NrrErcrrz'undefined entity %s: line %d, column %d r z RuntimeWarning) r3rDr data_handlerrrnrhrpubidsystems r&rzXMLParser._defaults}bqb S== #{/ !      T[ad455555   ------kk=4;6K133 ![8 ![:   s]]tBQBx;66DMMM ] &}} $ ::< AAA A) B) A63B5A66B Bcp|j} |jd|jddn,#|j$r}||Yd}~nd}~wwxYw|j|dS#|j|wxYw)NFr%)rGetReparseDeferralEnabledSetReparseDeferralEnabledrrr)r3 was_enabledrs r&rzXMLParser.flushsk;;==  ? K 1 1% 8 8 8 K  c5 ) ) ) ){     Q          K 1 1+ > > > > >DK 1 1+ > > > >s/5AB A:A50B5A::BB5)r r!r"r#r5rrrrrrrrrrrr$r%r&rrs"&+++++Z3B3B3Bj   ===000 . . .3334%4%4%l   ***"?????r%r)out from_filec H||tdd}|tjx}}tt |jfi|}|*|||n|t|||| ndS)a3Convert 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) rrrSrrrrrr rU)xml_datar!r"optionssiors r&rrsI-UVVV C {KMM!c .syDDGDD E E EF H    i'''' _3<<>>>$6r%z ^\w+:\w+$ceZdZdZdddddddddZefdZdZddZd Z d j fd Z d Z d Z ddZdZdZdZdS)ra 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_tagscX||_g|_||_||_|rt |nd|_|rt |nd|_||_|rt ||_nd|_|rt |j |_ nd|_ dgg|_ g|_ |s>|j tt|j gi|_dg|_d|_d|_d|_d|_dS)N)rArFr)_writer_with_comments _strip_textr_exclude_attrs _exclude_tags_rewrite_prefixes_qname_aware_tags intersection_find_qname_aware_attrs_declared_ns_stack _ns_stackr^rrr _prefix_map_preserve_space_pending_start _root_seen _root_done_ignored_depth) r3rr(r)r*r+r,r-r.s r&r5zC14NWriterTarget.__init__sE  +%4AKc-000t2>HS...D!1  *%()9%:%:D " "%)D "  0+./@+A+A+ND ( (+/D ( <$ #  @ N ! !$~';';'='=">"> ? ? ? b!!! %w"r%c#:K||D] }|r|Ed{V dSrCr$)r3ns_stack _reversedrps r&_iter_namespacesz!C14NWriterTarget._iter_namespaces7sJ#)H-- & &J &%%%%%%%% & &r%c|dd\}}||jD]\}}||kr d|d|cStd|d|d)NrrrrzPrefix z of QName "" is not declared in scope)splitrDr:r)r3 prefixed_namerrrps r&_resolve_prefix_namez%C14NWriterTarget._resolve_prefix_name<s$**322 ++DN;; * *FCF{{)C))4)))))_6__m___```r%c|4|dddkr|ddddnd|f\}}n|}t}||jD]4\}}||kr||vr|r|d|n|||fcS||5|jrd||jvr|j|}n!dt|jx}|j|<|jd||f|d|||fS|s d|vr|||fS||j D]=\}}||kr2|jd||f|r|d|n|||fcS>|s|||fStd|d ) Nrrrrrrrcz Namespace "rF) rrrDr9addr5r;rHr^r:r)r3rrr( prefixes_seenurs r&_qnamezC14NWriterTarget._qnameCs$ ;38!93C3CuQRRy''Q///"eHCC ..t/FGG & &IAvCxxF-77,2;&((3(((S#EEEE   f % % % %  ! /d&&&)#.1LS9I5J5J1L1LL)#.  #B ' . .V} = = =$$s$$c3. . !r..S= ..t~>> F FIAvCxx'+22C=AAA,2;&((3(((S#EEEE !S= FsFFFGGGr%cL|js|j|dSdSrC)r@rr^rs r&rzC14NWriterTarget.datahs3" $ J  d # # # # # $ $r%rcd||j}|jdd=|jr!|jds|}|j7|jdc}|_|rt |r|nd}|jg||R|dS|r+|jr&|t|dSdSdSNrc) rr2r<rjr=_looks_like_prefix_namerr>r0_escape_cdata_c14n)r3 _join_textrr qname_texts r&rzC14NWriterTarget._flushlsz$*%% JqqqM   D$8$< ::<D  F C/////r%cj"|r fd|D}|h|}i}|/|x}||<||jh|rf|}|rL|D]H} || } t | r/| x}|| <||Ind}nd}jfdt|dD} |r!d|D} | ng} |rlt|D]J\} }|| |vr||vr| ||d}| | \}} }| |r|n| |fK| d}j |r|dkn j d j }|d | |dz| r(|d d | D|d |*|t| ||dd_j gdS)Nc.i|]\}}|jv||Sr$)r3).0rrr3s r& z+C14NWriterTarget._start..s,TTTdaq@S7S7SQ7S7S7Sr%c(i|]}||Sr$r$)r\r parse_qnames r&r]z+C14NWriterTarget._start..s/444qKKNN444r%c.|ddS)Nrr)rG)rs r&rz)C14NWriterTarget._start..s!''#q//r%rc*g|]\}}|rd|znd|fS)zxmlns:xmlnsr$)r\rrs r& z+C14NWriterTarget._start..s@C'-9F""'3?r%rz+{http://www.w3.org/XML/1998/namespace}spacepreservercrrc@g|]\}}d|dt|dS)rrr)_escape_attrib_c14n)r\rrs r&rcz+C14NWriterTarget._start..s9TTT$!Q=q==$7$:$:===TTTr%rT)r3rrJrLr8rSrOrsortr^r|r<r0rrTr>r:)r3r(rrYrVrresolved_namesrqattrs attr_namer parsed_qnamesrrr attr_qnamerspace_behaviourrr_s` @r&rzC14NWriterTarget._starts6   *u *TTTTekkmmTTTE  !151J1J:1V1V VEN:. JJu     ' 3 311%88F !'**I!),E.u55*8<8Q8QRW8X8XXu 5 5))) * Fk 4444F 11535353444   #1I NN    I  Hu{{}}-- H H1%!v++!~:M:M%nQ&78;A-:1-=* Is  "B**A!FGGGG ))$QRR ##-< *Oz ) )%b) + + +   cM#&q))***  W E"''TT)TTTUU V V V c   ! E$]>*3M%Nq%QRR S S S b!!!!!r%c|jr|xjdzc_dS|jr||d||dd|jt|jdk|_|j |j dS)Nrrrr) r@rrr0rOr<rrHr?r9r:rs r&rzC14NWriterTarget.ends      1 $   F :  KKMMM /S))!,///000   """d233q8 ##%%% r%c0|jsdS|jrdS|jr|dn"|jr|jr||dt|d|js|ddSdS)Nrz)r1r@r?r0r>rrrTrs r&rzC14NWriterTarget.comments"  F    F ?  KK     _   KKMMM 8-d33888999  KK       r%c4|jrdS|jr|dn"|jr|jr|||rd|dt |dnd|d|js|ddSdS)Nrz)r@r?r0r>rrrT)r3rrs r&rzC14NWriterTarget.pis    F ?  KK     _   KKMMM :> S 6 6 6,T22 6 6 6 6OOOO U U U  KK       r%rC)r r!r"r#r5reversedrDrJrOrrrrrrrrrr$r%r&rrs, %"&$#$# # # # # J4<&&&& aaa#H#H#H#HJ$$$!# 2 2 2 2111000"C"C"C"C"J           r%rc& d|vr|dd}d|vr|dd}d|vr|dd}d|vr|dd}|S#ttf$rt|YdSwxYw) NrErFrrGrrHrN rIrs r&rTrTs) $;;<<W--D $;;<<V,,D $;;<<V,,D 4<<<<g..D ~ &)))"4(((((()sA)A,, BBc d|vr|dd}d|vr|dd}d|vr|dd}d|vr|dd}d |vr|d d }d |vr|d d }|S#ttf$rt|YdSwxYw) NrErFrrGrrMrOz rz rNrsrIrs r&rfrfs) $;;<<W--D $;;<<V,,D $;;<<X..D 4<<<<g..D 4<<<<g..D 4<<<<g..D ~ &)))"4(((((()sBB CC)r)_set_factoriesrCr)rfr)@r#__all__rrdr:r=rrcollections.abcrrrrrr r rrrrr rrcontextmanagerrrrr4r2rrrrrrrr3rrrXrrrr r rrrrrrrrcompileUNICODEr;rSrrTrfrg _elementtreerurr$r%r&r|s'!!P   (             ### jjjjjjjjZ $&$     +"+"+"+"+"+"+"+"`_/_/_/_/_/_/_/_/H /+/+/+b;;;;z0(0(0(d 0(0(0(d    !!!*-2$*38(.(,16(,  %3!   ))) )))8 ) ) )!T"&0b'" !%&*     &////l    5555p77777777t",     $vvvvvvvvth?h?h?h?h?h?h?h?Z7tt77777<%"*\2:>>DD)))&))). 3K++++++N7122222   DD s E77F?F__pycache__/cElementTree.cpython-311.opt-1.pyc000064400000000332152531452610014773 0ustar00 fRddlTdS))*N)xml.etree.ElementTree=/opt/alt/python311/lib64/python3.11/xml/etree/cElementTree.pyrs$#####r__pycache__/cElementTree.cpython-311.opt-2.pyc000064400000000332152531452610014774 0ustar00 fRddlTdS))*N)xml.etree.ElementTree=/opt/alt/python311/lib64/python3.11/xml/etree/cElementTree.pyrs$#####r__pycache__/ElementTree.cpython-311.pyc000064400000260706152531452610013706 0ustar00 f"dZgdZdZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z Gdde Zd ZGd d Zifd ZdDd ZdDdZeZGddZGddZe jdZdDdZdZhdZdZdZeeedZdZdddddd d!d"Z e e_ d#Z!d$Z"d%Z#d&Z$dEddd'd(d)Z%Gd*d+ej&Z'dEddd'd(d,Z(d-Z)dFd/Z*dDd0Z+dEd1Z,Gd2d3Z-dDd4Z.dDd5Z/e.Z0dDd6Z1Gd7d8Z2Gd9d:Z3dDddd;d<Z4ej5d=ej6j7Z8Gd>d?Z9d@Z:dAZ; eZZ>e>eedS#e?$rYdSwxYw)GaLightweight 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) ElementPathceZdZdZdS)r zAn 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____doc__text...tail Nc t|tstd|jj||_i|||_g|_dS)Nzattrib must be dict, not ) isinstancedict TypeError __class__r r(attrib _children)selfr(r1extras r&__init__zElement.__init__s\&$'' -) )),-- -))5) r%cJd|jj|jt|fzS)Nz<%s %r at %#x>)r0r r(idr3s r&__repr__zElement.__repr__s!4>#:DHbhh"OOOr%c.|||S)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. )r0)r3r(r1s r& makeelementzElement.makeelements~~c6***r%c^tjdt|S)zReturn copy of current element. This creates a shallow copy. Subelements will be shared with the original tree. z7elem.copy() is deprecated. Use copy.copy(elem) instead.)warningswarnDeprecationWarning__copy__r8s r&copyz Element.copys.  E    }}r%c||j|j}|j|_|j|_||dd<|SN)r;r(r1texttail)r3elems r&r@zElement.__copy__s?$+66I I QQQ r%c*t|jSrC)lenr2r8s r&__len__zElement.__len__s4>"""r%cjtjdtdt|jdkS)NzyThe behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. stacklevelr)r=r> FutureWarningrHr2r8s r&__bool__zElement.__bool__s=  K a     4>""a''r%c|j|SrCr2r3indexs r& __getitem__zElement.__getitem__s~e$$r%ct|tr|D]}||n||||j|<dSrC)r-slice_assert_is_elementr2)r3rSr*elts r& __setitem__zElement.__setitem__sg eU # # - - -'',,,, -  # #G , , , 'ur%c|j|=dSrCrQrRs r& __delitem__zElement.__delitem__s N5 ! ! !r%cd|||j|dS)aAdd *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. NrWr2appendr3 subelements r&r^zElement.appends4  +++ j)))))r%cn|D]1}|||j|2dS)zkAppend subelements from a sequence. *elements* is a sequence with zero or more elements. Nr])r3elementsr*s r&extendzElement.extendsJ   + +G  # #G , , , N ! !' * * * * + +r%cf|||j||dS)z(Insert *subelement* at position *index*.N)rWr2insert)r3rSr`s r&rezElement.inserts4  +++ eZ00000r%cxt|ts$tdt|jzdS)Nzexpected an Element, not %s)r- _Element_Pyr/typer )r3es r&rWzElement._assert_is_elements@![)) N9DGG)r0r rDr8s r&r9zQName.__repr__s  N333TYYY??r%c*t|jSrC)hashrDr8s r&__hash__zQName.__hash__sDIr%cbt|tr|j|jkS|j|kSrCr-rrDr3others r&__le__z QName.__le__0 eU # # +9 * *yE!!r%cbt|tr|j|jkS|j|kSrCrrs r&__lt__z QName.__lt__0 eU # # *9uz) )y5  r%cbt|tr|j|jkS|j|kSrCrrs r&__ge__z QName.__ge__rr%cbt|tr|j|jkS|j|kSrCrrs r&__gt__z QName.__gt__rr%cbt|tr|j|jkS|j|kSrCrrs r&__eq__z QName.__eq__rr%rC) r r!r"r#r5rr9rrrrrrr$r%r&rrs      @@@"""!!!"""!!!"""""r%rcreZdZdZddZdZdZddZddZddZ dd Z dd Z dd Z dd d dZ dZdS)ra%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. NcF||_|r||dSdSrC)_rootr )r3r*files r&r5zElementTree.__init__s3   JJt       r%c|jS)z!Return root element of this tree.rr8s r&getrootzElementTree.getroots zr%c||_dS)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)r3r*s r&_setrootzElementTree._setroot#s r%cd}t|dst|d}d} |Vt}t|dr8|||_|j|r|SS |d}|sn||.||_|j|r|SS#|r|wwxYw)a=Load 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. FreadrbTN _parse_wholei)r)openrrrcloserfeed)r3sourceparser close_sourcedatas r&r zElementTree.parse-s vv&& &$''FL ~"6>22& "(!4!4V!AC$$C=c6|j|S)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). )rrr3r(s r&rzElementTree.iterRszs###r%c|dddkr$d|z}tjd|ztd|j||S)a\Find 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 %rrKrL)r=r>rNrrmrns r&rmzElementTree.find^sc 8s??:D M-/34!      ztZ000r%c|dddkr$d|z}tjd|ztd|j|||S)aeFind 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. NrrrrrKrL)r=r>rNrrrrss r&rrzElementTree.findtexttsg 8s??:D M-/34!      z""4*===r%c|dddkr$d|z}tjd|ztd|j||S)aaFind 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. NrrrrrKrL)r=r>rNrrvrns r&rvzElementTree.findallse 8s??:D M-/34!      z!!$ 333r%c|dddkr$d|z}tjd|ztd|j||S)agFind 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. NrrrrrKrL)r=r>rNrrxrns r&rxzElementTree.iterfindse 8s??:D M-/34!      z""4444r%Tshort_empty_elementsc|sd}n|tvrtd|z|s |dkrd}nd}t||5\}}|dkrA|s0|=|dkr%|dvr|d |d |d krt ||jn:t |j|\} } t|} | ||j| | | ddddS#1swxYwYdS) aWrite 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 rDr) _serialize ValueError _get_writerlower_serialize_textr _namespaces) r3file_or_filenameencodingxml_declarationdefault_namespacemethodrwritedeclared_encodingqnamesrp serializes r&rzElementTree.writes: ;FF : % %069:: : &"% )8 4 4 E8R@QO$,^^%%22&,,..6KKK%%%()))tz2222%0=N%O%O" &v.  %VZ/CEEEE E E E E E E E E E E E E E E E E E EsB!C,,C03C0c0||dS)Nr)r)r)r3rs r& write_c14nzElementTree.write_c14nszz$vz...r%rrC)NNNN)r r!r"r#r5rrr rrmrrrvrxrrr$r%r&rrs   ####J $ $ $ $1111,>>>>,4444,5555." $ 3E $( 3E3E3E3E3Ej/////r%rc#xK |j}|dkr|t|ddpdfVdStj5}t |t jr|}nt |t jr/t j |}| |j nLt j}d|_ ||_ |j |_ |j|_n#t$rYnwxYwt j||dd}| |j |j|fVddddS#1swxYwYdS#t$rV|dkrd}t#|d|d 5}|j|fVdddYdS#1swxYwYYdSwxYw) NrrrcdSNTr$r$r%r&z_get_writer..sDr%xmlcharrefreplace )rerrorsnewlinew)rr)rrgetattr contextlib ExitStackr-ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletellAttributeError TextIOWrapperr)rrrstackrs r&rrs-+ & >>  y ( (!1:tDDOO O O O O O%'' +5.0ABB+DD 0",??,-=>>DNN4;////,..D$0LDM!&DJ)9(A $4$9 )'19/B04666 t{+++j(****9 + + + + + + + + + + + + + + + + + + ''' >>  y ( (H "C(,... '15*h& & & & ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'smEB E C21E 2 C?<E >C??AE  EE7F9 F* F9*F. .F91F. 2F98F9cddiird<fd}|D])}|j}t|tr|jvr||jnHt|t r|vr ||n#|!|t ur|turt|| D]^\}}t|tr|j}|vr ||t|tr|jvr||j_|j}t|tr|jvr||j+fS)Nc |dddkr|dddd\}}|}|9t|}|dtz}|dkr||<|r |d||<dS||<dSrt d||<dS#t $rt |YdSwxYw)Nrrrzns%dr:z.add_qname/s .RaRyC 9++C33S#,,>+//44F~!'#j//!9*0 3(/5vvss$;F5MMM$'F5MMM$$3!&u  . . . &u - - - - - - .sB B/B/B//C  C ) rr(r-rrDrrr rr) rFrrr(r}rrDrprs ` @@r&rr$sD\FJ+(* $%.......8 !!h c5 ! ! ,xv%% #(### S ! ! ,&   # _G!3!32 &s + + +**,, & &JC#u%% h&   #%'' &EJf,D,D %*%%%y dE " " !ty'>'> Idi : r%c |j}|j}|tur|d|zn|tur|d|zn||}|5|r|t ||D]}t |||d|na|d|zt |} | s|r|rPt|dD]+\} } | rd| z} |d| d t| d ,| D]k\} } t| tr| j} t| tr|| j} nt| } |d || d | d l|st|s|sP|d |r|t ||D]}t |||d||d |zd zn |d|j r|t |j dSdS)N rrc|dSNrr$xs r&rz _serialize_xml..w QqTr%r}r xmlns=""rr)r(rDrr _escape_cdata_serialize_xmllistrsorted_escape_attribr-rrHrE) rrFrrprkwargsr(rDrirvks r&rras (C 9D g~~ kD !!!! % % % hoSk ; +mD))*** J Jua4HJJJJJ J E#)   &&E 9  9 &z'7'7'9'9+9>!;!;!;1( #aAAA*1----"99DAq!!U++#F!!U++."16N*1--EE&)))QQQ78888 s4yy (< c /E---...NNA"5!VT8LNNNNNdSj3&''''e  y( mDI&&'''''((r%>brhrcolimgwbrareabaselinkmetaembedframeinputparamtrackrisindexbasefontc j|j}|j}|tur|dt|zn|tur|dt|zn||}|3|r|t||D]}t |||dnu|d|zt |}|s|r|rPt|dD]+\} } | rd| z} |d| dt| d ,|D]k\} } t| tr| j} t| tr|| j} nt| } |d || d| d l|d | } |r0| d ks| d kr ||n|t||D]}t |||d| tvr|d|zd z|jr|t|jdSdS)Nr r rc|dSr r$rs r&rz!_serialize_html..rr%rrrrrrrscriptstyler)r(rDrrr_serialize_htmlrrrrr-r_escape_attrib_htmlr HTML_EMPTYrE) rrFrrprr(rDrirrrltags r&r2r2s (C 9D g~~ kM$///0000 % % % ht,,,----Sk ; +mD))*** 8 8q&$7777 8 E#)   &&E 9  9 &z'7'7'9'9+9>!;!;!;1( #aAAA*1----"99DAq!!U++#F!!U++3"16N/22EE&)))QQQ78888 E#JJJ99;;D /8##twE$KKKKE---... 8 8q&$7777:%%dSj3&''' y( mDI&&'''''((r%c||D] }|||jr||jdSdSrC)rrE)rrFparts r&rrsT  d  y dir%)rhtmlrDctjd|rtdttD]\}}||ks||krt|=|t|<dS)atRegister 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)rematchrrrr)rrrrs r&rrsy x 6""DBCCC^))++,,""1 88qF{{q! N3r%rr8rdfwsdlxsxsidc)$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/cRtd|dt|jd)Nzcannot serialize z (type ))r/rhr rs r&rrs1 )+/44d1D1D1DE   r%c d|vr|dd}d|vr|dd}d|vr|dd}|S#ttf$rt|YdSwxYw)N&&r<r>replacer/rrrs r&rrs ) $;;<<W--D $;;<<V,,D $;;<<V,,D ~ &)))"4(((((()AA A65A6c d|vr|dd}d|vr|dd}d|vr|dd}d|vr|dd}d |vr|d d }d |vr|d d }d |vr|d d}|S#ttf$rt|YdSwxYw)NrErFrrGrrHr" z rz  z rIrs r&rrs ) $;;<<W--D $;;<<V,,D $;;<<V,,D 4<<<<h//D 4<<<<g..D 4<<<<g..D 4<<<<g..D ~ &)))"4(((((()sB7B:: CCc d|vr|dd}d|vr|dd}d|vr|dd}|S#ttf$rt|YdSwxYw)NrErFrrHrrMrIrs r&r3r3+s ) $;;<<W--D $;;<<V,,D 4<<<<h//D ~ &)))"4(((((()rKT)rrrc|dkrtjntj}t||||||||S)a Generate 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. rrrrr)rStringIOBytesIOrrgetvalue)r*rrrrrstreams r&rr:sm ')33R[]]]Fvx/>1B&,4H JJJ ??  r%c0eZdZdZdZdZdZdZdZdS)_ListDataStreamz7An auxiliary stream accumulating into a list reference.c||_dSrC)lst)r3rZs r&r5z_ListDataStream.__init__Ts r%cdSrr$r8s r&rz_ListDataStream.writableWtr%cdSrr$r8s r&rz_ListDataStream.seekableZr\r%c:|j|dSrC)rZr^)r3bs r&rz_ListDataStream.write]s r%c*t|jSrC)rHrZr8s r&rz_ListDataStream.tell`s48}}r%N) r r!r"r#r5rrrrr$r%r&rXrXRseAAr%rXcxg}t|}t||||||||S)NrR)rXrr)r*rrrrrrZrVs r&rrcsU C S ! !Fvx/>1B&,4H JJJ Jr%c t|tst|}|tjd|j}|r |ddkr!tjddSdS)a#Write 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)rrN)r-rrsysstdoutrrE)rFrEs r&rrps dK ( (!4  JJszIJ... <<>> D 48t## $#r% ct|tr|}|dkrtd|t |sdSd|zzgfd|ddS)a&Indent 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|dz} |}n0#t$r#|z}|YnwxYw|jr|js||_|D]D}t |r |||jr|js||_E|js||_dSdSr ) IndexErrorr^rDstriprHrE)rFlevel child_levelchild_indentationchild_indent_children indentationsspaces r&roz indent.._indent_childrensai  3 ,[ 9   3 3 3 ,U 3e ;     1 2 2 2 2 2 3y *  1 1 *)DI / /E5zz 5   444: /UZ%5%5%7%7 /. z!! -%e,EJJJ - -s *>>)r-rrrrH)treerqrkrorps ` @@r&rrs$ $$||~~ qyyOOOPPP t9955=()L-------,T1r%cNt}||||S)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 )rrrrs r&r r s& ==DJJvv Kr%ct||tdstddndfdGfddtjj}|}d |_tj||S) aJIncrementally 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_parserrrTFc3K Ed{V|d}|sn|H}Ed{V}|||_r|dSdS#r|wwxYw)NTi@) read_eventsrr_close_and_return_rootrootr)rrrzitr pullparserwrs r&iteratorziterparse..iterators  &%11333333333{{9--%%%  &4466D!--// / / / / / / /B~    |   s B B))Cc<eZdZjZfdZdS)$iterparse..IterParseIteratorc8rdSdSrC)r)r3rrs r&__del__z,iterparse..IterParseIterator.__del__s&    r%N)r r!r"__next__r)rr~rsr&IterParseIteratorrsE8F##,        r%rN) rr)r collectionsabcIteratorrzweakrefref) rrurrr{rr~r|r}s ` @@@@r&r r s"ff===J 66 " "fd##  $KO4    BBG RB Ir%c:eZdZd dddZdZdZdZdZdZdS) rN)rvctj|_|ptt |_|d}|j|j|dS)Nr)end)rdeque _events_queuerrrv _setevents)r3rurvs r&r5zXMLPullParser.__init__s[ ).00A);=="A"A"A >F  2F;;;;;r%c|jtd|rO |j|dS#t$r%}|j|Yd}~dSd}~wwxYwdS)Feed encoded data to parser.Nz!feed() called after end of stream)rvrr SyntaxErrorrr^)r3rexcs r&rzXMLPullParser.feed s < @AA A  / / !!$''''' / / /"))#......... / / /s6 A%A  A%cF|j}d|_|SrC)rvr)r3rzs r&ryz$XMLPullParser._close_and_return_roots!|!!##  r%c.|dS)zFinish feeding data to parser. Unlike XMLParser, does not return the root element. Use read_events() to consume elements from XMLPullParser. N)ryr8s r&rzXMLPullParser.closes ##%%%%%r%c#K|j}|r3|}t|tr||V|1dSdS)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)rpopleftr- Exception)r3ruevents r&rxzXMLPullParser.read_events%se # NN$$E%++        r%cd|jtd|jdS)Nz"flush() called after end of stream)rvrflushr8s r&rzXMLPullParser.flush3s3 < ABB B r%rC) r r!r"r5rryrrxrr$r%r&rrs >r%c|stt}|||}i}|D]}|d}|r|||<||fS)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. rr7)rrrrrr|)rDrrridsrFr7s r&rrJs 1+--000 KK <<>>D C  XXd^^  CG 9r%c|stt}|D]}|||S)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)sequencerrDs r&rrbsR 1+--000 D <<>>r%cXeZdZdZdddddddZdZdZdZd Zd Z d Z dd Z d Z dS)ra8Generic 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_piscg|_g|_d|_d|_d|_|t }||_||_|t}||_ ||_ |t}||_ dSrC) _data_elem_lastr_tailr_comment_factoryrr _pi_factoryrr_factory)r3element_factoryrrrrs r&r5zTreeBuilder.__init__sr      "%O /.  .J%$  "%O' r%cvt|jdks Jd|j Jd|jS)z;Flush builder buffers and return toplevel document Element.rzmissing end tagsNzmissing toplevel element)rHrrr8s r&rzTreeBuilder.closesC4:!###%7###z%%'A%%%zr%c|jrv|jfd|j}|jr#|jj Jd||j_n"|jj Jd||j_g|_dSdS)Nrzinternal error (tail)zinternal error (text))rrjoinrrErDr3rDs r&_flushzTreeBuilder._flushs : z%wwtz**:+:?224K222&*DJOO:?224K222&*DJODJJJ  r%c:|j|dS)zAdd text to current element.N)rr^r3rs r&rzTreeBuilder.datas $r%c||||x|_}|jr!|jd|n|j||_|j|d|_|S)zOpen new element and return it. *tag* is the element name, *attrs* is a dict containing element attributes. rcNr)rrrrr^rr)r3r(attrsrFs r&startzTreeBuilder.starts  MM#u555 T :  JrN ! !$ ' ' ' ' Z DJ $  r%c||j|_|jj|ksJd|jjd|dd|_|jS)zOClose and return current Element. *tag* is the element name. zend tag mismatch (expected z, got rCr)rrpoprr(rrs r&rzTreeBuilder.endsk Z^^%% z~$$$$:>>>333(%$$ zr%cD||j|j|S)z`Create a comment using the comment_factory. *text* is the text of the comment. )_handle_singlerrrs r&commentzTreeBuilder.comments) ""  !4#7?? ?r%cF||j|j||S)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 ''. )rrr)r3rrDs r&pizTreeBuilder.pis* ""  dovt== =r%c||}|rI|||_|jr |jd|d|_|S)Nrcr)rrrr^r)r3factoryreargsrFs r&rzTreeBuilder._handle_singlesYw~   KKMMMDJz , 2%%d+++DJ r%rC) r r!r"r#r5rrrrrrrrr$r%r&rrts&(!%$!&5((((((      "   ???====r%rcbeZdZdZddddZdZdZdZdZd Z d Z d Z d Z d Z dZdZdS)raaElement 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)rrc@ ddlm}n3#t$r& ddl}n#t$rtdwxYwYnwxYw||d}|t }|x|_|_|x|_|_ |j |_ i|_ |j |_t|dr |j|_t|dr |j|_t|dr |j|_t|dr |j|_t|d r |j|_t|d r |j|_t|d r |j|_d |_d |_d|_ i|_! d |j"z|_#dS#tH$rYdSwxYw)Nrexpatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrstart_nsend_nsrrrrzExpat %d.%d.%d)% xml.parsersr ImportErrorpyexpat ParserCreaterrrvr_targeterror_error_names_defaultDefaultHandlerExpandr)_startStartElementHandler_endEndElementHandler _start_nsStartNamespaceDeclHandler_end_nsEndNamespaceDeclHandlerrCharacterDataHandlerrCommentHandlerrProcessingInstructionHandler buffer_textordered_attributes_doctypeentity version_infoversionr)r3rrrrs r&r5zXMLParser.__init__s  ) ) ) ) ) ) )    '''''   !M (' ##Hc22 > ]]F%++ dl%++ dlk  &*m# 67 # # 5)-F & 65 ! ! 1'+yF $ 6: & & >/3~F , 68 $ $ :-1\F * 66 " " 6*0+F ' 69 % % 3$*NF ! 64  <28)F /$%!   +e.@@DLLL    DD s. 99399>F FFc|j}|j}|D]}|dkrd|_|||jfd}||_#|dkr|||jfd}||_=|dkr0t|jdr |||j fd}n||fd }||_ s|d kr0t|jd r |||j fd }n||fd }||_ |dkr|||fd}||_ |dkr|||fd}||_td|zdS)Nrrc4|||||fdSrCr$)r( attrib_inrr^rs r&handlerz%XMLParser._setevents..handler1s)FE55i#8#89:::::r%rc2||||fdSrCr$)r(rr^rs r&rz%XMLParser._setevents..handler6s%FE33s88,-----r%zstart-nsrc4|||||fdSrCr$)rrrr^rs r&rz%XMLParser._setevents..handler=s)xx'<'<=>>>>>r%c,|||pd|pdffdSNrr$)rrrr^s r&rz%XMLParser._setevents..handlerAs* "ciR'@ABBBBBr%zend-nsrc2||||fdSrCr$)rrr^rs r&rz%XMLParser._setevents..handlerGs%vvf~~677777r%c ||dfdSrCr$)rrr^s r&rz%XMLParser._setevents..handlerKst}-----r%rcP|||j|fdSrC)rr)rDrr^r3s r&rz%XMLParser._setevents..handlerOs-FE4;#6#6t#<#<=>>>>>r%rcR|||j||fdSrC)rr) pi_targetrrr^r3s r&rz%XMLParser._setevents..handlerSs-FE4;>>)T#B#BCDDDDDr%zunknown event %r)rvr^rrrrrr)rrrrrrrr)r3 events_queueevents_to_reportrr^ event_namers r&rzXMLParser._setevents%s$** B* BJW$$,-)2fCCCC3:00x''4;11..8'+|88888/9....18..y(((26????(/%%t##3=f!%EEEE7>33 !3j!@AAAU* B* Br%cbt|}|j|_|j|jf|_|rC)r codelinenooffsetposition)r3rerrs r& _raiseerrorzXMLParser._raiseerrorZs-:|U\1  r%cn |j|}n%#t$r|}d|vrd|z}||j|<YnwxYw|S)Nrr)rKeyError)r3r}names r&_fixnamezXMLParser._fixname`s` $;s#DD $ $ $Dd{{Tz#DK     $  s 22c@|j|pd|pdSr)rrr3rrs r&rzXMLParser._start_nsks"{##FLb#)<<tdt|dD]}||dz||||< |j||S)NrrKr)rrangerHrr)r3r( attr_listfixnamer1is r&rzXMLParser._startqs-gcll  ?1c)nna00 ? ?09!A#wwy|,,--{  f---r%c\|j||SrC)rrrrs r&rzXMLParser._end}s"{t}}S11222r%c|dd}|dkr |jj}n#t$rYdSwxYw ||j|dddS#t$raddlm}|d||jj |jj fz}d|_ |jj |_ |jj |_ |wxYw|dkr|dd d kr g|_dS|j|d kr d|_dS|}|sdS|j|t#|j}|d kr|jd}|d kr|dkr|j\}}} } | r | dd} n|dkr|dkr|j\}}} d} ndSt%|jdr%|j|| | ddn*t%|drt)jdt,d|_dSdSdS)NrrErcrrz'undefined entity %s: line %d, column %d r z RuntimeWarning) r3rDr data_handlerrrnrhrpubidsystems r&rzXMLParser._defaults}bqb S== #{/ !      T[ad455555   ------kk=4;6K133 ![8 ![:   s]]tBQBx;66DMMM ] &}} $ ::< AAA A) B) A63B5A66B Bcp|j} |jd|jddn,#|j$r}||Yd}~nd}~wwxYw|j|dS#|j|wxYw)NFr%)rGetReparseDeferralEnabledSetReparseDeferralEnabledrrr)r3 was_enabledrs r&rzXMLParser.flushsk;;==  ? K 1 1% 8 8 8 K  c5 ) ) ) ){     Q          K 1 1+ > > > > >DK 1 1+ > > > >s/5AB A:A50B5A::BB5)r r!r"r#r5rrrrrrrrrrrr$r%r&rrs"&+++++Z3B3B3Bj   ===000 . . .3334%4%4%l   ***"?????r%r)out from_filec H||tdd}|tjx}}tt |jfi|}|*|||n|t|||| ndS)a3Convert 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) rrrSrrrrrr rU)xml_datar!r"optionssiors r&rrsI-UVVV C {KMM!c .syDDGDD E E EF H    i'''' _3<<>>>$6r%z ^\w+:\w+$ceZdZdZdddddddddZefdZdZddZd Z d j fd Z d Z d Z ddZdZdZdZdS)ra 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_tagscX||_g|_||_||_|rt |nd|_|rt |nd|_||_|rt ||_nd|_|rt |j |_ nd|_ dgg|_ g|_ |s>|j tt|j gi|_dg|_d|_d|_d|_d|_dS)N)rArFr)_writer_with_comments _strip_textr_exclude_attrs _exclude_tags_rewrite_prefixes_qname_aware_tags intersection_find_qname_aware_attrs_declared_ns_stack _ns_stackr^rrr _prefix_map_preserve_space_pending_start _root_seen _root_done_ignored_depth) r3rr(r)r*r+r,r-r.s r&r5zC14NWriterTarget.__init__sE  +%4AKc-000t2>HS...D!1  *%()9%:%:D " "%)D "  0+./@+A+A+ND ( (+/D ( <$ #  @ N ! !$~';';'='=">"> ? ? ? b!!! %w"r%c#:K||D] }|r|Ed{V dSrCr$)r3ns_stack _reversedrps r&_iter_namespacesz!C14NWriterTarget._iter_namespaces7sJ#)H-- & &J &%%%%%%%% & &r%c|dd\}}||jD]\}}||kr d|d|cStd|d|d)NrrrrzPrefix z of QName "" is not declared in scope)splitrDr:r)r3 prefixed_namerrrps r&_resolve_prefix_namez%C14NWriterTarget._resolve_prefix_name<s$**322 ++DN;; * *FCF{{)C))4)))))_6__m___```r%c|4|dddkr|ddddnd|f\}}n|}t}||jD]4\}}||kr||vr|r|d|n|||fcS||5|jrd||jvr|j|}n!dt|jx}|j|<|jd||f|d|||fS|s d|vr|||fS||j D]=\}}||kr2|jd||f|r|d|n|||fcS>|s|||fStd|d ) Nrrrrrrrcz Namespace "rF) rrrDr9addr5r;rHr^r:r)r3rrr( prefixes_seenurs r&_qnamezC14NWriterTarget._qnameCs$ ;38!93C3CuQRRy''Q///"eHCC ..t/FGG & &IAvCxxF-77,2;&((3(((S#EEEE   f % % % %  ! /d&&&)#.1LS9I5J5J1L1LL)#.  #B ' . .V} = = =$$s$$c3. . !r..S= ..t~>> F FIAvCxx'+22C=AAA,2;&((3(((S#EEEE !S= FsFFFGGGr%cL|js|j|dSdSrC)r@rr^rs r&rzC14NWriterTarget.datahs3" $ J  d # # # # # $ $r%rcd||j}|jdd=|jr!|jds|}|j7|jdc}|_|rt |r|nd}|jg||R|dS|r+|jr&|t|dSdSdSNrc) rr2r<rjr=_looks_like_prefix_namerr>r0_escape_cdata_c14n)r3 _join_textrr qname_texts r&rzC14NWriterTarget._flushlsz$*%% JqqqM   D$8$< ::<D  F C/////r%cj"|r fd|D}|h|}i}|/|x}||<||jh|rf|}|rL|D]H} || } t | r/| x}|| <||Ind}nd}jfdt|dD} |r!d|D} | ng} |rlt|D]J\} }|| |vr||vr| ||d}| | \}} }| |r|n| |fK| d}j |r|dkn j d j }|d | |dz| r(|d d | D|d |*|t| ||dd_j gdS)Nc.i|]\}}|jv||Sr$)r3).0rrr3s r& z+C14NWriterTarget._start..s,TTTdaq@S7S7SQ7S7S7Sr%c(i|]}||Sr$r$)r\r parse_qnames r&r]z+C14NWriterTarget._start..s/444qKKNN444r%c.|ddS)Nrr)rG)rs r&rz)C14NWriterTarget._start..s!''#q//r%rc*g|]\}}|rd|znd|fS)zxmlns:xmlnsr$)r\rrs r& z+C14NWriterTarget._start..s@C'-9F""'3?r%rz+{http://www.w3.org/XML/1998/namespace}spacepreservercrrc@g|]\}}d|dt|dS)rrr)_escape_attrib_c14n)r\rrs r&rcz+C14NWriterTarget._start..s9TTT$!Q=q==$7$:$:===TTTr%rT)r3rrJrLr8rSrOrsortr^r|r<r0rrTr>r:)r3r(rrYrVrresolved_namesrqattrs attr_namer parsed_qnamesrrr attr_qnamerspace_behaviourrr_s` @r&rzC14NWriterTarget._starts6   *u *TTTTekkmmTTTE  !151J1J:1V1V VEN:. JJu     ' 3 311%88F !'**I!),E.u55*8<8Q8QRW8X8XXu 5 5))) * Fk 4444F 11535353444   #1I NN    I  Hu{{}}-- H H1%!v++!~:M:M%nQ&78;A-:1-=* Is  "B**A!FGGGG ))$QRR ##-< *Oz ) )%b) + + +   cM#&q))***  W E"''TT)TTTUU V V V c   ! E$]>*3M%Nq%QRR S S S b!!!!!r%c|jr|xjdzc_dS|jr||d||dd|jt|jdk|_|j |j dS)Nrrrr) r@rrr0rOr<rrHr?r9r:rs r&rzC14NWriterTarget.ends      1 $   F :  KKMMM /S))!,///000   """d233q8 ##%%% r%c0|jsdS|jrdS|jr|dn"|jr|jr||dt|d|js|ddSdS)Nrz)r1r@r?r0r>rrrTrs r&rzC14NWriterTarget.comments"  F    F ?  KK     _   KKMMM 8-d33888999  KK       r%c4|jrdS|jr|dn"|jr|jr|||rd|dt |dnd|d|js|ddSdS)Nrz)r@r?r0r>rrrT)r3rrs r&rzC14NWriterTarget.pis    F ?  KK     _   KKMMM :> S 6 6 6,T22 6 6 6 6OOOO U U U  KK       r%rC)r r!r"r#r5reversedrDrJrOrrrrrrrrrr$r%r&rrs, %"&$#$# # # # # J4<&&&& aaa#H#H#H#HJ$$$!# 2 2 2 2111000"C"C"C"C"J           r%rc& d|vr|dd}d|vr|dd}d|vr|dd}d|vr|dd}|S#ttf$rt|YdSwxYw) NrErFrrGrrHrN rIrs r&rTrTs) $;;<<W--D $;;<<V,,D $;;<<V,,D 4<<<<g..D ~ &)))"4(((((()sA)A,, BBc d|vr|dd}d|vr|dd}d|vr|dd}d|vr|dd}d |vr|d d }d |vr|d d }|S#ttf$rt|YdSwxYw) NrErFrrGrrMrOz rz rNrsrIrs r&rfrfs) $;;<<W--D $;;<<V,,D $;;<<X..D 4<<<<g..D 4<<<<g..D 4<<<<g..D ~ &)))"4(((((()sBB CC)r)_set_factoriesrCr)rfr)@r#__all__rrdr:r=rrcollections.abcrrrrrr r rrrrr rrcontextmanagerrrrr4r2rrrrrrrr3rrrXrrrr r rrrrrrrrcompileUNICODEr;rSrrTrfrg _elementtreerurr$r%r&r|s'!!P   (             ### jjjjjjjjZ $&$     +"+"+"+"+"+"+"+"`_/_/_/_/_/_/_/_/H /+/+/+b;;;;z0(0(0(d 0(0(0(d    !!!*-2$*38(.(,16(,  %3!   ))) )))8 ) ) )!T"&0b'" !%&*     &////l    5555p77777777t",     $vvvvvvvvth?h?h?h?h?h?h?h?Z7tt77777<%"*\2:>>DD)))&))). 3K++++++N7122222   DD s E77F?F__pycache__/ElementTree.cpython-311.opt-2.pyc000064400000213435152531452610014643 0ustar00 f" gdZdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z Gdde Z dZGd d Zifd ZdCd ZdCd ZeZGddZGddZejdZdCdZdZhdZdZdZeeedZdZddddddd d!Zee_d"Z d#Z!d$Z"d%Z#dDddd&d'd(Z$Gd)d*ej%Z&dDddd&d'd+Z'd,Z(dEd.Z)dCd/Z*dDd0Z+Gd1d2Z,dCd3Z-dCd4Z.e-Z/dCd5Z0Gd6d7Z1Gd8d9Z2dCddd:d;Z3ej4dZ8d?Z9d@Z: eZ;ddAl$rYdSwxYw)F)CommentdumpElement ElementTree fromstringfromstringlistindent iselement iterparseparse ParseErrorPIProcessingInstructionQName SubElementtostring tostringlist TreeBuilderVERSIONXMLXMLID XMLParser XMLPullParserregister_namespace canonicalizeC14NWriterTargetz1.3.0N) ElementPathceZdZ dS)r N)__name__ __module__ __qualname__)r/r r'idr2s r%__repr__zElement.__repr__s!4>#:DHbhh"OOOr$c0 |||SN)r/)r2r'r0s r% makeelementzElement.makeelements ~~c6***r$c` tjdt|S)Nz7elem.copy() is deprecated. Use copy.copy(elem) instead.)warningswarnDeprecationWarning__copy__r7s r%copyz Element.copys3  E    }}r$c||j|j}|j|_|j|_||dd<|Sr:)r;r'r0texttail)r2elems r%r@zElement.__copy__s?$+66I I QQQ r$c*t|jSr:)lenr1r7s r%__len__zElement.__len__s4>"""r$cjtjdtdt|jdkS)NzyThe behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. stacklevelr)r=r> FutureWarningrGr1r7s r%__bool__zElement.__bool__s=  K a     4>""a''r$c|j|Sr:r1r2indexs r% __getitem__zElement.__getitem__s~e$$r$ct|tr|D]}||n||||j|<dSr:)r,slice_assert_is_elementr1)r2rRr)elts r% __setitem__zElement.__setitem__sg eU # # - - -'',,,, -  # #G , , , 'ur$c|j|=dSr:rPrQs r% __delitem__zElement.__delitem__s N5 ! ! !r$cf |||j|dSr:rVr1appendr2 subelements r%r]zElement.appends9   +++ j)))))r$cp |D]1}|||j|2dSr:r\)r2elementsr)s r%extendzElement.extendsO   + +G  # #G , , , N ! !' * * * * + +r$ch |||j||dSr:)rVr1insert)r2rRr_s r%rdzElement.inserts76  +++ eZ00000r$cxt|ts$tdt|jzdS)Nzexpected an Element, not %s)r, _Element_Pyr.typer )r2es r%rVzElement._assert_is_elements@![)) N9DGG tt}||_|Sr:)rrrC)rCr)s r%rrs"gGGL Nr$cf tt}||_|r|jdz|z|_|S)N )rrrC)targetrCr)s r%rrs>+,,GGL 1|c)D0 Nr$cHeZdZ d dZdZdZdZdZdZdZ d Z d Z dS) rNc(|rd|d|}||_dS)N{}rC)r2 text_or_urir's r%r4zQName.__init__s*  8 8&1kk337K r$c|jSr:rr7s r%__str__z QName.__str__s yr$c2d|jjd|jdS)N)r/r rCr7s r%r8zQName.__repr__s  N333TYYY??r$c*t|jSr:)hashrCr7s r%__hash__zQName.__hash__sDIr$cbt|tr|j|jkS|j|kSr:r,rrCr2others r%__le__z QName.__le__0 eU # # +9 * *yE!!r$cbt|tr|j|jkS|j|kSr:rrs r%__lt__z QName.__lt__0 eU # # *9uz) )y5  r$cbt|tr|j|jkS|j|kSr:rrs r%__ge__z QName.__ge__rr$cbt|tr|j|jkS|j|kSr:rrs r%__gt__z QName.__gt__rr$cbt|tr|j|jkS|j|kSr:rrs r%__eq__z QName.__eq__rr$r:) r r!r"r4rr8rrrrrrr#r$r%rrs     @@@"""!!!"""!!!"""""r$rcpeZdZ ddZdZdZddZddZddZddZ dd Z dd Z dd d d Z dZ dS)rNcF||_|r||dSdSr:)_rootr )r2r)files r%r4zElementTree.__init__s3   JJt       r$c |jSr:rr7s r%getrootzElementTree.getroots /zr$c ||_dSr:r)r2r)s r%_setrootzElementTree._setroot#s  r$c d}t|dst|d}d} |Vt}t|dr8|||_|j|r|SS |d}|sn||.||_|j|r|SS#|r|wwxYw)NFreadrbT _parse_wholei)r(openrrrcloserfeed)r2sourceparser close_sourcedatas r%r zElementTree.parse-s  vv&& &$''FL ~"6>22& "(!4!4V!c8 |j|Sr:)rrr2r's r%rzElementTree.iterRs zs###r$c |dddkr$d|z}tjd|ztd|j||SNr/.zThis 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 %rrJrK)r=r>rMrrlrms r%rlzElementTree.find^sh  8s??:D M-/34!      ztZ000r$c |dddkr$d|z}tjd|ztd|j|||Sr)r=r>rMrrqrrs r%rqzElementTree.findtexttsl  8s??:D M-/34!      z""4*===r$c |dddkr$d|z}tjd|ztd|j||Sr)r=r>rMrrurms r%ruzElementTree.findallsj  8s??:D M-/34!      z!!$ 333r$c |dddkr$d|z}tjd|ztd|j||Sr)r=r>rMrrwrms r%rwzElementTree.iterfindsj  8s??:D M-/34!      z""4444r$Tshort_empty_elementsc |sd}n|tvrtd|z|s |dkrd}nd}t||5\}}|dkrA|s0|=|dkr%|dvr|d|d |d krt ||jn:t |j|\} } t|} | ||j| | | ddddS#1swxYwYdS) Nxmlzunknown method %rc14nutf-8us-asciiunicode)rrz rCr) _serialize ValueError _get_writerlower_serialize_textr _namespaces) r2file_or_filenameencodingxml_declarationdefault_namespacemethodrwritedeclared_encodingqnamesro serializes r%rzElementTree.writes  . ;FF : % %069:: : &"% )8 4 4 E8R@QO$,^^%%22&,,..6KKK%%%()))tz2222%0=N%O%O" &v.  %VZ/CEEEE E E E E E E E E E E E E E E E E E EsB!C--C14C1c0||dS)Nr)r)r)r2rs r% write_c14nzElementTree.write_c14nszz$vz...r$rr:)NNNN)r r!r"r4rrr rrlrqrurwrrr#r$r%rrs   ####J $ $ $ $1111,>>>>,4444,5555." $ 3E $( 3E3E3E3E3Ej/////r$rc#xK |j}|dkr|t|ddpdfVdStj5}t |t jr|}nt |t jr/t j |}| |j nLt j}d|_ ||_ |j |_ |j|_n#t$rYnwxYwt j||dd}| |j |j|fVddddS#1swxYwYdS#t$rV|dkrd}t#|d|d 5}|j|fVdddYdS#1swxYwYYdSwxYw) NrrrcdSNTr#r#r$r%z_get_writer..sDr$xmlcharrefreplace )rerrorsnewlinew)rr)rrgetattr contextlib ExitStackr,ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletellAttributeError TextIOWrapperr)rrrstackrs r%rrs-+ & >>  y ( (!1:tDDOO O O O O O%'' +5.0ABB+DD 0",??,-=>>DNN4;////,..D$0LDM!&DJ)9(A $4$9 )'19/B04666 t{+++j(****9 + + + + + + + + + + + + + + + + + + ''' >>  y ( (H "C(,... '15*h& & & & ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'smEB E C21E 2 C?<E >C??AE  EE7F9 F* F9*F. .F91F. 2F98F9cddiird<fd}|D])}|j}t|tr|jvr||jnHt|t r|vr ||n#|!|t ur|turt|| D]^\}}t|tr|j}|vr ||t|tr|jvr||j_|j}t|tr|jvr||j+fS)Nc |dddkr|dddd\}}|}|9t|}|dtz}|dkr||<|r |d||<dS||<dSrt d||<dS#t $rt |YdSwxYw)Nrrrzns%dr:z.add_qname/s .RaRyC 9++C33S#,,>+//44F~!'#j//!9*0 3(/5vvss$;F5MMM$'F5MMM$$3!&u  . . . &u - - - - - - .sB B/B/B//C  C ) rr'r,rrCrrr rr) rErrr'r|r~rCrors ` @@r%rr$sD\FJ+(* $%.......8 !!h c5 ! ! ,xv%% #(### S ! ! ,&   # _G!3!32 &s + + +**,, & &JC#u%% h&   #%'' &EJf,D,D %*%%%y dE " " !ty'>'> Idi : r$c |j}|j}|tur|d|zn|tur|d|zn||}|5|r|t ||D]}t |||d|na|d|zt |} | s|r|rPt|dD]+\} } | rd| z} |d| d t| d ,| D]k\} } t| tr| j} t| tr|| j} nt| } |d || d | d l|st|s|sP|d |r|t ||D]}t |||d||d |zd zn |d|j r|t |j dSdS)N rrc|dSNrr#xs r%rz _serialize_xml..w QqTr$r|r xmlns=""rr)r'rCrr _escape_cdata_serialize_xmllistrsorted_escape_attribr,rrGrD) rrErrorkwargsr'rCrhrvks r%rras (C 9D g~~ kD !!!! % % % hoSk ; +mD))*** J Jua4HJJJJJ J E#)   &&E 9  9 &z'7'7'9'9+9>!;!;!;1( #aAAA*1----"99DAq!!U++#F!!U++."16N*1--EE&)))QQQ78888 s4yy (< c /E---...NNA"5!VT8LNNNNNdSj3&''''e  y( mDI&&'''''((r$>brhrcolimgwbrareabaselinkmetaembedframeinputparamtrackrisindexbasefontc j|j}|j}|tur|dt|zn|tur|dt|zn||}|3|r|t||D]}t |||dnu|d|zt |}|s|r|rPt|dD]+\} } | rd| z} |d| dt| d ,|D]k\} } t| tr| j} t| tr|| j} nt| } |d || d| d l|d | } |r0| d ks| d kr ||n|t||D]}t |||d| tvr|d|zd z|jr|t|jdSdS)Nr r rc|dSr r#r s r%rz!_serialize_html..rr$rrrrrrrscriptstyler)r'rCrrr_serialize_htmlrrrrr,r_escape_attrib_htmlr HTML_EMPTYrD) rrErrorr'rCrhrrrltags r%r1r1s (C 9D g~~ kM$///0000 % % % ht,,,----Sk ; +mD))*** 8 8q&$7777 8 E#)   &&E 9  9 &z'7'7'9'9+9>!;!;!;1( #aAAA*1----"99DAq!!U++#F!!U++3"16N/22EE&)))QQQ78888 E#JJJ99;;D /8##twE$KKKKE---... 8 8q&$7777:%%dSj3&''' y( mDI&&'''''((r$c||D] }|||jr||jdSdSr:)rrD)rrEparts r%rrsT  d  y dir$)rhtmlrCc tjd|rtdttD]\}}||ks||krt|=|t|<dS)Nzns\d+$z'Prefix format reserved for internal use)rematchrrrr)rrrrs r%rrs~  x 6""DBCCC^))++,,""1 88qF{{q! N3r$rr7rdfwsdlxsxsidc)$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/cRtd|dt|jd)Nzcannot serialize z (type ))r.rgr rs r%rrs1 )+/44d1D1D1DE   r$c d|vr|dd}d|vr|dd}d|vr|dd}|S#ttf$rt|YdSwxYw)N&&r<r>replacer.rrrs r%rrs ) $;;<<W--D $;;<<V,,D $;;<<V,,D ~ &)))"4(((((()AA A65A6c d|vr|dd}d|vr|dd}d|vr|dd}d|vr|dd}d |vr|d d }d |vr|d d }d |vr|d d}|S#ttf$rt|YdSwxYw)NrDrErrFrrGr" z rz  z rHrs r%rrs ) $;;<<W--D $;;<<V,,D $;;<<V,,D 4<<<<h//D 4<<<<g..D 4<<<<g..D 4<<<<g..D ~ &)))"4(((((()sB7B:: CCc d|vr|dd}d|vr|dd}d|vr|dd}|S#ttf$rt|YdSwxYw)NrDrErrGrrLrHrs r%r2r2+s ) $;;<<W--D $;;<<V,,D 4<<<<h//D ~ &)))"4(((((()rJT)rrrc |dkrtjntj}t||||||||S)Nrrrrr)rStringIOBytesIOrrgetvalue)r)rrrrrstreams r%rr:sr ')33R[]]]Fvx/>1B&,4H JJJ ??  r$c.eZdZ dZdZdZdZdZdS)_ListDataStreamc||_dSr:)lst)r2rYs r%r4z_ListDataStream.__init__Ts r$cdSrr#r7s r%rz_ListDataStream.writableWtr$cdSrr#r7s r%rz_ListDataStream.seekableZr[r$c:|j|dSr:)rYr])r2bs r%rz_ListDataStream.write]s r$c*t|jSr:)rGrYr7s r%rz_ListDataStream.tell`s48}}r$N)r r!r"r4rrrrr#r$r%rWrWRsbAr$rWcxg}t|}t||||||||S)NrQ)rWrr)r)rrrrrrYrUs r%rrcsU C S ! !Fvx/>1B&,4H JJJ Jr$c" t|tst|}|tjd|j}|r |ddkr!tjddSdS)Nr)rr)r,rrsysstdoutrrD)rErDs r%rrps dK ( (!4  JJszIJ... <<>> D 48t## $#r$ c t|tr|}|dkrtd|t |sdSd|zzgfd|ddS)Nrz,Initial indentation level must be >= 0, got rc|dz} |}n0#t$r#|z}|YnwxYw|jr|js||_|D]D}t |r |||jr|js||_E|js||_dSdSr ) IndexErrorr]rCstriprGrD)rElevel child_levelchild_indentationchild_indent_children indentationsspaces r%rnz indent.._indent_childrensai  3 ,[ 9   3 3 3 ,U 3e ;     1 2 2 2 2 2 3y *  1 1 *)DI / /E5zz 5   444: /UZ%5%5%7%7 /. z!! -%e,EJJJ - -s *>>)r,rrrrG)treerprjrnros ` @@r%rrs $ $$||~~ qyyOOOPPP t9955=()L-------,T1r$cP t}||||Sr:)rr )rrrqs r%r r s+ ==DJJvv Kr$c t||tdstddndfdGfddtjj}|}d|_tj||S) N)events_parserrrTFc3K Ed{V|d}|sn|H}Ed{V}|||_r|dSdS#r|wwxYw)NTi@) read_eventsrr_close_and_return_rootrootr)rrryitr pullparserwrs r%iteratorziterparse..iterators  &%11333333333{{9--%%%  &4466D!--// / / / / / / /B~    |   s B B))Cc<eZdZjZfdZdS)$iterparse..IterParseIteratorc8rdSdSr:)r)r2rrs r%__del__z,iterparse..IterParseIterator.__del__s&    r$N)r r!r"__next__r)rr}rsr%IterParseIteratorrsE8F##,        r$r) rr(r collectionsabcIteratorryweakrefref) rrtrrrzrr}r{r|s ` @@@@r%r r s  ff===J 66 " "fd##  $KO4    BBG RB Ir$c:eZdZd dddZdZdZdZdZdZdS) rN)ructj|_|ptt |_|d}|j|j|dS)Nr)end)rdeque _events_queuerrru _setevents)r2rtrus r%r4zXMLPullParser.__init__s[ ).00A);=="A"A"A >F  2F;;;;;r$c |jtd|rO |j|dS#t$r%}|j|Yd}~dSd}~wwxYwdS)Nz!feed() called after end of stream)rurr SyntaxErrorrr])r2rexcs r%rzXMLPullParser.feed s* < @AA A  / / !!$''''' / / /"))#......... / / /s7 A&A!!A&cF|j}d|_|Sr:)rur)r2rys r%rxz$XMLPullParser._close_and_return_roots!|!!##  r$c0 |dSr:)rxr7s r%rzXMLPullParser.closes! ##%%%%%r$c#K |j}|r3|}t|tr||V|1dSdSr:)rpopleftr, Exception)r2rtevents r%rwzXMLPullParser.read_events%sj # NN$$E%++        r$cd|jtd|jdS)Nz"flush() called after end of stream)rurflushr7s r%rzXMLPullParser.flush3s3 < ABB B r$r:) r r!r"r4rrxrrwrr#r$r%rrs >r$c |stt}|||}i}|D]}|d}|r|||<||fS)Nrr6)rrrrrr{)rCrrqidsrEr6s r%rrJs 1+--000 KK <<>>D C  XXd^^  CG 9r$c |stt}|D]}|||Srr)sequencerrCs r%rrbsW 1+--000 D <<>>r$cVeZdZ d ddddddZdZdZdZdZd Zd Z d d Z d Z dS)rNF)comment_factory pi_factoryinsert_comments insert_piscg|_g|_d|_d|_d|_|t }||_||_|t}||_ ||_ |t}||_ dSr:) _data_elem_lastr_tailr_comment_factoryrr _pi_factoryrr_factory)r2element_factoryrrrrs r%r4zTreeBuilder.__init__sr      "%O /.  .J%$  "%O' r$c |jSr:rr7s r%rzTreeBuilder.closesIzr$c|jrJ|j:d|j}|jr ||j_n ||j_g|_dSdSNr)rrjoinrrDrCr2rCs r%_flushzTreeBuilder._flushs\ : z%wwtz**:+&*DJOO'+DJODJJJ  r$c< |j|dSr:)rr]r2rs r%rzTreeBuilder.datas!* $r$c ||||x|_}|jr!|jd|n|j||_|j|d|_|S)Nrbr)rrrrr]rr)r2r'attrsrEs r%startzTreeBuilder.starts  MM#u555 T :  JrN ! !$ ' ' ' ' Z DJ $  r$c ||j|_d|_|jSr )rrpoprrrs r%rzTreeBuilder.ends: Z^^%%  zr$cF ||j|j|Sr:)_handle_singlerrrs r%commentzTreeBuilder.comments. ""  !4#7?? ?r$cH ||j|j||Sr:)rrr)r2rrCs r%pizTreeBuilder.pis/ ""  dovt== =r$c||}|rI|||_|jr |jd|d|_|S)Nrbr)rrrr]r)r2factoryrdargsrEs r%rzTreeBuilder._handle_singlesYw~   KKMMMDJz , 2%%d+++DJ r$r:) r r!r"r4rrrrrrrrr#r$r%rrts&(!%$!&5((((((      "   ???====r$rc`eZdZ ddddZdZdZdZdZdZd Z d Z d Z d Z d Z dZdS)rN)rrc@ ddlm}n3#t$r& ddl}n#t$rtdwxYwYnwxYw||d}|t }|x|_|_|x|_|_ |j |_ i|_ |j |_t|dr |j|_t|dr |j|_t|dr |j|_t|dr |j|_t|d r |j|_t|d r |j|_t|d r |j|_d |_d |_d|_ i|_! d |j"z|_#dS#tH$rYdSwxYw)Nrexpatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrstart_nsend_nsrrrrzExpat %d.%d.%d)% xml.parsersr ImportErrorpyexpat ParserCreaterrrur_targeterror_error_names_defaultDefaultHandlerExpandr(_startStartElementHandler_endEndElementHandler _start_nsStartNamespaceDeclHandler_end_nsEndNamespaceDeclHandlerrCharacterDataHandlerrCommentHandlerrProcessingInstructionHandler buffer_textordered_attributes_doctypeentity version_infoversionr)r2rrrrs r%r4zXMLParser.__init__s  ) ) ) ) ) ) )    '''''   !M (' ##Hc22 > ]]F%++ dl%++ dlk  &*m# 67 # # 5)-F & 65 ! ! 1'+yF $ 6: & & >/3~F , 68 $ $ :-1\F * 66 " " 6*0+F ' 69 % % 3$*NF ! 64  <28)F /$%!   +e.@@DLLL    DD s. 99399>F FFc|j}|j}|D]}|dkrd|_|||jfd}||_#|dkr|||jfd}||_=|dkr0t|jdr |||j fd}n||fd }||_ s|d kr0t|jd r |||j fd }n||fd }||_ |dkr|||fd}||_ |dkr|||fd}||_td|zdS)Nrrc4|||||fdSr:r#)r' attrib_inrr]rs r%handlerz%XMLParser._setevents..handler1s)FE55i#8#89:::::r$rc2||||fdSr:r#)r'rr]rs r%rz%XMLParser._setevents..handler6s%FE33s88,-----r$zstart-nsrc4|||||fdSr:r#)rrrr]rs r%rz%XMLParser._setevents..handler=s)xx'<'<=>>>>>r$c,|||pd|pdffdSrr#)rrrr]s r%rz%XMLParser._setevents..handlerAs* "ciR'@ABBBBBr$zend-nsrc2||||fdSr:r#)rrr]rs r%rz%XMLParser._setevents..handlerGs%vvf~~677777r$c ||dfdSr:r#)rrr]s r%rz%XMLParser._setevents..handlerKst}-----r$rcP|||j|fdSr:)rr)rCrr]r2s r%rz%XMLParser._setevents..handlerOs-FE4;#6#6t#<#<=>>>>>r$rcR|||j||fdSr:)rr) pi_targetrrr]r2s r%rz%XMLParser._setevents..handlerSs-FE4;>>)T#B#BCDDDDDr$zunknown event %r)rur]rrrrrr(rrrrrrrr)r2 events_queueevents_to_reportrr] event_namers r%rzXMLParser._setevents%s$** B* BJW$$,-)2fCCCC3:00x''4;11..8'+|88888/9....18..y(((26????(/%%t##3=f!%EEEE7>33 !3j!@AAAU* B* Br$cbt|}|j|_|j|jf|_|r:)r codelinenooffsetposition)r2r~errs r% _raiseerrorzXMLParser._raiseerrorZs-:|U\1  r$cn |j|}n%#t$r|}d|vrd|z}||j|<YnwxYw|S)Nrr)rKeyError)r2r|names r%_fixnamezXMLParser._fixname`s` $;s#DD $ $ $Dd{{Tz#DK     $  s 22c@|j|pd|pdSr)rrr2rrs r%rzXMLParser._start_nsks"{##FLb#)<<tdt|dD]}||dz||||< |j||S)NrrJr)rrangerGrr)r2r' attr_listfixnamer0is r%rzXMLParser._startqs-gcll  ?1c)nna00 ? ?09!A#wwy|,,--{  f---r$c\|j||Sr:)rrrrs r%rzXMLParser._end}s"{t}}S11222r$c|dd}|dkr |jj}n#t$rYdSwxYw ||j|dddS#t$raddlm}|d||jj |jj fz}d|_ |jj |_ |jj |_ |wxYw|dkr|dd d kr g|_dS|j|d kr d|_dS|}|sdS|j|t#|j}|d kr|jd}|d kr|dkr|j\}}} } | r | dd} n|dkr|dkr|j\}}} d} ndSt%|jdr%|j|| | ddn*t%|drt)jdt,d|_dSdSdS)NrrDrbrrz'undefined entity %s: line %d, column %d r z RuntimeWarning) r2rCr data_handlerrrnrgrpubidsystems r%rzXMLParser._defaults}bqb S== #{/ !      T[ad455555   ------kk=4;6K133 ![8 ![:   s]]tBQBx;66DMMM ] &}} $ ::< AAA A* B* A74B6A77B Bcp|j} |jd|jddn,#|j$r}||Yd}~nd}~wwxYw|j|dS#|j|wxYw)NFr$)rGetReparseDeferralEnabledSetReparseDeferralEnabledrrr)r2 was_enabledrs r%rzXMLParser.flushsk;;==  ? K 1 1% 8 8 8 K  c5 ) ) ) ){     Q          K 1 1+ > > > > >DK 1 1+ > > > >s/5AB A:A50B5A::BB5)r r!r"r4rrrrrrrrrrrr#r$r%rrs"&+++++Z3B3B3Bj   ===000 . . .3334%4%4%l   ***"?????r$r)out from_filec J ||tdd}|tjx}}tt |jfi|}|*|||n|t|||| ndS)Nz:Either 'xml_data' or 'from_file' must be provided as inputr)r) rrrRrrrrrr rT)xml_datar r!optionssiors r%rrs I-UVVV C {KMM!c .syDDGDD E E EF H    i'''' _3<<>>>$6r$z ^\w+:\w+$ceZdZ dddddddddZefdZdZddZdZd j fd Z d Z d Z dd Z dZdZdZdS)rFN) with_comments strip_textrewrite_prefixesqname_aware_tagsqname_aware_attrs exclude_attrs exclude_tagscX||_g|_||_||_|rt |nd|_|rt |nd|_||_|rt ||_nd|_|rt |j |_ nd|_ dgg|_ g|_ |s>|j tt|j gi|_dg|_d|_d|_d|_d|_dS)N)r@rFr)_writer_with_comments _strip_textr_exclude_attrs _exclude_tags_rewrite_prefixes_qname_aware_tags intersection_find_qname_aware_attrs_declared_ns_stack _ns_stackr]rrr _prefix_map_preserve_space_pending_start _root_seen _root_done_ignored_depth) r2rr'r(r)r*r+r,r-s r%r4zC14NWriterTarget.__init__sE  +%4AKc-000t2>HS...D!1  *%()9%:%:D " "%)D "  0+./@+A+A+ND ( (+/D ( <$ #  @ N ! !$~';';'='=">"> ? ? ? b!!! %w"r$c#:K||D] }|r|Ed{V dSr:r#)r2ns_stack _reversedros r%_iter_namespacesz!C14NWriterTarget._iter_namespaces7sJ#)H-- & &J &%%%%%%%% & &r$c|dd\}}||jD]\}}||kr d|d|cStd|d|d)NrrrrzPrefix z of QName "" is not declared in scope)splitrCr9r)r2 prefixed_namerrrps r%_resolve_prefix_namez%C14NWriterTarget._resolve_prefix_name<s$**322 ++DN;; * *FCF{{)C))4)))))_6__m___```r$c|4|dddkr|ddddnd|f\}}n|}t}||jD]4\}}||kr||vr|r|d|n|||fcS||5|jrd||jvr|j|}n!dt|jx}|j|<|jd||f|d|||fS|s d|vr|||fS||j D]=\}}||kr2|jd||f|r|d|n|||fcS>|s|||fStd|d ) Nrrrrrrrbz Namespace "rE) rrrCr8addr4r:rGr]r9r)r2rrr' prefixes_seenurs r%_qnamezC14NWriterTarget._qnameCs$ ;38!93C3CuQRRy''Q///"eHCC ..t/FGG & &IAvCxxF-77,2;&((3(((S#EEEE   f % % % %  ! /d&&&)#.1LS9I5J5J1L1LL)#.  #B ' . .V} = = =$$s$$c3. . !r..S= ..t~>> F FIAvCxx'+22C=AAA,2;&((3(((S#EEEE !S= FsFFFGGGr$cL|js|j|dSdSr:)r?rr]rs r%rzC14NWriterTarget.datahs3" $ J  d # # # # # $ $r$rcd||j}|jdd=|jr!|jds|}|j7|jdc}|_|rt |r|nd}|jg||R|dS|r+|jr&|t|dSdSdSNrb) rr1r;rir<_looks_like_prefix_namerr=r/_escape_cdata_c14n)r2 _join_textrr qname_texts r%rzC14NWriterTarget._flushlsz$*%% JqqqM   D$8$< ::<D  F C/////r$cj"|r fd|D}|h|}i}|/|x}||<||jh|rf|}|rL|D]H} || } t | r/| x}|| <||Ind}nd}jfdt|dD} |r!d|D} | ng} |rlt|D]J\} }|| |vr||vr| ||d}| | \}} }| |r|n| |fK| d}j |r|dkn j d j }|d | |dz| r(|d d | D|d |*|t| ||dd_j gdS)Nc.i|]\}}|jv||Sr#)r2).0rrr2s r% z+C14NWriterTarget._start..s,TTTdaq@S7S7SQ7S7S7Sr$c(i|]}||Sr#r#)r[r parse_qnames r%r\z+C14NWriterTarget._start..s/444qKKNN444r$c.|ddS)Nrr)rF)rs r%rz)C14NWriterTarget._start..s!''#q//r$rc*g|]\}}|rd|znd|fS)zxmlns:xmlnsr#)r[rrs r% z+C14NWriterTarget._start..s@C'-9F""'3?r$rz+{http://www.w3.org/XML/1998/namespace}spacepreserverbrrc@g|]\}}d|dt|dS)rrr)_escape_attrib_c14n)r[rrs r%rbz+C14NWriterTarget._start..s9TTT$!Q=q==$7$:$:===TTTr$rT)r2rrIrKr7rRrNrsortr]r{r;r/rrSr=r9)r2r'rrXrUrresolved_namesrqattrs attr_namer~ parsed_qnamesrrr attr_qnamerspace_behaviourrr^s` @r%rzC14NWriterTarget._starts6   *u *TTTTekkmmTTTE  !151J1J:1V1V VEN:. JJu     ' 3 311%88F !'**I!),E.u55*8<8Q8QRW8X8XXu 5 5))) * Fk 4444F 11535353444   #1I NN    I  Hu{{}}-- H H1%!v++!~:M:M%nQ&78;A-:1-=* Is  "B**A!FGGGG ))$QRR ##-< *Oz ) )%b) + + +   cM#&q))***  W E"''TT)TTTUU V V V c   ! E$]>*3M%Nq%QRR S S S b!!!!!r$c|jr|xjdzc_dS|jr||d||dd|jt|jdk|_|j |j dS)Nrrrr) r?rrr/rNr;rrGr>r8r9rs r%rzC14NWriterTarget.ends      1 $   F :  KKMMM /S))!,///000   """d233q8 ##%%% r$c0|jsdS|jrdS|jr|dn"|jr|jr||dt|d|js|ddSdS)Nrz)r0r?r>r/r=rrrSrs r%rzC14NWriterTarget.comments"  F    F ?  KK     _   KKMMM 8-d33888999  KK       r$c4|jrdS|jr|dn"|jr|jr|||rd|dt |dnd|d|js|ddSdS)Nrz)r?r>r/r=rrrS)r2rrs r%rzC14NWriterTarget.pis    F ?  KK     _   KKMMM :> S 6 6 6,T22 6 6 6 6OOOO U U U  KK       r$r:)r r!r"r4reversedrCrIrNrrrrrrrrrr#r$r%rrs, %"&$#$# # # # # J4<&&&& aaa#H#H#H#HJ$$$!# 2 2 2 2111000"C"C"C"C"J           r$rc& d|vr|dd}d|vr|dd}d|vr|dd}d|vr|dd}|S#ttf$rt|YdSwxYw) NrDrErrFrrGrM rHrs r%rSrSs) $;;<<W--D $;;<<V,,D $;;<<V,,D 4<<<<g..D ~ &)))"4(((((()sA)A,, BBc d|vr|dd}d|vr|dd}d|vr|dd}d|vr|dd}d |vr|d d }d |vr|d d }|S#ttf$rt|YdSwxYw) NrDrErrFrrLrNz rz rMrrrHrs r%reres) $;;<<W--D $;;<<V,,D $;;<<X..D 4<<<<g..D 4<<<<g..D 4<<<<g..D ~ &)))"4(((((()sBB CC)r)_set_factoriesr:r)rer)?__all__rrcr9r=rrcollections.abcrrrrrr r rrrrr rrcontextmanagerrrrr3r1rrrrrrrr2rrrWrrrr r rrrrrrrrcompileUNICODEr:rRrrSrerf _elementtreertrr#r$r%r{s"!P   (             ### jjjjjjjjZ $&$     +"+"+"+"+"+"+"+"`_/_/_/_/_/_/_/_/H /+/+/+b;;;;z0(0(0(d 0(0(0(d    !!!*-2$*38(.(,16(,  %3!   ))) )))8 ) ) )!T"&0b'" !%&*     &////l    5555p77777777t",     $vvvvvvvvth?h?h?h?h?h?h?h?Z7tt77777<%"*\2:>>DD)))&))). 3K++++++N7122222   DD s E66E?>E?__pycache__/ElementInclude.cpython-311.pyc000064400000011034152531452610014356 0ustar00 fddlZddlmZddlmZdZedzZedzZdZGd d e Z Gd d e Z dd Z ddefdZ dZdS)N) ElementTree)urljoinz!{http://www.w3.org/2001/XInclude}includefallbackceZdZdS)FatalIncludeErrorN__name__ __module__ __qualname__?/opt/alt/python311/lib64/python3.11/xml/etree/ElementInclude.pyr r CDrr ceZdZdS)LimitedRecursiveIncludeErrorNr rrrrrGrrrc4|dkrOt|d5}tj|}dddn #1swxYwYnB|sd}t|d|5}|}dddn #1swxYwY|S)NxmlrbzUTF-8r)encoding)openrparsegetrootread)hrefrrfiledatas rdefault_loaderr!Ws ~~ $   5$T**2244D 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 H $h / / / 499;;D                Ks#'A  AA,B  BBc|d}n|dkrtd|zt|dr|}|t}t ||||t dS)Nrz;expected non-negative depth or None for 'max_depth', got %rr) ValueErrorhasattrrr!_includeset)elemloaderbase_url max_depths rrrtsv QVYbbccctY||~~ ~ T68Y66666rcNd}|t|kr||}|jtkr|d}|rt ||}|dd}|dkr||vrt d|z|dkrt d|z|||||} | t d|d|tj| } t| |||d z || ||j r| j pd |j z| _ | ||<n|d kr}||||d } | t d|d||j r | |j z } |r||d z } | j pd | z| _ n|j pd | z|_ ||=t d |z|jtkrt d|jzt||||||d z }|t|k dSdS)Nrrrrzrecursive include of %sz5maximum xinclude depth reached when including file %sz cannot load z as rtextrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))lentagXINCLUDE_INCLUDEgetrr raddcopyr&removetailr.XINCLUDE_FALLBACK) r(r)r*r+ _parent_hrefsierrnoder.s rr&r&s A c$ii-- G 5$ $ $55==D /x..EE'5))E~~=((+,E,LMMM>>6ORVVXXX!!$'''vdE**<++26$$>yvtY]MJJJ$$T***6;!%bAF :DIQ&vdE155+<+<==<++26$$>6#AFND9!9D!%bD 8DII!%bD 8DIG'?%GU' ' '#BQUJ  Q)] C C C Qg c$ii------r)N)r4r-r urllib.parserXINCLUDEr1r7DEFAULT_MAX_INCLUSION_DEPTH SyntaxErrorr rr!rr&rrrr@sf  .i'z)               #4      :1 7 7 7 766666r__pycache__/ElementPath.cpython-311.opt-2.pyc000064400000041537152531452610014642 0ustar00 f6ddlZejdZddZdZdZdZdZdZd Z d Z d Z d Z eee e e e d Z iZGddZddZddZddZddZdS)Nz`('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|!=|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@!=\s]+)|\s+c#K|r|dnd}d}t|D]}|\}}|r|ddkrsd|vrW|dd\}} |st|d||d|fVn6#t$rt d|zdwxYw|r|s |d|d|fVn|Vd}|V|d k}dS) NFr{:}z!prefix %r not found in prefix map@)getxpath_tokenizer_refindallsplitKeyError SyntaxError) pattern namespacesdefault_namespaceparsing_attributetokenttypetagprefixuris .selectvs@  ;tx..JJJ  r$z{}*c3\K|D]%}|j}|r|ddkr|V&dS)Nrrr+)r r/r0el_tagr1r2s rr3z_prepare_tag..select|sS  ;vt,,c1A1AJJJ  r$r&r'c3hK|D]+}|j}|ks|r|kr|V,dSrr+) r r/r0r5r1r2no_nssuffixrs rr3z_prepare_tag..selectsY  S==KK$=$==&-SYBYBYJJJ  r$r(r)c3\K|D]%}|j}|r|kr|V&dSrr+)r r/r0r5r1r2nsns_onlys rr3z_prepare_tag..selectsS  ;vt,,B1F1FJJJ  r$zinternal parser error, got ) isinstancestrslicelen RuntimeError)rr3r1r2r8r<r=r9s` @@@@@@r _prepare_tagrCpsi"CK f}}                RaRE  QRRs6{{lD))!""g           RSST   "Xc"gg&&          >>>??? Mr$c|dtrtfd}ndddkr ddfd}|S)Nrc4d}|||S)Nc3$K|D] }|Ed{V dSrr*)r/r0s r select_childz3prepare_child..select..select_childs2"$$D#OOOOOOOO$$r$r*r r/rG select_tags rr3zprepare_child..selects0 $ $ $:g||F';';<< K|D]}|D]}|jkr|VdSrr+r r/r0r"rs rr3zprepare_child..selectsI    Au||   r$)r,rCnextrr3rIrs @@r prepare_childrOs (C !#&&  = = = = = = rr7d??abb'C     Mr$c d}|S)Nc3$K|D] }|Ed{V dSrr*)r r/r0s rr3zprepare_star..selects2  DOOOOOOOO  r$r*rNrr3s r prepare_starrSs Mr$c d}|S)Nc3K|Ed{VdSrr*)r r/s rr3zprepare_self..selects$r$r*rRs r prepare_selfrVs Mr$c$ |}n#t$rYdSwxYw|ddkrdn |ds |dntdtrtfd}ndddkr ddfd}|S) Nr*rzinvalid descendantc4d}|||S)Nc3RK|D]!}|D] }||ur|V "dSrr)r/r0r"s rrGz8prepare_descendant..select..select_childsN"$$D!YY[[$$D=="#GGG$$$r$r*rHs rr3z"prepare_descendant..selects0 $ $ $ :g||F';';<< .selectsQ  3  A}}   r$) StopIterationrr,rCrMs @@rprepare_descendantr^s  Qx3 1X0Ah./// !#&&  = = = = = = rr7d??abb'C     Ms  c d}|S)Nc3hKt|}i}|D]}||vr||}||vr d||<|VdSr)r#)r r/r result_mapr0parents rr3zprepare_parent..selectse#G,,   ! !Dz!!#D)++)-Jv& LLL  ! !r$r*rRs rprepare_parentrcs ! ! ! Mr$c g}g} |}n#t$rYdSwxYw|ddkrnl|dkr2|dr$|ddddvrd|dddf}||dpd||dd |}|d kr|dfd }|S|d ks|d kr$|d|d  fd} fd}d|vr|n|S|dkr*tjd|ds|dfd}|S|dks-|dks'|dks|dkrLtjd|ds1|d|d r  fd} fd}n fd} fd}d|vr|n|S|dks |dks|dkr|dkr.t |ddz dkrt dnp|ddkrt d|dkrM t |d dz n#t$rt d!wxYwd"krt d#ndfd$}|St d%)&Nrr])rrz'"'r:-rz@-c3HK|D]}||VdSrr )r r/r0keys rr3z!prepare_predicate..selects:  88C==,JJJ  r$z@-='z@-!='c3PK|D]}|kr|V dSrri)r r/r0rjvalues rr3z!prepare_predicate..selects?  88C==E))JJJ  r$c3XK|D]#}|x} |kr|V$dSrri)r r/r0 attr_valuerjrls rselect_negatedz)prepare_predicate..select_negatedsI  "&((3--/J<uATATJJJ  r$z!=z\-?\d+$c3HK|D]}||VdSr)find)r r/r0rs rr3z!prepare_predicate..selects:  99S>>-JJJ  r$z.='z.!='z-='z-!='c3K|D]K}|D]3}d|kr|Vn4LdSNr)r joinitertextr r/r0r"rrls rr3z!prepare_predicate..selectsn"""D!\\#..""771::<<00E99"&JJJ!E:""r$c3K|D]K}|D]3}d|kr|Vn4LdSrs)iterfindrtrurvs rroz)prepare_predicate..select_negated"sn"""D!]]3//""771::<<00E99"&JJJ!E:""r$c3tK|D]1}d|kr|V2dSrsrtrur r/r0rls rr3z!prepare_predicate..select)I"##Dwwt}}//588" ##r$c3tK|D]1}d|kr|V2dSrsrzr{s rroz)prepare_predicate..select_negated-r|r$z-()z-()-zXPath position >= 1 expectedlastzunsupported functionr6zunsupported expressionr(z)XPath offset from last() must be negativec3Kt|}|D]W} ||}t||j}||ur|VA#tt f$rYTwxYwdSr)r#listr r IndexErrorr)r r/rr0rbelemsindexs rr3z!prepare_predicate..selectEs'00J  '-F !9!9::EU|t++" "H-D  s=AA*)A*zinvalid predicate)r]appendrtrematchintr ValueError) rNr signature predicater3rorrjrrls @@@@rprepare_predicatersII # DFFEE    FF  8s??  H    8 (a! --q!B$'EqS)))q""" # ""IDl      Fi722l"             "&!2!2~~>CYq\ B Bl      EY&00 %  9#6#6HZ166$7l"   # " " " " " "  " " " " " " " # # # # # # # # # #"&!2!2~~>C9--f1D1D    ! %%)Eqyy!"@AAA|v%%!"8999F""@ ! --1EE!@@@%&>???@2::%&QRRR      ) * **s  $$6HH))rrX.z..z//[ceZdZdZdZdS)_SelectorContextNc||_dSr)r)selfrs r__init__z_SelectorContext.__init__`s  r$)__name__ __module__ __qualname__rrr*r$rrr^s(Jr$rcZ|dddkr|dz}|f}|r1|tt|z } t|}n.#t$r t tdkrt|dddkrtdtt||j } |}n#t$rYYdSwxYwg} | t|d||n#t$rtddwxYw |}|ddkr |}n#t$rYnwxYw|t|<YnwxYw|g}t|}|D]} | ||}|S) Nr:/rXdrz#cannot use absolute path on elementrz invalid path)tuplesorteditems_cacherrAclearrrr__next__r]ropsr) r0pathr cache_keyselectorrNrr/r r3s rrxrxhs  BCCyCczI7U6*"2"2"4"455666 %)$ %%% v;;   LLNNN 8s??CDD DOD*5566? DFFEE    FFF   <E!H dE : :;;;;  < < <!.11t; < 8s?? DFFE      %y-%0VFt$$G))(( Mss AA;F C! F! C0+F/C00F7/D'&F'EF E'&F' E41F3E44FFc@tt|||dSr)rNrxr0rrs rrqrqs tZ00$ 7 77r$c>tt|||Sr)rrxrs rr r s tZ00 1 11r$c tt|||}|jdS|jS#t$r|cYSwxYwrs)rNrxtextr])r0rdefaultrs rfindtextrsYHT44455 9 2y s%00 ??r)NN)rcompiler rr#r,rCrOrSrVr^rcrrrrrxrqr rr*r$rrstv RZ    ----0000&&&R&  >   n+n+n+b        ''''X8888 2222 r$__pycache__/cElementTree.cpython-311.pyc000064400000000332152531452610014034 0ustar00 fRddlTdS))*N)xml.etree.ElementTree=/opt/alt/python311/lib64/python3.11/xml/etree/cElementTree.pyrs$#####r__pycache__/__init__.cpython-311.pyc000064400000000246152531452610013223 0ustar00 fEdS)Nr9/opt/alt/python311/lib64/python3.11/xml/etree/__init__.pyrsr__pycache__/__init__.cpython-311.opt-1.pyc000064400000000246152531452610014162 0ustar00 fEdS)Nr9/opt/alt/python311/lib64/python3.11/xml/etree/__init__.pyrsr__pycache__/ElementPath.cpython-311.pyc000064400000041537152531452610013702 0ustar00 f6ddlZejdZddZdZdZdZdZdZd Z d Z d Z d Z eee e e e d Z iZGddZddZddZddZddZdS)Nz`('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|!=|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@!=\s]+)|\s+c#K|r|dnd}d}t|D]}|\}}|r|ddkrsd|vrW|dd\}} |st|d||d|fVn6#t$rt d|zdwxYw|r|s |d|d|fVn|Vd}|V|d k}dS) NFr{:}z!prefix %r not found in prefix map@)getxpath_tokenizer_refindallsplitKeyError SyntaxError) pattern namespacesdefault_namespaceparsing_attributetokenttypetagprefixuris .selectvs@  ;tx..JJJ  r$z{}*c3\K|D]%}|j}|r|ddkr|V&dS)Nrrr+)r r/r0el_tagr1r2s rr3z_prepare_tag..select|sS  ;vt,,c1A1AJJJ  r$r&r'c3hK|D]+}|j}|ks|r|kr|V,dSrr+) r r/r0r5r1r2no_nssuffixrs rr3z_prepare_tag..selectsY  S==KK$=$==&-SYBYBYJJJ  r$r(r)c3\K|D]%}|j}|r|kr|V&dSrr+)r r/r0r5r1r2nsns_onlys rr3z_prepare_tag..selectsS  ;vt,,B1F1FJJJ  r$zinternal parser error, got ) isinstancestrslicelen RuntimeError)rr3r1r2r8r<r=r9s` @@@@@@r _prepare_tagrCpsi"CK f}}                RaRE  QRRs6{{lD))!""g           RSST   "Xc"gg&&          >>>??? Mr$c|dtrtfd}ndddkr ddfd}|S)Nrc4d}|||S)Nc3$K|D] }|Ed{V dSrr*)r/r0s r select_childz3prepare_child..select..select_childs2"$$D#OOOOOOOO$$r$r*r r/rG select_tags rr3zprepare_child..selects0 $ $ $:g||F';';<< K|D]}|D]}|jkr|VdSrr+r r/r0r"rs rr3zprepare_child..selectsI    Au||   r$)r,rCnextrr3rIrs @@r prepare_childrOs (C !#&&  = = = = = = rr7d??abb'C     Mr$c d}|S)Nc3$K|D] }|Ed{V dSrr*)r r/r0s rr3zprepare_star..selects2  DOOOOOOOO  r$r*rNrr3s r prepare_starrSs Mr$c d}|S)Nc3K|Ed{VdSrr*)r r/s rr3zprepare_self..selects$r$r*rRs r prepare_selfrVs Mr$c$ |}n#t$rYdSwxYw|ddkrdn |ds |dntdtrtfd}ndddkr ddfd}|S) Nr*rzinvalid descendantc4d}|||S)Nc3RK|D]!}|D] }||ur|V "dSrr)r/r0r"s rrGz8prepare_descendant..select..select_childsN"$$D!YY[[$$D=="#GGG$$$r$r*rHs rr3z"prepare_descendant..selects0 $ $ $ :g||F';';<< .selectsQ  3  A}}   r$) StopIterationrr,rCrMs @@rprepare_descendantr^s  Qx3 1X0Ah./// !#&&  = = = = = = rr7d??abb'C     Ms  c d}|S)Nc3hKt|}i}|D]}||vr||}||vr d||<|VdSr)r#)r r/r result_mapr0parents rr3zprepare_parent..selectse#G,,   ! !Dz!!#D)++)-Jv& LLL  ! !r$r*rRs rprepare_parentrcs ! ! ! Mr$c g}g} |}n#t$rYdSwxYw|ddkrnl|dkr2|dr$|ddddvrd|dddf}||dpd||dd |}|d kr|dfd }|S|d ks|d kr$|d|d  fd} fd}d|vr|n|S|dkr*tjd|ds|dfd}|S|dks-|dks'|dks|dkrLtjd|ds1|d|d r  fd} fd}n fd} fd}d|vr|n|S|dks |dks|dkr|dkr.t |ddz dkrt dnp|ddkrt d|dkrM t |d dz n#t$rt d!wxYwd"krt d#ndfd$}|St d%)&Nrr])rrz'"'r:-rz@-c3HK|D]}||VdSrr )r r/r0keys rr3z!prepare_predicate..selects:  88C==,JJJ  r$z@-='z@-!='c3PK|D]}|kr|V dSrri)r r/r0rjvalues rr3z!prepare_predicate..selects?  88C==E))JJJ  r$c3XK|D]#}|x} |kr|V$dSrri)r r/r0 attr_valuerjrls rselect_negatedz)prepare_predicate..select_negatedsI  "&((3--/J<uATATJJJ  r$z!=z\-?\d+$c3HK|D]}||VdSr)find)r r/r0rs rr3z!prepare_predicate..selects:  99S>>-JJJ  r$z.='z.!='z-='z-!='c3K|D]K}|D]3}d|kr|Vn4LdSNr)r joinitertextr r/r0r"rrls rr3z!prepare_predicate..selectsn"""D!\\#..""771::<<00E99"&JJJ!E:""r$c3K|D]K}|D]3}d|kr|Vn4LdSrs)iterfindrtrurvs rroz)prepare_predicate..select_negated"sn"""D!]]3//""771::<<00E99"&JJJ!E:""r$c3tK|D]1}d|kr|V2dSrsrtrur r/r0rls rr3z!prepare_predicate..select)I"##Dwwt}}//588" ##r$c3tK|D]1}d|kr|V2dSrsrzr{s rroz)prepare_predicate..select_negated-r|r$z-()z-()-zXPath position >= 1 expectedlastzunsupported functionr6zunsupported expressionr(z)XPath offset from last() must be negativec3Kt|}|D]W} ||}t||j}||ur|VA#tt f$rYTwxYwdSr)r#listr r IndexErrorr)r r/rr0rbelemsindexs rr3z!prepare_predicate..selectEs'00J  '-F !9!9::EU|t++" "H-D  s=AA*)A*zinvalid predicate)r]appendrtrematchintr ValueError) rNr signature predicater3rorrjrrls @@@@rprepare_predicatersII # DFFEE    FF  8s??  H    8 (a! --q!B$'EqS)))q""" # ""IDl      Fi722l"             "&!2!2~~>CYq\ B Bl      EY&00 %  9#6#6HZ166$7l"   # " " " " " "  " " " " " " " # # # # # # # # # #"&!2!2~~>C9--f1D1D    ! %%)Eqyy!"@AAA|v%%!"8999F""@ ! --1EE!@@@%&>???@2::%&QRRR      ) * **s  $$6HH))rrX.z..z//[ceZdZdZdZdS)_SelectorContextNc||_dSr)r)selfrs r__init__z_SelectorContext.__init__`s  r$)__name__ __module__ __qualname__rrr*r$rrr^s(Jr$rcZ|dddkr|dz}|f}|r1|tt|z } t|}n.#t$r t tdkrt|dddkrtdtt||j } |}n#t$rYYdSwxYwg} | t|d||n#t$rtddwxYw |}|ddkr |}n#t$rYnwxYw|t|<YnwxYw|g}t|}|D]} | ||}|S) Nr:/rXdrz#cannot use absolute path on elementrz invalid path)tuplesorteditems_cacherrAclearrrr__next__r]ropsr) r0pathr cache_keyselectorrNrr/r r3s rrxrxhs  BCCyCczI7U6*"2"2"4"455666 %)$ %%% v;;   LLNNN 8s??CDD DOD*5566? DFFEE    FFF   <E!H dE : :;;;;  < < <!.11t; < 8s?? DFFE      %y-%0VFt$$G))(( Mss AA;F C! F! C0+F/C00F7/D'&F'EF E'&F' E41F3E44FFc@tt|||dSr)rNrxr0rrs rrqrqs tZ00$ 7 77r$c>tt|||Sr)rrxrs rr r s tZ00 1 11r$c tt|||}|jdS|jS#t$r|cYSwxYwrs)rNrxtextr])r0rdefaultrs rfindtextrsYHT44455 9 2y s%00 ??r)NN)rcompiler rr#r,rCrOrSrVr^rcrrrrrxrqr rr*r$rrstv RZ    ----0000&&&R&  >   n+n+n+b        ''''X8888 2222 r$__pycache__/ElementInclude.cpython-312.pyc000064400000007625152531516020014366 0ustar00 {|j(ddlZddlmZddlmZdZedzZedzZdZGd d e Z Gd d e Z dd Z ddefdZ dZy)N) ElementTree)urljoinz!{http://www.w3.org/2001/XInclude}includefallbackc eZdZy)FatalIncludeErrorN__name__ __module__ __qualname__1/usr/lib64/python3.12/xml/etree/ElementInclude.pyr r Crr c eZdZy)LimitedRecursiveIncludeErrorNr rrrrrGrrrc|dk(r:t|d5}tj|j}ddd|S|sd}t|d|5}|j }ddd|S#1swYSxYw#1swYSxYw)NxmlrbzUTF-8r)encoding)openrparsegetrootread)hrefrrfiledatas rdefault_loaderr!Ws ~ $ $$T*224D K H $h /499;D0 K K0 Ks$A-A:-A7:Bc|d}n|dkrtd|zt|dr|j}|t}t ||||t y)Nrz;expected non-negative depth or None for 'max_depth', got %rr) ValueErrorhasattrrr!_includeset)elemloaderbase_url max_depths rrrusW QVYbbcctY||~ ~ T68Y6rcd}|t|kr||}|jtk(r|jd}|r t ||}|jdd}|dk(r||vrt d|z|dk(rt d|z|j||||} | t d|d|tj| } t| |||d z ||j||jr"| jxsd |jz| _ | ||<n|d k(r||||jd } | t d|d||jr| |jz } |r!||d z } | jxsd | z| _ n|jxsd | z|_ ||=t d |z|jtk(rt d|jzt||||||d z }|t|kryy)Nrrrrzrecursive include of %sz5maximum xinclude depth reached when including file %sz cannot load z as rtextrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))lentagXINCLUDE_INCLUDEgetrr raddcopyr&removetailr.XINCLUDE_FALLBACK) r(r)r*r+ _parent_hrefsierrnoder.s rr&r&s A c$i- G 55$ $55=Dx.EE'5)E~=(+,E,LMM>6ORVVXX!!$'dE*<+26>yyvtY]MJ$$T*66!%bAFF :DIQ&dE155+<=<+26>66AFFND!9D!%bD 8DI!%bD 8DIG'?%GUU' '#BQUUJ  Q)] C Qg c$i-r)N)r4r-r urllib.parserXINCLUDEr1r7DEFAULT_MAX_INCLUSION_DEPTH SyntaxErrorr rr!rr&rrrr@sff  .i'z)     #4 <1 76r__pycache__/cElementTree.cpython-312.opt-1.pyc000064400000000275152531516020014776 0ustar00 {|jRddly))*N)xml.etree.ElementTree//usr/lib64/python3.12/xml/etree/cElementTree.pyrs $r__pycache__/__init__.cpython-312.pyc000064400000000214152531516020013213 0ustar00 {|jEy)Nr+/usr/lib64/python3.12/xml/etree/__init__.pyrsr__pycache__/ElementPath.cpython-312.opt-1.pyc000064400000035203152531516020014627 0ustar00 {|j7ddlZejdZddZdZdZdZdZdZd Z d Z d Z d Z eee e e e d Z iZGddZddZddZddZddZy)Nz`('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|!=|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@!=\s]+)|\s+c#jK|r|jdnd}d}tj|D]d}|\}}|rR|ddk7rJd|vr.|jdd\}} |st|d||d|fn|r|s |d|d|fn|d}\||d k(}fy#t$rt d|zdwxYww) NFr{:}z!prefix %r not found in prefix map@)getxpath_tokenizer_refindallsplitKeyError SyntaxError) pattern namespacesdefault_namespaceparsing_attributetokenttypetagprefixuris ./usr/lib64/python3.12/xml/etree/ElementPath.pyxpath_tokenizerrJs.8 r*d#++G4 s 3q6S=cz!iiQ/ ^%&Z-?!EEE#+<):C@@@ % K % %5 ^%&IF&RSY]]^sAB3B2%B3B00B3c|j}|4ix|_}|jjD]}|D]}|||< |SN) parent_maprootiter)contextrpes rget_parent_mapr#bsR##J*,,Z""$A ! 1 % c&|dddk(xs|dddk(S)N{*}}*rs r_is_wildcard_tagr,ls# r7e  /s23x4//r$c8ttcdk(rfd}|Sdk(rfd}|Sdddk(r+ddtt dddfd}|Sd dd k(r$dd tdtfd }|St d )Nz{*}*c3LK|D]}|js|ywrr+)r resultelem _isinstance_strs rselectz_prepare_tag..selectvs$txx.Js$$z{}*c3bK|D]%}|j}|s|ddk7s"|'yw)Nrrr+)r r/r0el_tagr1r2s rr3z_prepare_tag..select|s4vt,c1AJ ///r&r'c3lK|D]*}|j}|k(s|s|k(s'|,ywrr+) r r/r0r5r1r2no_nssuffixrs rr3z_prepare_tag..selects;S=K$=&-SYBYJs 444r(r)c3bK|D]%}|j}|s|k(s"|'ywrr+)r r/r0r5r1r2nsns_onlys rr3z_prepare_tag..selects4vt,B1FJr6zinternal parser error, got ) isinstancestrslicelen RuntimeError)rr3r1r2r9r=r>r:s` @@@@@@r _prepare_tagrDps"CK f} @ M9  4 M+ RaE QRs6{lD)!"g   M RST  "Xc"g&  M8>??r$cr|dtrtfd}|Sdddk(rddfd}|S)Nrc(d}|||S)Nc32K|D] }|Ed{y7wrr*)r/r0s r select_childz3prepare_child..select..select_childs"D#OO## r*r r/rH select_tags rr3zprepare_child..selects $g|F';< .selects+Auu|s' ')r,rDnextrr3rKrs @@r prepare_childrQsP (C!#&  = M r7d?ab'C Mr$c d}|S)Nc32K|D] }|Ed{y7wrr*)r r/r0s rr3zprepare_star..selectsDOO rIr*rPrr3s r prepare_starrUs Mr$c d}|S)Nc3$K|Ed{y7wrr*)r r/s rr3zprepare_self..selectss r*rTs r prepare_selfrXs  Mr$c |}|ddk(rdn|ds|dn tdtrtfd}|Sdddk(rddfd}|S#t$rYywxYw) Nr*rzinvalid descendantc(d}|||S)Nc3VK|D] }|jD] }||us| "ywrr)r/r0r"s rrHz8prepare_descendant..select..select_childs,"D!YY[D="#G)#s) )r*rJs rr3z"prepare_descendant..selects $ g|F';< .selects/3A}(s+ +) StopIterationrr,rDrOs @@rprepare_descendantr`s Qx3 1XAh.//!#&  = M r7d?ab'C M5 sA A)(A)c d}|S)Nc3dKt|}i}|D]}||vs||}||vsd||<|ywr)r#)r r/r result_mapr0parents rr3zprepare_parent..selectsH#G,  Dz!#D)+)-Jv& L s 0 0 0r*rTs rprepare_parentres ! Mr$c g}g} |}|ddk(rnL|dk(r|dr|ddddvr d|dddf}|j|dxsd|j|d]d j|}|d k(r |dfd }|S|d k(s|d k(r|d|d  fd} fd}d|vr|S|S|dk(r%tjd|ds |dfd}|S|dk(s(|dk(s#|dk(s|dk(rDtjd|ds+|d|d r  fd} fd}n fd} fd}d|vr|S|S|dk(s |dk(s|dk(ri|dk(r!t |ddz dkrGt d|ddk7r t d|dk(r" t |d dz d"kDr t d#dfd$}|St d%#t$rYywxYw#t$r t d!wxYw)&Nrr])rrz'"'r;-rz@-c3HK|D]}|j|ywrr )r r/r0keys rr3z!prepare_predicate..selects$88C=,J""z@-='z@-!='c3NK|D]}|jk(s|ywrrk)r r/r0rlvalues rr3z!prepare_predicate..selects&88C=E)Js%%c3XK|D] }|jx}|k7s|"ywrrk)r r/r0 attr_valuerlros rselect_negatedz)prepare_predicate..select_negateds0"&((3-/J<uATJs ***z!=z\-?\d+$c3HK|D]}|j|ywr)find)r r/r0rs rr3z!prepare_predicate..selects$99S>-Jrmz.='z.!='z-='z-!='c3K|D]@}|jD]*}dj|jk(s&|@BywNr)r joinitertextr r/r0r"rros rr3z!prepare_predicate..selectsC"D!\\#.771::<0E9"&J!/# .select_negated"sC"D!]]3/771::<0E9"&J!0#rzc3jK|D])}dj|jk(s&|+ywrvrwrxr r/r0ros rr3z!prepare_predicate..select)-"Dwwt}}/58" #(33c3jK|D])}dj|jk7s&|+ywrvr~rs rrrz)prepare_predicate..select_negated-rrz-()z-()-zXPath position >= 1 expectedlastzunsupported functionr7zunsupported expressionr(z)XPath offset from last() must be negativec3 Kt|}i}|D]J} ||}||jf}||vr$|j|j} |||<|||usG|Ly#t$rYYwxYw#t$rd||<Y.wxYwwr)r#rrr IndexError) r r/rcacher0rdrlelemsindexs rr3z!prepare_predicate..selectEs'0JE'-Ftxx(e#"NN4884E*%*5\c :%J &*%)c *sQBA!-B A0BB! A-*B,A--B0B>BBBzinvalid predicate)r_appendrwrematchintr ValueError) rPr signature predicater3rrrrlrros @@@@rprepare_predicaters|II  FE 8s?  H   8a! -q!B'EqS)q"  "IDl  Fi72l"   "&!2~>>CYq\ Bl  EY&0 % 9#6HHZ16l"   "  " # #"&!2~>>C9-f1D   ! %)Eqy!"@AA|v%!"899F"@ ! -1E2:%&QRR $ ) **[   h"@%&>??@sF6G6 GGG)rrZ.z..z//[ceZdZdZdZy)_SelectorContextNc||_yr)r)selfrs r__init__z_SelectorContext.__init__gs  r$)__name__ __module__ __qualname__rrr*r$rrres Jr$rc|dddk(r|dz}|f}|r%|tt|jz } t|}|g}t|}|D] } | ||} |S#t$rt tdkDrtj |dddk(r tdtt||j} |}n#t$rYYywxYwg} |jt|d||n#t$r tddwxYw |}|ddk(r|}n#t$rYnwxYwd|t|<Y wxYw) Nr;/rZdrz#cannot use absolute path on elementrz invalid path)tuplesorteditems_cacherrBclearrrr__next__r_ropsr) r0pathr cache_keyselectorrPrr/r r3s rr|r|osv BCyCczIU6*"2"2"4566 %)$2VFt$G( M9 % v;  LLN 8s?CD DOD*56?? FE    <E!H dE :;  <!.1t; < 8s? FE   %y-%sr A""A!EC  E CECE !DEDED32E3 D?<E>D?? EEc0tt|||dSr)rPr|r0rrs rrtrts tZ0$ 77r$c.tt|||Sr)listr|rs rr r s tZ0 11r$c tt|||}|jy|jS#t$r|cYSwxYwrv)rPr|textr_)r0rdefaultrs rfindtextrsEHT445 99 yy s"1 1 ??r)NN)rcompiler rr#r,rDrQrUrXr`rerrrrr|rtr rr*r$rrsv RZZ   -00&R&  > u+p        'X8 2 r$__pycache__/ElementInclude.cpython-312.opt-1.pyc000064400000007625152531516020015325 0ustar00 {|j(ddlZddlmZddlmZdZedzZedzZdZGd d e Z Gd d e Z dd Z ddefdZ dZy)N) ElementTree)urljoinz!{http://www.w3.org/2001/XInclude}includefallbackc eZdZy)FatalIncludeErrorN__name__ __module__ __qualname__1/usr/lib64/python3.12/xml/etree/ElementInclude.pyr r Crr c eZdZy)LimitedRecursiveIncludeErrorNr rrrrrGrrrc|dk(r:t|d5}tj|j}ddd|S|sd}t|d|5}|j }ddd|S#1swYSxYw#1swYSxYw)NxmlrbzUTF-8r)encoding)openrparsegetrootread)hrefrrfiledatas rdefault_loaderr!Ws ~ $ $$T*224D K H $h /499;D0 K K0 Ks$A-A:-A7:Bc|d}n|dkrtd|zt|dr|j}|t}t ||||t y)Nrz;expected non-negative depth or None for 'max_depth', got %rr) ValueErrorhasattrrr!_includeset)elemloaderbase_url max_depths rrrusW QVYbbcctY||~ ~ T68Y6rcd}|t|kr||}|jtk(r|jd}|r t ||}|jdd}|dk(r||vrt d|z|dk(rt d|z|j||||} | t d|d|tj| } t| |||d z ||j||jr"| jxsd |jz| _ | ||<n|d k(r||||jd } | t d|d||jr| |jz } |r!||d z } | jxsd | z| _ n|jxsd | z|_ ||=t d |z|jtk(rt d|jzt||||||d z }|t|kryy)Nrrrrzrecursive include of %sz5maximum xinclude depth reached when including file %sz cannot load z as rtextrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))lentagXINCLUDE_INCLUDEgetrr raddcopyr&removetailr.XINCLUDE_FALLBACK) r(r)r*r+ _parent_hrefsierrnoder.s rr&r&s A c$i- G 55$ $55=Dx.EE'5)E~=(+,E,LMM>6ORVVXX!!$'dE*<+26>yyvtY]MJ$$T*66!%bAFF :DIQ&dE155+<=<+26>66AFFND!9D!%bD 8DI!%bD 8DIG'?%GUU' '#BQUUJ  Q)] C Qg c$i-r)N)r4r-r urllib.parserXINCLUDEr1r7DEFAULT_MAX_INCLUSION_DEPTH SyntaxErrorr rr!rr&rrrr@sff  .i'z)     #4 <1 76r__pycache__/ElementTree.cpython-312.opt-1.pyc000064400000237273152531516020014645 0ustar00 {|j!!dZgdZdZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z Gdde Zd ZGd d Zifd ZdCd ZdCdZeZGddZGddZe j.dZdCdZdZhdZdZdZeeedZdZdddddd d!d"Z e e_ d#Z!d$Z"d%Z#d&Z$dDddd'd(d)Z%Gd*d+ejLZ'dDddd'd(d,Z(d-Z)dEd.Z*dCd/Z+dDd0Z,Gd1d2Z-dCd3Z.dCd4Z/e.Z0dCd5Z1Gd6d7Z2Gd8d9Z3dCddd:d;Z4ejjdZ9d?Z:d@Z; eZZ>e>eey#e?$rYywxYw)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) ElementPathceZdZdZy)r zAn 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____doc__./usr/lib64/python3.12/xml/etree/ElementTree.pyr r ks  r%r ct|dS)z2Return True if *element* appears to be an Element.tag)hasattr)elements r&r r ys 7E ""r%ceZdZdZdZ dZ dZ dZ ifdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZdZddZddZddZddZdZddZdZdZdZddZdZ y)rahAn 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 t|ts"td|jj||_i|||_g|_y)Nzattrib must be dict, not ) isinstancedict TypeError __class__r r(attrib _children)selfr(r1extras r&__init__zElement.__init__sL&$'  )),- -))5) r%c`d|jj|jt|fzS)Nz<%s %r at %#x>)r0r r(idr3s r&__repr__zElement.__repr__s&4>>#:#:DHHbh"OOOr%c&|j||S)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. )r0)r3r(r1s r& makeelementzElement.makeelements~~c6**r%c|j|j|j}|j|_|j|_||dd|SN)r;r(r1texttail)r3elems r&__copy__zElement.__copy__s@$++6II II Q r%c,t|jSr=)lenr2r8s r&__len__zElement.__len__s4>>""r%cjtjdtdt|jdk7S)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)warningswarnDeprecationWarningrCr2r8s r&__bool__zElement.__bool__s1  K 1   4>>"a''r%c |j|Sr=r2r3indexs r& __getitem__zElement.__getitem__s~~e$$r%ct|tr|D]}|j|n|j|||j|<yr=)r-slice_assert_is_elementr2)r3rPr*elts r& __setitem__zElement.__setitem__sB eU #'',  # #G , 'ur%c|j|=yr=rNrOs r& __delitem__zElement.__delitem__s NN5 !r%c\|j||jj|y)aAdd *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. NrTr2appendr3 subelements r&r[zElement.appends$  + j)r%cj|D].}|j||jj|0y)zkAppend subelements from a sequence. *elements* is a sequence with zero or more elements. NrZ)r3elementsr*s r&extendzElement.extends.  G  # #G , NN ! !' * r%c^|j||jj||y)z(Insert *subelement* at position *index*.N)rTr2insert)r3rPr]s r&rbzElement.inserts$  + eZ0r%cft|ts!tdt|jzy)Nzexpected an Element, not %s)r- _Element_Pyr/typer )r3es r&rTzElement._assert_is_elements.![)9DGr?r8s r&rwz Element.clear?s)  $$ DIr%c:|jj||S)agGet element attribute. Equivalent to attrib.get, but some implementations may handle this a bit more efficiently. *key* is what attribute to look for, and *default* is what to return if the attribute was not found. Returns a string containing the attribute value, or the default if attribute was not found. )r1get)r3keyrqs r&ryz Element.getJs{{sG,,r%c"||j|<y)zSet element attribute. Equivalent to attrib[key] = value, but some implementations may handle this a bit more efficiently. *key* is what attribute to set, and *value* is the attribute value to set it to. N)r1)r3rzvalues r&setz Element.setWs! Cr%c6|jjS)zGet list of attribute names. Names are returned in an arbitrary order, just like an ordinary Python dict. Equivalent to attrib.keys() )r1keysr8s r&rz Element.keysas{{!!r%c6|jjS)zGet element attributes as a sequence. The attributes are returned in arbitrary order. Equivalent to attrib.items(). Return a list of (name, value) tuples. )r1itemsr8s r&rz Element.itemsjs{{  ""r%c#K|dk(rd}||j|k(r||jD]}|j|Ed{y7w)aCreate tree iterator. The iterator loops over the element and all subelements in document order, returning all elements with a matching tag. If the tree structure is modified during iteration, new or removed elements may or may not be included. To get a stable set, use the list() function on the iterator, and loop over the resulting list. *tag* is what tags to look for (default is to return all elements) Return an iterator containing all the matching elements. *N)r(r2iter)r3r(rfs r&rz Element.iterusJ #:C ;$((c/JAvvc{ " " "sAA A A c#K|j}t|ts|y|j}|r||D]-}|j Ed{|j }|s*|/y7w)zCreate text iterator. The iterator loops over the element and all subelements in document order, returning all inner text. N)r(r-strr>itertextr?)r3r(trfs r&rzElement.itertexts`hh#s#  II GAzz| # #A  #sA A) A' A) A)r=NN)!r r!r"r#r(r1r>r?r5r9r;rArDrLrQrVrXr[r`rbrTrhrjrorsrurwryr}rrrrr$r%r&rr~s( C F1 D D$&P +#(%(" *+1 N * 8 E ; < % -!" ##,r%rc Xi||}|j||}|j||S)aSubelement 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. )r;r[)parentr(r1r4r*s r&rrs6! % F  f-G MM' Nr%c2tt}||_|S)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. )rrr>)r>r*s r&rrsgGGL Nr%cdtt}||_|r|jdz|z|_|S)a*Processing 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.  )rrr>)targetr>r*s r&rrs3+,GGL ||c)D0 Nr%cHeZdZdZd dZdZdZdZdZdZ d Z d Z d Z y) raQualified 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. Nc&|rd|d|}||_y)N{}r>)r3 text_or_urir(s r&r5zQName.__init__s &137K r%c|jSr=rr8s r&__str__z QName.__str__s yyr%cPd|jjd|jdS)N)r0r r>r8s r&r9zQName.__repr__s NN33TYY??r%c,t|jSr=)hashr>r8s r&__hash__zQName.__hash__sDIIr%crt|tr|j|jkS|j|kSr=r-rr>r3others r&__le__z QName.__le__. eU #99 * *yyE!!r%crt|tr|j|jkS|j|kSr=rrs r&__lt__z QName.__lt__. eU #99uzz) )yy5  r%crt|tr|j|jk\S|j|k\Sr=rrs r&__ge__z QName.__ge__rr%crt|tr|j|jkDS|j|kDSr=rrs r&__gt__z QName.__gt__rr%crt|tr|j|jk(S|j|k(Sr=rrs r&__eq__z QName.__eq__rr%r=) r r!r"r#r5rr9rrrrrrr$r%r&rrs5  @"!"!"r%rcpeZdZdZddZdZdZddZddZddZ dd Z dd Z dd Z dd d dZ dZy)ra%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. Nc:||_|r|j|yyr=)_rootr )r3r*files r&r5zElementTree.__init__ s  JJt  r%c|jS)z!Return root element of this tree.rr8s r&getrootzElementTree.getroots zzr%c||_y)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)r3r*s r&_setrootzElementTree._setroots  r%cd}t|dst|d}d} |Kt}t|dr5|j||_|j|r|j SS|j dx}r%|j||j dx}r%|j |_|j|r|j SS#|r|j wwxYw)a=Load 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)r3sourceparser close_sourcedatas r&r zElementTree.parse!s vv&&$'FL ~"6>2 "(!4!4V! r>r) _serialize ValueError _get_writerlower_serialize_textr _namespaces) r3file_or_filenameencodingxml_declarationdefault_namespacemethodrwritedeclared_encodingqnamesrm serializes r&rzElementTree.writes:F : %069: :"% )8 48R@QO$,^^%2&,,.6KK%()tzz2%0=N%O" &v. %VZ/CE5 4 4s BCCc(|j|dS)Nr)r)r)r3rs r& write_c14nzElementTree.write_c14nszz$vz..r%rr=)NNNN)r r!r"r#r5rrr rrjrorsrurrr$r%r&rrsZ   D $1,>,4,5." $ 3E $( 3Ej/r%rc#~K |j}|jdk(r|t|ddxsdfytj5}t |t jr|}nt |t jr1t j|}|j|jnFt j}d|_ ||_ |j|_ |j|_t j ||dd}|j|j|j|fdddy#t$rYXwxYw#1swYyxYw#t$rM|jdk(rd}t#|d|d 5}|j|fdddYy#1swYYyxYwwxYww) NrrrcyNTr$r$r%r&z_get_writer..sDr%xmlcharrefreplace )rerrorsnewlinew)rr)rrgetattr contextlib ExitStackr-ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletellAttributeError TextIOWrapperr)rrrstackrs r&rrs-+ && >> y (!1:tDOO O%%'5.0A0AB+D 0",,?,,-=>DNN4;;/,,.D$0DM!&DJ)9(A(A $4$9$9 ''19/B046 t{{+jj(**9('&*'(' ' >> y (H "C(,.15**h& &... 'sF= E$=F= B E"E .add_qname s .RayC 9++C3S#,>+//4F~!'#j/!9*0 3/5s$;F5M$'F5M$$3!&u  . &u - .sA.B 2B 8B B"!B") rr(r-rr>rrr rr) r@rrr(rzr|r>rmrs ` @@r&rrs(D\FJ(* $%.8 hh c5 !xxv%#((# S !& # _G!32 &s +**,JC#u%hh& #%'EJJf,D%**% 'yy dE "tyy'> dii '( : r%c |j}|j}|tur |d|znp|tur |d|zn[||}|,|r|t ||D]}t |||d|n(|d|zt |j} | s|r|rCt|jdD]$\} } | rd| z} |d| d t| d &| D]^\} } t| tr | j} t| tr|| j} n t| } |d || d | d `|s t|s|sA|d |r|t ||D]}t |||d||d |zd zn|d|jr|t |jyy)N rrc |dSNrr$xs r&rz _serialize_xml..hQqTr%rzr xmlns=""rr)r(r>rr _escape_cdata_serialize_xmllistrsorted_escape_attribr-rrCr?) rr@rrmrkwargsr(r>rfrvks r&rrRs ((C 99D g~ kD ! % % hoSk ;mD)*ua4HJ #) &E  &z'7'7'9+9!;1 #aA*1- !;"DAq!!U+FF!!U+"166N*1-&)Q78"s4y(<c --.A"5!VT8LNdSj3&'e  yy mDII&'r%>brhrcolimgwbrareabaselinkmetaembedframeinputparamtrackrisindexbasefontc |j}|j}|tur|dt|zn|tur|dt|znj||}|*|r|t||D]}t |||dn9|d|zt |j}|s|r|rCt|jdD]$\} } | rd| z} |d| dt| d &|D]^\} } t| tr | j} t| tr|| j} n t| } |d || d| d `|d |j} |r$| d k(s| d k(r ||n|t||D]}t |||d| tvr|d|zd z|jr|t|jyy)Nrr rc |dSr r$r s r&rz!_serialize_html..rr%rrrrrrrscriptstyler)r(r>rrr_serialize_htmlrrrrr-r_escape_attrib_htmlr HTML_EMPTYr?) rr@rrmrr(r>rfrrrltags r&r0r0s ((C 99D g~ kM$//0 % % ht,,-Sk ;mD)*q&$7 #) &E  &z'7'7'9+9!;1 #aA*1- !;"DAq!!U+FF!!U+"166N/2&)Q78" #J99;D8#tw$K--.q&$7:%dSj3&' yy mDII&'r%c||jD] }|| |jr||jyyr=)rr?)rr@parts r&rrs1  d   yy diir%)rhtmlr>ctjd|r tdttj D]\}}||k(s||k(st|=|t|<y)atRegister 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)rematchrrrr)rrrrs r&rrs[ xx 6"BCC^))+,1 8qF{q!-!N3r%rr6rdfwsdlxsxsidc)$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/cLtd|dt|jd)Nzcannot serialize z (type ))r/rer rs r&rrs! +/d1D1DE  r%c d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw)N&&r<r>replacer/rrrs r&rrso ) $;<<W-D $;<<V,D $;<<V,D ~ &)"4()AAA#"A#c| d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}d |vr|jd d }d |vr|jd d }d |vr|jd d}|S#ttf$rt|YywxYw)NrCrDrrErrFr" z rz  z rGrs r&rrs) $;<<W-D $;<<V,D $;<<V,D 4<<<h/D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sBBB;:B;c d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw)NrCrDrrFrrKrGrs r&r1r1sm ) $;<<W-D $;<<V,D 4<<<h/D ~ &)"4()rIT)rrrc|dk(rtjntj}t|j |||||||j S)a Generate 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. rrrrr)rStringIOBytesIOrrgetvalue)r*rrrrrstreams r&rr+sV ')3R[[]Fvx/>1B&,4H J ?? r%c.eZdZdZdZdZdZdZdZy)_ListDataStreamz7An auxiliary stream accumulating into a list reference.c||_yr=)lst)r3rXs r&r5z_ListDataStream.__init__Es r%cyrr$r8s r&rz_ListDataStream.writableHr%cyrr$r8s r&rz_ListDataStream.seekableKrZr%c:|jj|yr=)rXr[)r3bs r&rz_ListDataStream.writeNs r%c,t|jSr=)rCrXr8s r&rz_ListDataStream.tellQs488}r%N) r r!r"r#r5rrrrr$r%r&rVrVCsAr%rVc`g}t|}t|j|||||||S)NrP)rVrr)r*rrrrrrXrTs r&rrTsC C S !Fvx/>1B&,4H J Jr%ct|ts t|}|jtjd|j j }|r|ddk7r tjjdyy)a#Write 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)rrN)r-rrsysstdoutrr?)r@r?s r&rrasb dK (4 JJszzIJ. <<>  D 48t# $r%ct|tr|j}|dkrtd|t |syd|zzgfd|dy)a&Indent 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|dz} |}|jr|jjs||_|D]D}t |r |||j r|j jr>||_Fj js ||_yy#t$r|z}j|YwxYwr ) IndexErrorr[r>striprCr?)r@level child_levelchild_indentationchild_indent_children indentationsspaces r&rlz indent.._indent_childrensai  3 ,[ 9  yy  1)DIE5z  4::UZZ%5%5%7. zz!%e,EJ" 3 ,U 3e ;     1 2 3sB))"C C)r-rrrrC)treernrhrlrms ` @@r&rrtsb$ $||~ qyGwOPP t955=()L-,T1r%c>t}|j|||S)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 )rrros r&r r s =DJJvv Kr%ct||tdstddndfdGfddtjj }|}d |_tj||S) aJIncrementally 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\K jEd{|jd}|snj|>j}jEd{}|||_r|j yy7v7*#r|j wwxYww)Ni@) read_eventsrr_close_and_return_rootrootr)rrrwitr pullparserwrs r&iteratorziterparse..iterators %11333{{9-% 446D!--/ / /B~ 4 0  s?B,BBA B'B(B<B,BBB))B,cBeZdZWWjZfdZy)$iterparse..IterParseIteratorc,rjyyr=)r)r3rrs r&__del__z,iterparse..IterParseIterator.__del__s r%N)r r!r"__next__r)rr{rsr&IterParseIteratorr}sF#,, r%rN) rr)r collectionsabcIteratorrwweakrefref) rrrrrrxrr{ryrzs ` @@@@r&r r st"ff=J 66 "fd#  $KOO44  BBG RB Ir%c8eZdZd dddZdZdZdZdZdZy) rN)rsctj|_|xstt |_|d}|j j |j|y)Nr)end)rdeque _events_queuerrrs _setevents)r3rrrss r&r5zXMLPullParser.__init__sL )..0A);="A >F  2 2F;r%c|j td|r |jj|yy#t$r%}|jj |Yd}~yd}~wwxYw)Feed encoded data to parser.Nz!feed() called after end of stream)rsrr SyntaxErrorrr[)r3rexcs r&rzXMLPullParser.feeds` << @A A  / !!$'  /""))#.. /s8 A&A!!A&cH|jj}d|_|Sr=)rsr)r3rws r&rvz$XMLPullParser._close_and_return_roots ||!!#  r%c$|jy)zFinish feeding data to parser. Unlike XMLParser, does not return the root element. Use read_events() to consume elements from XMLPullParser. N)rvr8s r&rzXMLPullParser.closes ##%r%c#|K|j}|r*|j}t|tr|||r)yyw)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)rpopleftr- Exception)r3rrevents r&ruzXMLPullParser.read_eventss; ##NN$E%+  s7<<cf|j td|jjy)Nz"flush() called after end of stream)rsrflushr8s r&rzXMLPullParser.flush$s( << AB B r%r=) r r!r"r5rrvrrurr$r%r&rrs' rs r&rr*s+ +-0 KK <<>r%c|stt}|j||j}i}|j D]}|j d}|s|||<||fS)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. rr7)rrrrrry)r>rroidsr@r7s r&rr;sd +-0 KK <<>D C  XXd^ CG 9r%c~|stt}|D]}|j||jS)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)sequencerr>s r&rrSs5 +-0 D <<>r%cVeZdZdZdddddddZdZdZdZd Zd Z d Z dd Z d Z y)ra8Generic 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_piscg|_g|_d|_d|_d|_|t }||_||_|t}||_ ||_ |t}||_ yr=) _data_elem_lastr_tailr_comment_factoryrr _pi_factoryrr_factory)r3element_factoryrrrrs r&r5zTreeBuilder.__init__ysn      "%O /.  .J%$  "%O' r%c|jS)z;Flush builder buffers and return toplevel document Element.rr8s r&rzTreeBuilder.closeszzr%c|jr^|jJdj|j}|jr||j_n||j_g|_yyNr)rrjoinrr?r>r3r>s r&_flushzTreeBuilder._flushsP ::zz%wwtzz*::&*DJJO'+DJJODJ r%c:|jj|y)zAdd text to current element.N)rr[r3rs r&rzTreeBuilder.datas $r%c|j|j||x|_}|jr|jdj |n|j ||_|jj |d|_|S)zOpen new element and return it. *tag* is the element name, *attrs* is a dict containing element attributes. rar)rrrrr[rr)r3r(attrsr@s r&startzTreeBuilder.startsp  MM#u55 T :: JJrN ! !$ ' ZZ DJ $  r%c|j|jj|_d|_|jS)zOClose and return current Element. *tag* is the element name. r)rrpoprrrs r&rzTreeBuilder.ends2 ZZ^^%  zzr%cP|j|j|j|S)z`Create a comment using the comment_factory. *text* is the text of the comment. )_handle_singlerrrs r&commentzTreeBuilder.comments* ""  ! !4#7#7? ?r%cR|j|j|j||S)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 ''. )rrr)r3rr>s r&pizTreeBuilder.pis* ""   doovt= =r%c||}|rH|j||_|jr|jdj|d|_|S)Nrar)rrrr[r)r3factoryrbargsr@s r&rzTreeBuilder._handle_singlesG~  KKMDJzz 2%%d+DJ r%r=) r r!r"r#r5rrrrrrrrr$r%r&rresC&(!%$!&5((  " ?=r%rc`eZdZdZddddZdZdZdZdZd Z d Z d Z d Z d Z dZdZy)raaElement 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)rrcJ ddlm}|j |d}| t }|x|_|_|x|_|_ |j|_ i|_ |j|_t|dr|j |_t|dr|j$|_t|dr|j(|_t|dr|j,|_t|d r|j0|_t|d r|j4|_t|d r|j8|_d |_d |_d|_ i|_! d |jDz|_#y#t$r" ddl}n#t$r tdwxYwYwxYw#tH$rYywxYw)Nrexpatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrstart_nsend_nsrrrrzExpat %d.%d.%d)% xml.parsersr ImportErrorpyexpat ParserCreaterrrsr_targeterror_error_names_defaultDefaultHandlerExpandr)_startStartElementHandler_endEndElementHandler _start_nsStartNamespaceDeclHandler_end_nsEndNamespaceDeclHandlerrCharacterDataHandlerrCommentHandlerrProcessingInstructionHandler buffer_textordered_attributes_doctypeentity version_infoversionr)r3rrrrs r&r5zXMLParser.__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;E(F( F2E76F7F  FF F"!F"c|j}|j}|D]}|dk(r d|_|||jfd}||_(|dk(r|||j fd}||_F|dk(r6t|jdr|||jfd}n||fd }||_ |d k(r6t|jd r|||jfd }n||fd }||_ |dk(r|||fd}||_ |dk(r|||fd}||_td|zy)Nrrc&|||||fyr=r$)r( attrib_inrr[rs r&handlerz%XMLParser._setevents..handler"sE5i#89:r%rc$||||fyr=r$)r(rr[rs r&rz%XMLParser._setevents..handler'sE3s8,-r%zstart-nsrc&|||||fyr=r$)rrrr[rs r&rz%XMLParser._setevents..handler.sx'<=>r%c,|||xsd|xsdffyrr$)rrrr[s r&rz%XMLParser._setevents..handler2s "ciR'@ABr%zend-nsrc$||||fyr=r$)rrr[rs r&rz%XMLParser._setevents..handler8svf~67r%c||dfyr=r$)rrr[s r&rz%XMLParser._setevents..handler<st}-r%rcJ|||jj|fyr=)rr)r>rr[r3s r&rz%XMLParser._setevents..handler@sE4;;#6#6t#<=>r%rcL|||jj||fyr=)rr) pi_targetrrr[r3s r&rz%XMLParser._setevents..handlerDsE4;;>>)T#BCDr%zunknown event %r)rsr[rrrrrr)rrrrrrrr)r3 events_queueevents_to_reportrr[ event_namers r&rzXMLParser._seteventss5$$*JW$,-)2fC3:0x'4;;1.8'+||8/9.18.y((26?(/%t#3=f!%E7>3 !3j!@AAU+r%cxt|}|j|_|j|jf|_|r=)r codelinenooffsetposition)r3r|errs r& _raiseerrorzXMLParser._raiseerrorKs0::||U\\1  r%cz |j|}|S#t$r|}d|vrd|z}||j|<Y|SwxYw)Nrr)rKeyError)r3rznames r&_fixnamezXMLParser._fixnameQsU $;;s#D   $Dd{Tz#DKK   $s #::cJ|jj|xsd|xsdSr)rrr3rrs r&rzXMLParser._start_ns\s!{{##FLb#)<r data_handlerrrnrerpubidsystems r&rzXMLParser._defaultqsbq S= #{{//  T[[a45s]tBQx;6DM ]] &} $ ::{{   Q    KK 1 1+ >s)7A//B>BBBBB9)r r!r"r#r5rrrrrrrrrrrr$r%r&rrsN"&+Z3Bj =0 .34%l *"?r%r)out from_filec "| | tdd}|tjx}}tt |j fi|}|"|j ||jn| t||||jSdS)a3Convert 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) rrrQrrrrrr rS)xml_datarroptionssiors r&rrsI-UVV C {KKM!c .syyDGD EF H    i' _3<<>6$6r%z ^\w+:\w+$ceZdZdZdddddddddZefdZdZddZd Z d jfd Z d Z d Z ddZdZdZdZy)ra 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_tagsc2||_g|_||_||_|r t |nd|_|r t |nd|_||_|rt ||_nd|_|rt |j|_ nd|_ dgg|_ g|_ |s6|jjttj!|jjgi|_dg|_d|_d|_d|_d|_y)N)r?rFr)_writer_with_comments _strip_textr}_exclude_attrs _exclude_tags_rewrite_prefixes_qname_aware_tags intersection_find_qname_aware_attrs_declared_ns_stack _ns_stackr[rrr _prefix_map_preserve_space_pending_start _root_seen _root_done_ignored_depth) r3rr%r&r'r(r)r*r+s r&r5zC14NWriterTarget.__init__s  +%4Ac-0t2>S.D!1 %()9%:D "%)D " +./@+A+N+ND (+/D ( <$ #  NN ! !$~';';'="> ? b! %w"r%c#DK||D]}|s|Ed{y7wr=r$)r3ns_stack _reversedrms r&_iter_namespacesz!C14NWriterTarget._iter_namespaces(s$#H-J%%%.%s   c|jdd\}}|j|jD]\}}||k(s d|d|cStd|d|d)NrrrrzPrefix z of QName "" is not declared in scope)splitrAr7r)r3 prefixed_namerrrps r&_resolve_prefix_namez%C14NWriterTarget._resolve_prefix_name-sl$**32 ++DNN;FCF{C54&))<76(+m_D^_``r%c|%|dddk(r|ddjddnd|f\}}n|}t}|j|jD]/\}}||k(r||vr|r|d|n|||fcS|j |1|j ro||j vr|j |}n'dt|j x}|j |<|jdj||f|d|||fS|s d|vr|||fS|j|jD]:\}}||k(s |jdj||f|r|d|n|||fcS|s|||fStd|d ) Nrrrrrrraz Namespace "rC) rr}rAr6addr2r8rCr[r7r)r3rrr( prefixes_seenurs r&_qnamezC14NWriterTarget._qname4s ;38!93CuQRy''Q/"eHCC ..t/F/FGIAvCxF-7,2&3%(S#EE   f %H  ! !d&&&))#.34S9I9I5J4K1LL))#.  # #B ' . .V} =XQse$c3. .r.S= ..t~~>IAvCx''+22C=A,2&3%(S#EE? S= ;se+EFGGr%cT|js|jj|yyr=)r=rr[rs r&rzC14NWriterTarget.dataYs""" JJ  d ##r%rc||j}|jdd=|jr|jds|j}|j<|jdc}|_|r t |r|nd}|j g|||y|r(|jr|jt|yyyNra) rr/r9rgr:_looks_like_prefix_namerr;r-_escape_cdata_c14n)r3 _join_textrr qname_texts r&rzC14NWriterTarget._flush]s$**% JJqM   D$8$8$<::D   C/r%c |j4|r2|jDcic]\}}||jvs||}}}|h|}i}|'|j|x} ||<|j| |jX|rV|j |} | r@| D]:} || } t | s|j| x} || <|j| <nd} nd} |j } t|dDcic] }|| | }}|r.|Dcgc]\}}|rd|znd|f}}}|jng}|rVt|jD]:\}}| || vr||vr |||d}||\}} }|j|r|n| |f<|jd}|jj|r|dk(n|jd|j}|d ||dz|r:|d j|Dcgc]\}}d |d t|d c}}|d||t|||dd|_|j"jgycc}}wcc}wcc}}wcc}}w)Nc&|jddS)Nrr)rD)rs r&rz)C14NWriterTarget._start..s!''#q/r%rzxmlns:xmlnsrz+{http://www.w3.org/XML/1998/namespace}spacepreserverarrrrrrT)r0rrGrIr5rPrLrsortr[ryr9r-r_escape_attrib_c14nrQr;r7)r3r(rrVrSrrrresolved_namesrqattrs attr_namer| parse_qnamer parsed_qnamesrrr attr_qnamespace_behaviourrs r&rzC14NWriterTarget._starts    *u&+kkmTmdaq@S@S7SQTmET  !151J1J:1V VEN:. JJu   ' ' 311%8F!'I!),E.u58<8Q8QRW8XXu 5 5) "( Fkk 4: 153453qKN*53 4 $2#1KC'-F"'3?#1  NN I u{{}-1%!v+!~:M%nQ&78;A-:1-=* Is  *A!FG . ))$QR ##-*3M%Nq%QR S b!CU04 8UsI/I/3I5 I:Jc|jr|xjdzc_y|jr|j|jd|j |dd|j j t|j dk(|_|jj |jj y)Nrrrr) r=rrr-rLr9rrCr<r6r7rs r&rzC14NWriterTarget.ends      1 $   :: KKM bS)!,-Q/0   "d223q8 ##% r%c<|jsy|jry|jr|jdn(|jr|j r|j |jdt|d|js|jdyy)Nrz)r.r=r<r-r;rrrQrs r&rzC14NWriterTarget.commentsw""      ?? KK  __ KKM d-d34C89 KK r%c8|jry|jr|jdn(|jr|jr|j |j|rd|dt |dnd|d|js|jdyy)Nrz)r=r<r-r;rrrQ)r3rrs r&rzC14NWriterTarget.pis     ?? KK  __ KKM :>b,T232 6bPRO U KK r%r=)r r!r"r#r5reversedrArGrLrrrrrrrrrr$r%r&rrsj, %"&$#$# J4<& a#HJ$!# 210"C"J   r%rc d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw) NrCrDrrErrFrL rGrs r&rQrQs) $;<<W-D $;<<V,D $;<<V,D 4<<<g.D ~ &)"4()sAAA98A9cP d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}d |vr|jd d }d |vr|jd d }|S#ttf$rt|YywxYw) NrCrDrrErrKrMz rz rLrirGrs r&r\r\s) $;<<W-D $;<<V,D $;<<X.D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sBBB%$B%)r)_set_factoriesr=r)z r)@r#__all__rrbr8rIrrcollections.abcrrrrrr r rrrrr rrcontextmanagerrrrr2r0rrrrrrrr1rrrVrrrr r rrrrrrrrcompileUNICODEr9rPrrQr\rd _elementtreerkrr$r%r&rrs!P (       # ^^B $&$  +"+"`\/\/B /+/+b;z0(d 0(d    !*-2$*38(.(,16(, %3! ) )8 )!T"&0b''" !%&* &/l 5p77t",  $vvth?h?Z7tt7<%"**\2::>DDD)&). 3K+712  s E,,E43E4__pycache__/ElementTree.cpython-312.pyc000064400000240467152531516020013705 0ustar00 {|j!!dZgdZdZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z Gdde Zd ZGd d Zifd ZdCd ZdCdZeZGddZGddZe j.dZdCdZdZhdZdZdZeeedZdZdddddd d!d"Z e e_ d#Z!d$Z"d%Z#d&Z$dDddd'd(d)Z%Gd*d+ejLZ'dDddd'd(d,Z(d-Z)dEd.Z*dCd/Z+dDd0Z,Gd1d2Z-dCd3Z.dCd4Z/e.Z0dCd5Z1Gd6d7Z2Gd8d9Z3dCddd:d;Z4ejjdZ9d?Z:d@Z; eZZ>e>eey#e?$rYywxYw)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) ElementPathceZdZdZy)r zAn 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____doc__./usr/lib64/python3.12/xml/etree/ElementTree.pyr r ks  r%r ct|dS)z2Return True if *element* appears to be an Element.tag)hasattr)elements r&r r ys 7E ""r%ceZdZdZdZ dZ dZ dZ ifdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZdZddZddZddZddZdZddZdZdZdZddZdZ y)rahAn 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 t|ts"td|jj||_i|||_g|_y)Nzattrib must be dict, not ) isinstancedict TypeError __class__r r(attrib _children)selfr(r1extras r&__init__zElement.__init__sL&$'  )),- -))5) r%c`d|jj|jt|fzS)Nz<%s %r at %#x>)r0r r(idr3s r&__repr__zElement.__repr__s&4>>#:#:DHHbh"OOOr%c&|j||S)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. )r0)r3r(r1s r& makeelementzElement.makeelements~~c6**r%c|j|j|j}|j|_|j|_||dd|SN)r;r(r1texttail)r3elems r&__copy__zElement.__copy__s@$++6II II Q r%c,t|jSr=)lenr2r8s r&__len__zElement.__len__s4>>""r%cjtjdtdt|jdk7S)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)warningswarnDeprecationWarningrCr2r8s r&__bool__zElement.__bool__s1  K 1   4>>"a''r%c |j|Sr=r2r3indexs r& __getitem__zElement.__getitem__s~~e$$r%ct|tr|D]}|j|n|j|||j|<yr=)r-slice_assert_is_elementr2)r3rPr*elts r& __setitem__zElement.__setitem__sB eU #'',  # #G , 'ur%c|j|=yr=rNrOs r& __delitem__zElement.__delitem__s NN5 !r%c\|j||jj|y)aAdd *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. NrTr2appendr3 subelements r&r[zElement.appends$  + j)r%cj|D].}|j||jj|0y)zkAppend subelements from a sequence. *elements* is a sequence with zero or more elements. NrZ)r3elementsr*s r&extendzElement.extends.  G  # #G , NN ! !' * r%c^|j||jj||y)z(Insert *subelement* at position *index*.N)rTr2insert)r3rPr]s r&rbzElement.inserts$  + eZ0r%cft|ts!tdt|jzy)Nzexpected an Element, not %s)r- _Element_Pyr/typer )r3es r&rTzElement._assert_is_elements.![)9DGr?r8s r&rwz Element.clear?s)  $$ DIr%c:|jj||S)agGet element attribute. Equivalent to attrib.get, but some implementations may handle this a bit more efficiently. *key* is what attribute to look for, and *default* is what to return if the attribute was not found. Returns a string containing the attribute value, or the default if attribute was not found. )r1get)r3keyrqs r&ryz Element.getJs{{sG,,r%c"||j|<y)zSet element attribute. Equivalent to attrib[key] = value, but some implementations may handle this a bit more efficiently. *key* is what attribute to set, and *value* is the attribute value to set it to. N)r1)r3rzvalues r&setz Element.setWs! Cr%c6|jjS)zGet list of attribute names. Names are returned in an arbitrary order, just like an ordinary Python dict. Equivalent to attrib.keys() )r1keysr8s r&rz Element.keysas{{!!r%c6|jjS)zGet element attributes as a sequence. The attributes are returned in arbitrary order. Equivalent to attrib.items(). Return a list of (name, value) tuples. )r1itemsr8s r&rz Element.itemsjs{{  ""r%c#K|dk(rd}||j|k(r||jD]}|j|Ed{y7w)aCreate tree iterator. The iterator loops over the element and all subelements in document order, returning all elements with a matching tag. If the tree structure is modified during iteration, new or removed elements may or may not be included. To get a stable set, use the list() function on the iterator, and loop over the resulting list. *tag* is what tags to look for (default is to return all elements) Return an iterator containing all the matching elements. *N)r(r2iter)r3r(rfs r&rz Element.iterusJ #:C ;$((c/JAvvc{ " " "sAA A A c#K|j}t|ts|y|j}|r||D]-}|j Ed{|j }|s*|/y7w)zCreate text iterator. The iterator loops over the element and all subelements in document order, returning all inner text. N)r(r-strr>itertextr?)r3r(trfs r&rzElement.itertexts`hh#s#  II GAzz| # #A  #sA A) A' A) A)r=NN)!r r!r"r#r(r1r>r?r5r9r;rArDrLrQrVrXr[r`rbrTrhrjrorsrurwryr}rrrrr$r%r&rr~s( C F1 D D$&P +#(%(" *+1 N * 8 E ; < % -!" ##,r%rc Xi||}|j||}|j||S)aSubelement 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. )r;r[)parentr(r1r4r*s r&rrs6! % F  f-G MM' Nr%c2tt}||_|S)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. )rrr>)r>r*s r&rrsgGGL Nr%cdtt}||_|r|jdz|z|_|S)a*Processing 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.  )rrr>)targetr>r*s r&rrs3+,GGL ||c)D0 Nr%cHeZdZdZd dZdZdZdZdZdZ d Z d Z d Z y) raQualified 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. Nc&|rd|d|}||_y)N{}r>)r3 text_or_urir(s r&r5zQName.__init__s &137K r%c|jSr=rr8s r&__str__z QName.__str__s yyr%cPd|jjd|jdS)N)r0r r>r8s r&r9zQName.__repr__s NN33TYY??r%c,t|jSr=)hashr>r8s r&__hash__zQName.__hash__sDIIr%crt|tr|j|jkS|j|kSr=r-rr>r3others r&__le__z QName.__le__. eU #99 * *yyE!!r%crt|tr|j|jkS|j|kSr=rrs r&__lt__z QName.__lt__. eU #99uzz) )yy5  r%crt|tr|j|jk\S|j|k\Sr=rrs r&__ge__z QName.__ge__rr%crt|tr|j|jkDS|j|kDSr=rrs r&__gt__z QName.__gt__rr%crt|tr|j|jk(S|j|k(Sr=rrs r&__eq__z QName.__eq__rr%r=) r r!r"r#r5rr9rrrrrrr$r%r&rrs5  @"!"!"r%rcpeZdZdZddZdZdZddZddZddZ dd Z dd Z dd Z dd d dZ dZy)ra%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. Nc:||_|r|j|yyr=)_rootr )r3r*files r&r5zElementTree.__init__ s  JJt  r%c|jS)z!Return root element of this tree.rr8s r&getrootzElementTree.getroots zzr%c||_y)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)r3r*s r&_setrootzElementTree._setroots  r%cd}t|dst|d}d} |Kt}t|dr5|j||_|j|r|j SS|j dx}r%|j||j dx}r%|j |_|j|r|j SS#|r|j wwxYw)a=Load 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)r3sourceparser close_sourcedatas r&r zElementTree.parse!s vv&&$'FL ~"6>2 "(!4!4V! r>r) _serialize ValueError _get_writerlower_serialize_textr _namespaces) r3file_or_filenameencodingxml_declarationdefault_namespacemethodrwritedeclared_encodingqnamesrm serializes r&rzElementTree.writes:F : %069: :"% )8 48R@QO$,^^%2&,,.6KK%()tzz2%0=N%O" &v. %VZ/CE5 4 4s BCCc(|j|dS)Nr)r)r)r3rs r& write_c14nzElementTree.write_c14nszz$vz..r%rr=)NNNN)r r!r"r#r5rrr rrjrorsrurrr$r%r&rrsZ   D $1,>,4,5." $ 3E $( 3Ej/r%rc#~K |j}|jdk(r|t|ddxsdfytj5}t |t jr|}nt |t jr1t j|}|j|jnFt j}d|_ ||_ |j|_ |j|_t j ||dd}|j|j|j|fdddy#t$rYXwxYw#1swYyxYw#t$rM|jdk(rd}t#|d|d 5}|j|fdddYy#1swYYyxYwwxYww) NrrrcyNTr$r$r%r&z_get_writer..sDr%xmlcharrefreplace )rerrorsnewlinew)rr)rrgetattr contextlib ExitStackr-ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletellAttributeError TextIOWrapperr)rrrstackrs r&rrs-+ && >> y (!1:tDOO O%%'5.0A0AB+D 0",,?,,-=>DNN4;;/,,.D$0DM!&DJ)9(A(A $4$9$9 ''19/B046 t{{+jj(**9('&*'(' ' >> y (H "C(,.15**h& &... 'sF= E$=F= B E"E .add_qname s .RayC 9++C3S#,>+//4F~!'#j/!9*0 3/5s$;F5M$'F5M$$3!&u  . &u - .sA.B 2B 8B B"!B") rr(r-rr>rrr rr) r@rrr(rzr|r>rmrs ` @@r&rrs(D\FJ(* $%.8 hh c5 !xxv%#((# S !& # _G!32 &s +**,JC#u%hh& #%'EJJf,D%**% 'yy dE "tyy'> dii '( : r%c |j}|j}|tur |d|znp|tur |d|zn[||}|,|r|t ||D]}t |||d|n(|d|zt |j} | s|r|rCt|jdD]$\} } | rd| z} |d| d t| d &| D]^\} } t| tr | j} t| tr|| j} n t| } |d || d | d `|s t|s|sA|d |r|t ||D]}t |||d||d |zd zn|d|jr|t |jyy)N rrc |dSNrr$xs r&rz _serialize_xml..hQqTr%rzr xmlns=""rr)r(r>rr _escape_cdata_serialize_xmllistrsorted_escape_attribr-rrCr?) rr@rrmrkwargsr(r>rfrvks r&rrRs ((C 99D g~ kD ! % % hoSk ;mD)*ua4HJ #) &E  &z'7'7'9+9!;1 #aA*1- !;"DAq!!U+FF!!U+"166N*1-&)Q78"s4y(<c --.A"5!VT8LNdSj3&'e  yy mDII&'r%>brhrcolimgwbrareabaselinkmetaembedframeinputparamtrackrisindexbasefontc |j}|j}|tur|dt|zn|tur|dt|znj||}|*|r|t||D]}t |||dn9|d|zt |j}|s|r|rCt|jdD]$\} } | rd| z} |d| dt| d &|D]^\} } t| tr | j} t| tr|| j} n t| } |d || d| d `|d |j} |r$| d k(s| d k(r ||n|t||D]}t |||d| tvr|d|zd z|jr|t|jyy)Nrr rc |dSr r$r s r&rz!_serialize_html..rr%rrrrrrrscriptstyler)r(r>rrr_serialize_htmlrrrrr-r_escape_attrib_htmlr HTML_EMPTYr?) rr@rrmrr(r>rfrrrltags r&r0r0s ((C 99D g~ kM$//0 % % ht,,-Sk ;mD)*q&$7 #) &E  &z'7'7'9+9!;1 #aA*1- !;"DAq!!U+FF!!U+"166N/2&)Q78" #J99;D8#tw$K--.q&$7:%dSj3&' yy mDII&'r%c||jD] }|| |jr||jyyr=)rr?)rr@parts r&rrs1  d   yy diir%)rhtmlr>ctjd|r tdttj D]\}}||k(s||k(st|=|t|<y)atRegister 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)rematchrrrr)rrrrs r&rrs[ xx 6"BCC^))+,1 8qF{q!-!N3r%rr6rdfwsdlxsxsidc)$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/cLtd|dt|jd)Nzcannot serialize z (type ))r/rer rs r&rrs! +/d1D1DE  r%c d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw)N&&r<r>replacer/rrrs r&rrso ) $;<<W-D $;<<V,D $;<<V,D ~ &)"4()AAA#"A#c| d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}d |vr|jd d }d |vr|jd d }d |vr|jd d}|S#ttf$rt|YywxYw)NrCrDrrErrFr" z rz  z rGrs r&rrs) $;<<W-D $;<<V,D $;<<V,D 4<<<h/D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sBBB;:B;c d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw)NrCrDrrFrrKrGrs r&r1r1sm ) $;<<W-D $;<<V,D 4<<<h/D ~ &)"4()rIT)rrrc|dk(rtjntj}t|j |||||||j S)a Generate 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. rrrrr)rStringIOBytesIOrrgetvalue)r*rrrrrstreams r&rr+sV ')3R[[]Fvx/>1B&,4H J ?? r%c.eZdZdZdZdZdZdZdZy)_ListDataStreamz7An auxiliary stream accumulating into a list reference.c||_yr=)lst)r3rXs r&r5z_ListDataStream.__init__Es r%cyrr$r8s r&rz_ListDataStream.writableHr%cyrr$r8s r&rz_ListDataStream.seekableKrZr%c:|jj|yr=)rXr[)r3bs r&rz_ListDataStream.writeNs r%c,t|jSr=)rCrXr8s r&rz_ListDataStream.tellQs488}r%N) r r!r"r#r5rrrrr$r%r&rVrVCsAr%rVc`g}t|}t|j|||||||S)NrP)rVrr)r*rrrrrrXrTs r&rrTsC C S !Fvx/>1B&,4H J Jr%ct|ts t|}|jtjd|j j }|r|ddk7r tjjdyy)a#Write 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)rrN)r-rrsysstdoutrr?)r@r?s r&rrasb dK (4 JJszzIJ. <<>  D 48t# $r%ct|tr|j}|dkrtd|t |syd|zzgfd|dy)a&Indent 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|dz} |}|jr|jjs||_|D]D}t |r |||j r|j jr>||_Fj js ||_yy#t$r|z}j|YwxYwr ) IndexErrorr[r>striprCr?)r@level child_levelchild_indentationchild_indent_children indentationsspaces r&rlz indent.._indent_childrensai  3 ,[ 9  yy  1)DIE5z  4::UZZ%5%5%7. zz!%e,EJ" 3 ,U 3e ;     1 2 3sB))"C C)r-rrrrC)treernrhrlrms ` @@r&rrtsb$ $||~ qyGwOPP t955=()L-,T1r%c>t}|j|||S)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 )rrros r&r r s =DJJvv Kr%ct||tdstddndfdGfddtjj }|}d |_tj||S) aJIncrementally 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\K jEd{|jd}|snj|>j}jEd{}|||_r|j yy7v7*#r|j wwxYww)Ni@) read_eventsrr_close_and_return_rootrootr)rrrwitr pullparserwrs r&iteratorziterparse..iterators %11333{{9-% 446D!--/ / /B~ 4 0  s?B,BBA B'B(B<B,BBB))B,cBeZdZWWjZfdZy)$iterparse..IterParseIteratorc,rjyyr=)r)r3rrs r&__del__z,iterparse..IterParseIterator.__del__s r%N)r r!r"__next__r)rr{rsr&IterParseIteratorr}sF#,, r%rN) rr)r collectionsabcIteratorrwweakrefref) rrrrrrxrr{ryrzs ` @@@@r&r r st"ff=J 66 "fd#  $KOO44  BBG RB Ir%c8eZdZd dddZdZdZdZdZdZy) rN)rsctj|_|xstt |_|d}|j j |j|y)Nr)end)rdeque _events_queuerrrs _setevents)r3rrrss r&r5zXMLPullParser.__init__sL )..0A);="A >F  2 2F;r%c|j td|r |jj|yy#t$r%}|jj |Yd}~yd}~wwxYw)Feed encoded data to parser.Nz!feed() called after end of stream)rsrr SyntaxErrorrr[)r3rexcs r&rzXMLPullParser.feeds` << @A A  / !!$'  /""))#.. /s8 A&A!!A&cH|jj}d|_|Sr=)rsr)r3rws r&rvz$XMLPullParser._close_and_return_roots ||!!#  r%c$|jy)zFinish feeding data to parser. Unlike XMLParser, does not return the root element. Use read_events() to consume elements from XMLPullParser. N)rvr8s r&rzXMLPullParser.closes ##%r%c#|K|j}|r*|j}t|tr|||r)yyw)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)rpopleftr- Exception)r3rrevents r&ruzXMLPullParser.read_eventss; ##NN$E%+  s7<<cf|j td|jjy)Nz"flush() called after end of stream)rsrflushr8s r&rzXMLPullParser.flush$s( << AB B r%r=) r r!r"r5rrvrrurr$r%r&rrs' rs r&rr*s+ +-0 KK <<>r%c|stt}|j||j}i}|j D]}|j d}|s|||<||fS)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. rr7)rrrrrry)r>rroidsr@r7s r&rr;sd +-0 KK <<>D C  XXd^ CG 9r%c~|stt}|D]}|j||jS)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)sequencerr>s r&rrSs5 +-0 D <<>r%cVeZdZdZdddddddZdZdZdZd Zd Z d Z dd Z d Z y)ra8Generic 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_piscg|_g|_d|_d|_d|_|t }||_||_|t}||_ ||_ |t}||_ yr=) _data_elem_lastr_tailr_comment_factoryrr _pi_factoryrr_factory)r3element_factoryrrrrs r&r5zTreeBuilder.__init__ysn      "%O /.  .J%$  "%O' r%c~t|jdk(sJd|jJd|jS)z;Flush builder buffers and return toplevel document Element.rzmissing end tagszmissing toplevel element)rCrrr8s r&rzTreeBuilder.closes>4::!#7%77#zz%A'AA%zzr%cL|jr|jdj|j}|jr/|jjJd||j_n.|jj Jd||j_g|_yy)Nrzinternal error (tail)zinternal error (text))rrjoinrr?r>r3r>s r&_flushzTreeBuilder._flushs ::zz%wwtzz*::::??2K4KK2&*DJJO::??2K4KK2&*DJJODJ r%c:|jj|y)zAdd text to current element.N)rr[r3rs r&rzTreeBuilder.datas $r%c|j|j||x|_}|jr|jdj |n|j ||_|jj |d|_|S)zOpen new element and return it. *tag* is the element name, *attrs* is a dict containing element attributes. rar)rrrrr[rr)r3r(attrsr@s r&startzTreeBuilder.startsp  MM#u55 T :: JJrN ! !$ ' ZZ DJ $  r%c|j|jj|_|jj|k(s"Jd|jjd|dd|_|jS)zOClose and return current Element. *tag* is the element name. zend tag mismatch (expected z, got rAr)rrpoprr(rrs r&rzTreeBuilder.endsa ZZ^^% zz~~$ (::>>3( ($ zzr%cP|j|j|j|S)z`Create a comment using the comment_factory. *text* is the text of the comment. )_handle_singlerrrs r&commentzTreeBuilder.comments* ""  ! !4#7#7? ?r%cR|j|j|j||S)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 ''. )rrr)r3rr>s r&pizTreeBuilder.pis* ""   doovt= =r%c||}|rH|j||_|jr|jdj|d|_|S)Nrar)rrrr[r)r3factoryrbargsr@s r&rzTreeBuilder._handle_singlesG~  KKMDJzz 2%%d+DJ r%r=) r r!r"r#r5rrrrrrrrr$r%r&rresC&(!%$!&5((  " ?=r%rc`eZdZdZddddZdZdZdZdZd Z d Z d Z d Z d Z dZdZy)raaElement 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)rrcJ ddlm}|j |d}| t }|x|_|_|x|_|_ |j|_ i|_ |j|_t|dr|j |_t|dr|j$|_t|dr|j(|_t|dr|j,|_t|d r|j0|_t|d r|j4|_t|d r|j8|_d |_d |_d|_ i|_! d |jDz|_#y#t$r" ddl}n#t$r tdwxYwYwxYw#tH$rYywxYw)Nrexpatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrstart_nsend_nsrrrrzExpat %d.%d.%d)% xml.parsersr ImportErrorpyexpat ParserCreaterrrsr_targeterror_error_names_defaultDefaultHandlerExpandr)_startStartElementHandler_endEndElementHandler _start_nsStartNamespaceDeclHandler_end_nsEndNamespaceDeclHandlerrCharacterDataHandlerrCommentHandlerrProcessingInstructionHandler buffer_textordered_attributes_doctypeentity version_infoversionr)r3rrrrs r&r5zXMLParser.__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;E(F( F2E76F7F  FF F"!F"c|j}|j}|D]}|dk(r d|_|||jfd}||_(|dk(r|||j fd}||_F|dk(r6t|jdr|||jfd}n||fd }||_ |d k(r6t|jd r|||jfd }n||fd }||_ |dk(r|||fd}||_ |dk(r|||fd}||_td|zy)Nrrc&|||||fyr=r$)r( attrib_inrr[rs r&handlerz%XMLParser._setevents..handler"sE5i#89:r%rc$||||fyr=r$)r(rr[rs r&rz%XMLParser._setevents..handler'sE3s8,-r%zstart-nsrc&|||||fyr=r$)rrrr[rs r&rz%XMLParser._setevents..handler.sx'<=>r%c,|||xsd|xsdffyNrr$)rrrr[s r&rz%XMLParser._setevents..handler2s "ciR'@ABr%zend-nsrc$||||fyr=r$)rrr[rs r&rz%XMLParser._setevents..handler8svf~67r%c||dfyr=r$)rrr[s r&rz%XMLParser._setevents..handler<st}-r%rcJ|||jj|fyr=)rr)r>rr[r3s r&rz%XMLParser._setevents..handler@sE4;;#6#6t#<=>r%rcL|||jj||fyr=)rr) pi_targetrrr[r3s r&rz%XMLParser._setevents..handlerDsE4;;>>)T#BCDr%zunknown event %r)rsr[rrrrrr)rrrrrrrr)r3 events_queueevents_to_reportrr[ event_namers r&rzXMLParser._seteventss5$$*JW$,-)2fC3:0x'4;;1.8'+||8/9.18.y((26?(/%t#3=f!%E7>3 !3j!@AAU+r%cxt|}|j|_|j|jf|_|r=)r codelinenooffsetposition)r3r|errs r& _raiseerrorzXMLParser._raiseerrorKs0::||U\\1  r%cz |j|}|S#t$r|}d|vrd|z}||j|<Y|SwxYw)Nrr)rKeyError)r3rznames r&_fixnamezXMLParser._fixnameQsU $;;s#D   $Dd{Tz#DKK   $s #::cJ|jj|xsd|xsdSr)rrr3rrs r&rzXMLParser._start_ns\s!{{##FLb#)<r data_handlerrrnrerpubidsystems r&rzXMLParser._defaultqsbq S= #{{//  T[[a45s]tBQx;6DM ]] &} $ ::{{   Q    KK 1 1+ >s)7A//B>BBBBB9)r r!r"r#r5rrrrrrrrrrrr$r%r&rrsN"&+Z3Bj =0 .34%l *"?r%r)out from_filec "| | tdd}|tjx}}tt |j fi|}|"|j ||jn| t||||jSdS)a3Convert 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) rrrQrrrrrr rS)xml_datarroptionssiors r&rrsI-UVV C {KKM!c .syyDGD EF H    i' _3<<>6$6r%z ^\w+:\w+$ceZdZdZdddddddddZefdZdZddZd Z d jfd Z d Z d Z ddZdZdZdZy)ra 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_tagsc2||_g|_||_||_|r t |nd|_|r t |nd|_||_|rt ||_nd|_|rt |j|_ nd|_ dgg|_ g|_ |s6|jjttj!|jjgi|_dg|_d|_d|_d|_d|_y)N)r?rFr)_writer_with_comments _strip_textr}_exclude_attrs _exclude_tags_rewrite_prefixes_qname_aware_tags intersection_find_qname_aware_attrs_declared_ns_stack _ns_stackr[rrr _prefix_map_preserve_space_pending_start _root_seen _root_done_ignored_depth) r3rr%r&r'r(r)r*r+s r&r5zC14NWriterTarget.__init__s  +%4Ac-0t2>S.D!1 %()9%:D "%)D " +./@+A+N+ND (+/D ( <$ #  NN ! !$~';';'="> ? b! %w"r%c#DK||D]}|s|Ed{y7wr=r$)r3ns_stack _reversedrms r&_iter_namespacesz!C14NWriterTarget._iter_namespaces(s$#H-J%%%.%s   c|jdd\}}|j|jD]\}}||k(s d|d|cStd|d|d)NrrrrzPrefix z of QName "" is not declared in scope)splitrAr7r)r3 prefixed_namerrrps r&_resolve_prefix_namez%C14NWriterTarget._resolve_prefix_name-sl$**32 ++DNN;FCF{C54&))<76(+m_D^_``r%c|%|dddk(r|ddjddnd|f\}}n|}t}|j|jD]/\}}||k(r||vr|r|d|n|||fcS|j |1|j ro||j vr|j |}n'dt|j x}|j |<|jdj||f|d|||fS|s d|vr|||fS|j|jD]:\}}||k(s |jdj||f|r|d|n|||fcS|s|||fStd|d ) Nrrrrrrraz Namespace "rC) rr}rAr6addr2r8rCr[r7r)r3rrr( prefixes_seenurs r&_qnamezC14NWriterTarget._qname4s ;38!93CuQRy''Q/"eHCC ..t/F/FGIAvCxF-7,2&3%(S#EE   f %H  ! !d&&&))#.34S9I9I5J4K1LL))#.  # #B ' . .V} =XQse$c3. .r.S= ..t~~>IAvCx''+22C=A,2&3%(S#EE? S= ;se+EFGGr%cT|js|jj|yyr=)r=rr[rs r&rzC14NWriterTarget.dataYs""" JJ  d ##r%rc||j}|jdd=|jr|jds|j}|j<|jdc}|_|r t |r|nd}|j g|||y|r(|jr|jt|yyyNra) rr/r9rgr:_looks_like_prefix_namerr;r-_escape_cdata_c14n)r3 _join_textrr qname_texts r&rzC14NWriterTarget._flush]s$**% JJqM   D$8$8$<::D   C/r%c |j4|r2|jDcic]\}}||jvs||}}}|h|}i}|'|j|x} ||<|j| |jX|rV|j |} | r@| D]:} || } t | s|j| x} || <|j| <nd} nd} |j } t|dDcic] }|| | }}|r.|Dcgc]\}}|rd|znd|f}}}|jng}|rVt|jD]:\}}| || vr||vr |||d}||\}} }|j|r|n| |f<|jd}|jj|r|dk(n|jd|j}|d ||dz|r:|d j|Dcgc]\}}d |d t|d c}}|d||t|||dd|_|j"jgycc}}wcc}wcc}}wcc}}w)Nc&|jddS)Nrr)rD)rs r&rz)C14NWriterTarget._start..s!''#q/r%rzxmlns:xmlnsrz+{http://www.w3.org/XML/1998/namespace}spacepreserverarrrrrrT)r0rrGrIr5rPrLrsortr[ryr9r-r_escape_attrib_c14nrQr;r7)r3r(rrVrSrrrresolved_namesrqattrs attr_namer| parse_qnamer parsed_qnamesrrr attr_qnamespace_behaviourrs r&rzC14NWriterTarget._starts    *u&+kkmTmdaq@S@S7SQTmET  !151J1J:1V VEN:. JJu   ' ' 311%8F!'I!),E.u58<8Q8QRW8XXu 5 5) "( Fkk 4: 153453qKN*53 4 $2#1KC'-F"'3?#1  NN I u{{}-1%!v+!~:M%nQ&78;A-:1-=* Is  *A!FG . ))$QR ##-*3M%Nq%QR S b!CU04 8UsI/I/3I5 I:Jc|jr|xjdzc_y|jr|j|jd|j |dd|j j t|j dk(|_|jj |jj y)Nrrrr) r=rrr-rLr9rrCr<r6r7rs r&rzC14NWriterTarget.ends      1 $   :: KKM bS)!,-Q/0   "d223q8 ##% r%c<|jsy|jry|jr|jdn(|jr|j r|j |jdt|d|js|jdyy)Nrz)r.r=r<r-r;rrrQrs r&rzC14NWriterTarget.commentsw""      ?? KK  __ KKM d-d34C89 KK r%c8|jry|jr|jdn(|jr|jr|j |j|rd|dt |dnd|d|js|jdyy)Nrz)r=r<r-r;rrrQ)r3rrs r&rzC14NWriterTarget.pis     ?? KK  __ KKM :>b,T232 6bPRO U KK r%r=)r r!r"r#r5reversedrArGrLrrrrrrrrrr$r%r&rrsj, %"&$#$# J4<& a#HJ$!# 210"C"J   r%rc d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw) NrCrDrrErrFrL rGrs r&rQrQs) $;<<W-D $;<<V,D $;<<V,D 4<<<g.D ~ &)"4()sAAA98A9cP d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}d |vr|jd d }d |vr|jd d }|S#ttf$rt|YywxYw) NrCrDrrErrKrMz rz rLrirGrs r&r\r\s) $;<<W-D $;<<V,D $;<<X.D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sBBB%$B%)r)_set_factoriesr=r)z r)@r#__all__rrbr8rIrrcollections.abcrrrrrr r rrrrr rrcontextmanagerrrrr2r0rrrrrrrr1rrrVrrrr r rrrrrrrrcompileUNICODEr9rPrrQr\rd _elementtreerkrr$r%r&rrs!P (       # ^^B $&$  +"+"`\/\/B /+/+b;z0(d 0(d    !*-2$*38(.(,16(, %3! ) )8 )!T"&0b''" !%&* &/l 5p77t",  $vvth?h?Z7tt7<%"**\2::>DDD)&). 3K+712  s E,,E43E4__pycache__/ElementPath.cpython-312.pyc000064400000035203152531516020013670 0ustar00 {|j7ddlZejdZddZdZdZdZdZdZd Z d Z d Z d Z eee e e e d Z iZGddZddZddZddZddZy)Nz`('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|!=|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@!=\s]+)|\s+c#jK|r|jdnd}d}tj|D]d}|\}}|rR|ddk7rJd|vr.|jdd\}} |st|d||d|fn|r|s |d|d|fn|d}\||d k(}fy#t$rt d|zdwxYww) NFr{:}z!prefix %r not found in prefix map@)getxpath_tokenizer_refindallsplitKeyError SyntaxError) pattern namespacesdefault_namespaceparsing_attributetokenttypetagprefixuris ./usr/lib64/python3.12/xml/etree/ElementPath.pyxpath_tokenizerrJs.8 r*d#++G4 s 3q6S=cz!iiQ/ ^%&Z-?!EEE#+<):C@@@ % K % %5 ^%&IF&RSY]]^sAB3B2%B3B00B3c|j}|4ix|_}|jjD]}|D]}|||< |SN) parent_maprootiter)contextrpes rget_parent_mapr#bsR##J*,,Z""$A ! 1 % c&|dddk(xs|dddk(S)N{*}}*rs r_is_wildcard_tagr,ls# r7e  /s23x4//r$c8ttcdk(rfd}|Sdk(rfd}|Sdddk(r+ddtt dddfd}|Sd dd k(r$dd tdtfd }|St d )Nz{*}*c3LK|D]}|js|ywrr+)r resultelem _isinstance_strs rselectz_prepare_tag..selectvs$txx.Js$$z{}*c3bK|D]%}|j}|s|ddk7s"|'yw)Nrrr+)r r/r0el_tagr1r2s rr3z_prepare_tag..select|s4vt,c1AJ ///r&r'c3lK|D]*}|j}|k(s|s|k(s'|,ywrr+) r r/r0r5r1r2no_nssuffixrs rr3z_prepare_tag..selects;S=K$=&-SYBYJs 444r(r)c3bK|D]%}|j}|s|k(s"|'ywrr+)r r/r0r5r1r2nsns_onlys rr3z_prepare_tag..selects4vt,B1FJr6zinternal parser error, got ) isinstancestrslicelen RuntimeError)rr3r1r2r9r=r>r:s` @@@@@@r _prepare_tagrDps"CK f} @ M9  4 M+ RaE QRs6{lD)!"g   M RST  "Xc"g&  M8>??r$cr|dtrtfd}|Sdddk(rddfd}|S)Nrc(d}|||S)Nc32K|D] }|Ed{y7wrr*)r/r0s r select_childz3prepare_child..select..select_childs"D#OO## r*r r/rH select_tags rr3zprepare_child..selects $g|F';< .selects+Auu|s' ')r,rDnextrr3rKrs @@r prepare_childrQsP (C!#&  = M r7d?ab'C Mr$c d}|S)Nc32K|D] }|Ed{y7wrr*)r r/r0s rr3zprepare_star..selectsDOO rIr*rPrr3s r prepare_starrUs Mr$c d}|S)Nc3$K|Ed{y7wrr*)r r/s rr3zprepare_self..selectss r*rTs r prepare_selfrXs  Mr$c |}|ddk(rdn|ds|dn tdtrtfd}|Sdddk(rddfd}|S#t$rYywxYw) Nr*rzinvalid descendantc(d}|||S)Nc3VK|D] }|jD] }||us| "ywrr)r/r0r"s rrHz8prepare_descendant..select..select_childs,"D!YY[D="#G)#s) )r*rJs rr3z"prepare_descendant..selects $ g|F';< .selects/3A}(s+ +) StopIterationrr,rDrOs @@rprepare_descendantr`s Qx3 1XAh.//!#&  = M r7d?ab'C M5 sA A)(A)c d}|S)Nc3dKt|}i}|D]}||vs||}||vsd||<|ywr)r#)r r/r result_mapr0parents rr3zprepare_parent..selectsH#G,  Dz!#D)+)-Jv& L s 0 0 0r*rTs rprepare_parentres ! Mr$c g}g} |}|ddk(rnL|dk(r|dr|ddddvr d|dddf}|j|dxsd|j|d]d j|}|d k(r |dfd }|S|d k(s|d k(r|d|d  fd} fd}d|vr|S|S|dk(r%tjd|ds |dfd}|S|dk(s(|dk(s#|dk(s|dk(rDtjd|ds+|d|d r  fd} fd}n fd} fd}d|vr|S|S|dk(s |dk(s|dk(ri|dk(r!t |ddz dkrGt d|ddk7r t d|dk(r" t |d dz d"kDr t d#dfd$}|St d%#t$rYywxYw#t$r t d!wxYw)&Nrr])rrz'"'r;-rz@-c3HK|D]}|j|ywrr )r r/r0keys rr3z!prepare_predicate..selects$88C=,J""z@-='z@-!='c3NK|D]}|jk(s|ywrrk)r r/r0rlvalues rr3z!prepare_predicate..selects&88C=E)Js%%c3XK|D] }|jx}|k7s|"ywrrk)r r/r0 attr_valuerlros rselect_negatedz)prepare_predicate..select_negateds0"&((3-/J<uATJs ***z!=z\-?\d+$c3HK|D]}|j|ywr)find)r r/r0rs rr3z!prepare_predicate..selects$99S>-Jrmz.='z.!='z-='z-!='c3K|D]@}|jD]*}dj|jk(s&|@BywNr)r joinitertextr r/r0r"rros rr3z!prepare_predicate..selectsC"D!\\#.771::<0E9"&J!/# .select_negated"sC"D!]]3/771::<0E9"&J!0#rzc3jK|D])}dj|jk(s&|+ywrvrwrxr r/r0ros rr3z!prepare_predicate..select)-"Dwwt}}/58" #(33c3jK|D])}dj|jk7s&|+ywrvr~rs rrrz)prepare_predicate..select_negated-rrz-()z-()-zXPath position >= 1 expectedlastzunsupported functionr7zunsupported expressionr(z)XPath offset from last() must be negativec3 Kt|}i}|D]J} ||}||jf}||vr$|j|j} |||<|||usG|Ly#t$rYYwxYw#t$rd||<Y.wxYwwr)r#rrr IndexError) r r/rcacher0rdrlelemsindexs rr3z!prepare_predicate..selectEs'0JE'-Ftxx(e#"NN4884E*%*5\c :%J &*%)c *sQBA!-B A0BB! A-*B,A--B0B>BBBzinvalid predicate)r_appendrwrematchintr ValueError) rPr signature predicater3rrrrlrros @@@@rprepare_predicaters|II  FE 8s?  H   8a! -q!B'EqS)q"  "IDl  Fi72l"   "&!2~>>CYq\ Bl  EY&0 % 9#6HHZ16l"   "  " # #"&!2~>>C9-f1D   ! %)Eqy!"@AA|v%!"899F"@ ! -1E2:%&QRR $ ) **[   h"@%&>??@sF6G6 GGG)rrZ.z..z//[ceZdZdZdZy)_SelectorContextNc||_yr)r)selfrs r__init__z_SelectorContext.__init__gs  r$)__name__ __module__ __qualname__rrr*r$rrres Jr$rc|dddk(r|dz}|f}|r%|tt|jz } t|}|g}t|}|D] } | ||} |S#t$rt tdkDrtj |dddk(r tdtt||j} |}n#t$rYYywxYwg} |jt|d||n#t$r tddwxYw |}|ddk(r|}n#t$rYnwxYwd|t|<Y wxYw) Nr;/rZdrz#cannot use absolute path on elementrz invalid path)tuplesorteditems_cacherrBclearrrr__next__r_ropsr) r0pathr cache_keyselectorrPrr/r r3s rr|r|osv BCyCczIU6*"2"2"4566 %)$2VFt$G( M9 % v;  LLN 8s?CD DOD*56?? FE    <E!H dE :;  <!.1t; < 8s? FE   %y-%sr A""A!EC  E CECE !DEDED32E3 D?<E>D?? EEc0tt|||dSr)rPr|r0rrs rrtrts tZ0$ 77r$c.tt|||Sr)listr|rs rr r s tZ0 11r$c tt|||}|jy|jS#t$r|cYSwxYwrv)rPr|textr_)r0rdefaultrs rfindtextrsEHT445 99 yy s"1 1 ??r)NN)rcompiler rr#r,rDrQrUrXr`rerrrrr|rtr rr*r$rrsv RZZ   -00&R&  > u+p        'X8 2 r$__pycache__/cElementTree.cpython-312.opt-2.pyc000064400000000275152531516020014777 0ustar00 {|jRddly))*N)xml.etree.ElementTree//usr/lib64/python3.12/xml/etree/cElementTree.pyrs $r__pycache__/__init__.cpython-312.opt-1.pyc000064400000000214152531516020014152 0ustar00 {|jEy)Nr+/usr/lib64/python3.12/xml/etree/__init__.pyrsr__pycache__/__init__.cpython-312.opt-2.pyc000064400000000214152531516020014153 0ustar00 {|jEy)Nr+/usr/lib64/python3.12/xml/etree/__init__.pyrsr__pycache__/ElementInclude.cpython-312.opt-2.pyc000064400000007625152531516020015326 0ustar00 {|j(ddlZddlmZddlmZdZedzZedzZdZGd d e Z Gd d e Z dd Z ddefdZ dZy)N) ElementTree)urljoinz!{http://www.w3.org/2001/XInclude}includefallbackc eZdZy)FatalIncludeErrorN__name__ __module__ __qualname__1/usr/lib64/python3.12/xml/etree/ElementInclude.pyr r Crr c eZdZy)LimitedRecursiveIncludeErrorNr rrrrrGrrrc|dk(r:t|d5}tj|j}ddd|S|sd}t|d|5}|j }ddd|S#1swYSxYw#1swYSxYw)NxmlrbzUTF-8r)encoding)openrparsegetrootread)hrefrrfiledatas rdefault_loaderr!Ws ~ $ $$T*224D K H $h /499;D0 K K0 Ks$A-A:-A7:Bc|d}n|dkrtd|zt|dr|j}|t}t ||||t y)Nrz;expected non-negative depth or None for 'max_depth', got %rr) ValueErrorhasattrrr!_includeset)elemloaderbase_url max_depths rrrusW QVYbbcctY||~ ~ T68Y6rcd}|t|kr||}|jtk(r|jd}|r t ||}|jdd}|dk(r||vrt d|z|dk(rt d|z|j||||} | t d|d|tj| } t| |||d z ||j||jr"| jxsd |jz| _ | ||<n|d k(r||||jd } | t d|d||jr| |jz } |r!||d z } | jxsd | z| _ n|jxsd | z|_ ||=t d |z|jtk(rt d|jzt||||||d z }|t|kryy)Nrrrrzrecursive include of %sz5maximum xinclude depth reached when including file %sz cannot load z as rtextrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))lentagXINCLUDE_INCLUDEgetrr raddcopyr&removetailr.XINCLUDE_FALLBACK) r(r)r*r+ _parent_hrefsierrnoder.s rr&r&s A c$i- G 55$ $55=Dx.EE'5)E~=(+,E,LMM>6ORVVXX!!$'dE*<+26>yyvtY]MJ$$T*66!%bAFF :DIQ&dE155+<=<+26>66AFFND!9D!%bD 8DI!%bD 8DIG'?%GUU' '#BQUUJ  Q)] C Qg c$i-r)N)r4r-r urllib.parserXINCLUDEr1r7DEFAULT_MAX_INCLUSION_DEPTH SyntaxErrorr rr!rr&rrrr@sff  .i'z)     #4 <1 76r__pycache__/cElementTree.cpython-312.pyc000064400000000275152531516020014037 0ustar00 {|jRddly))*N)xml.etree.ElementTree//usr/lib64/python3.12/xml/etree/cElementTree.pyrs $r__pycache__/ElementTree.cpython-312.opt-2.pyc000064400000173422152531516020014641 0ustar00 {|j!! gdZdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z Gdde Z dZGd d Zifd ZdBd ZdBd ZeZGddZGddZej,dZdBdZdZhdZdZdZeeedZdZddddddd d!Zee_d"Z d#Z!d$Z"d%Z#dCddd&d'd(Z$Gd)d*ejJZ&dCddd&d'd+Z'd,Z(dDd-Z)dBd.Z*dCd/Z+Gd0d1Z,dBd2Z-dBd3Z.e-Z/dBd4Z0Gd5d6Z1Gd7d8Z2dBddd9d:Z3ejhd;ejjjlZ7Gd<d=Z8d>Z9d?Z: eZ;dd@l<ddAl$rYywxYw)E)CommentdumpElement ElementTree fromstringfromstringlistindent iselement iterparseparse ParseErrorPIProcessingInstructionQName SubElementtostring tostringlist TreeBuilderVERSIONXMLXMLID XMLParser XMLPullParserregister_namespace canonicalizeC14NWriterTargetz1.3.0N) ElementPathceZdZ y)r N)__name__ __module__ __qualname__./usr/lib64/python3.12/xml/etree/ElementTree.pyr r ks  r$r c t|dS)Ntag)hasattr)elements r%r r ys< 7E ""r$ceZdZ dZ dZ dZ dZ ifdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZddZddZddZddZdZddZdZdZdZddZdZy)rNc t|ts"td|jj||_i|||_g|_y)Nzattrib must be dict, not ) isinstancedict TypeError __class__r r'attrib _children)selfr'r0extras r%__init__zElement.__init__sL&$'  )),- -))5) r$c`d|jj|jt|fzS)Nz<%s %r at %#x>)r/r r'idr2s r%__repr__zElement.__repr__s&4>>#:#:DHHbh"OOOr$c( |j||SN)r/)r2r'r0s r% makeelementzElement.makeelements ~~c6**r$c|j|j|j}|j|_|j|_||dd|Sr:)r;r'r0texttail)r2elems r%__copy__zElement.__copy__s@$++6II II Q r$c,t|jSr:)lenr1r7s r%__len__zElement.__len__s4>>""r$cjtjdtdt|jdk7S)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)warningswarnDeprecationWarningrBr1r7s r%__bool__zElement.__bool__s1  K 1   4>>"a''r$c |j|Sr:r1r2indexs r% __getitem__zElement.__getitem__s~~e$$r$ct|tr|D]}|j|n|j|||j|<yr:)r,slice_assert_is_elementr1)r2rOr)elts r% __setitem__zElement.__setitem__sB eU #'',  # #G , 'ur$c|j|=yr:rMrNs r% __delitem__zElement.__delitem__s NN5 !r$c^ |j||jj|yr:rSr1appendr2 subelements r%rZzElement.appends)   + j)r$cl |D].}|j||jj|0yr:rY)r2elementsr)s r%extendzElement.extends3  G  # #G , NN ! !' * r$c` |j||jj||yr:)rSr1insert)r2rOr\s r%razElement.inserts'6  + eZ0r$cft|ts!tdt|jzy)Nzexpected an Element, not %s)r, _Element_Pyr.typer )r2es r%rSzElement._assert_is_elements.![)9DGr7s r%rvz Element.clear?s.  $$ DIr$c< |jj||Sr:)r0get)r2keyrps r%rxz Element.getJs {{sG,,r$c$ ||j|<yr:)r0)r2ryvalues r%setz Element.setWs ! Cr$c8 |jjSr:)r0keysr7s r%r~z Element.keysas {{!!r$c8 |jjSr:)r0itemsr7s r%rz Element.itemsjs {{  ""r$c#K |dk(rd}||j|k(r||jD]}|j|Ed{y7w)N*)r'r1iter)r2r'res r%rz Element.iterusO  #:C ;$((c/JAvvc{ " " "sAA A A c#K |j}t|ts|y|j}|r||D]-}|j Ed{|j }|s*|/y7wr:)r'r,strr=itertextr>)r2r'tres r%rzElement.itertextse hh#s#  II GAzz| # #A  #sA A* A(A*!A*r:NN) r r!r"r'r0r=r>r4r8r;r@rCrKrPrUrWrZr_rarSrgrirnrrrtrvrxr|r~rrrr#r$r%rr~s( C F1 D D$&P +#(%(" *+1 N * 8 E ; < % -!" ##,r$rc Z i||}|j||}|j||Sr:)r;rZ)parentr'r0r3r)s r%rrs; ! % F  f-G MM' Nr$c4 tt}||_|Sr:)rrr=)r=r)s r%rrsgGGL Nr$cf tt}||_|r|jdz|z|_|S)N )rrr=)targetr=r)s r%rrs8+,GGL ||c)D0 Nr$cFeZdZ d dZdZdZdZdZdZdZ d Z d Z y) rNc&|rd|d|}||_y)N{}r=)r2 text_or_urir's r%r4zQName.__init__s &137K r$c|jSr:rr7s r%__str__z QName.__str__s yyr$cPd|jjd|jdS)N)r/r r=r7s r%r8zQName.__repr__s NN33TYY??r$c,t|jSr:)hashr=r7s r%__hash__zQName.__hash__sDIIr$crt|tr|j|jkS|j|kSr:r,rr=r2others r%__le__z QName.__le__. eU #99 * *yyE!!r$crt|tr|j|jkS|j|kSr:rrs r%__lt__z QName.__lt__. eU #99uzz) )yy5  r$crt|tr|j|jk\S|j|k\Sr:rrs r%__ge__z QName.__ge__rr$crt|tr|j|jkDS|j|kDSr:rrs r%__gt__z QName.__gt__rr$crt|tr|j|jk(S|j|k(Sr:rrs r%__eq__z QName.__eq__rr$r:) r r!r"r4rr8rrrrrrr#r$r%rrs5  @"!"!"r$rcneZdZ ddZdZdZddZddZddZddZ dd Z dd Z dd d d Z dZ y)rNc:||_|r|j|yyr:)_rootr )r2r)files r%r4zElementTree.__init__ s  JJt  r$c |jSr:rr7s r%getrootzElementTree.getroots/zzr$c ||_yr:r)r2r)s r%_setrootzElementTree._setroots  r$c d}t|dst|d}d} |Kt}t|dr5|j||_|j|r|j SS|j dx}r%|j||j dx}r%|j |_|j|r|j SS#|r|j wwxYw)NFreadrbT _parse_wholei)r(openrrrcloserfeed)r2sourceparser close_sourcedatas r%r zElementTree.parse!s  vv&&$'FL ~"6>2 "(!4!4V! r=r) _serialize ValueError _get_writerlower_serialize_textr _namespaces) r2file_or_filenameencodingxml_declarationdefault_namespacemethodrwritedeclared_encodingqnamesrl serializes r%rzElementTree.writes  .F : %069: :"% )8 48R@QO$,^^%2&,,.6KK%()tzz2%0=N%O" &v. %VZ/CE5 4 4s BCCc(|j|dS)Nr)r)r)r2rs r% write_c14nzElementTree.write_c14nszz$vz..r$rr:)NNNN)r r!r"r4rrr rrirnrrrtrrr#r$r%rrsZ   D $1,>,4,5." $ 3E $( 3Ej/r$rc#~K |j}|jdk(r|t|ddxsdfytj5}t |t jr|}nt |t jr1t j|}|j|jnFt j}d|_ ||_ |j|_ |j|_t j ||dd}|j|j|j|fdddy#t$rYXwxYw#1swYyxYw#t$rM|jdk(rd}t#|d|d 5}|j|fdddYy#1swYYyxYwwxYww) NrrrcyNTr#r#r$r%z_get_writer..sDr$xmlcharrefreplace )rerrorsnewlinew)rr)rrgetattr contextlib ExitStackr,ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletellAttributeError TextIOWrapperr)rrrstackrs r%rrs-+ && >> y (!1:tDOO O%%'5.0A0AB+D 0",,?,,-=>DNN4;;/,,.D$0DM!&DJ)9(A(A $4$9$9 ''19/B046 t{{+jj(**9('&*'(' ' >> y (H "C(,.15**h& &... 'sF= E$=F= B E"E .add_qname s .RayC 9++C3S#,>+//4F~!'#j/!9*0 3/5s$;F5M$'F5M$$3!&u  . &u - .sA.B 2B 8B B"!B") rr'r,rr=rrr rr) r?rrr'ryr{r=rlrs ` @@r%rrs(D\FJ(* $%.8 hh c5 !xxv%#((# S !& # _G!32 &s +**,JC#u%hh& #%'EJJf,D%**% 'yy dE "tyy'> dii '( : r$c |j}|j}|tur |d|znp|tur |d|zn[||}|,|r|t ||D]}t |||d|n(|d|zt |j} | s|r|rCt|jdD]$\} } | rd| z} |d| d t| d &| D]^\} } t| tr | j} t| tr|| j} n t| } |d || d | d `|s t|s|sA|d |r|t ||D]}t |||d||d |zd zn|d|jr|t |jyy)N rrc |dSNrr#xs r%rz _serialize_xml..hQqTr$ryr xmlns=""rr)r'r=rr _escape_cdata_serialize_xmllistrsorted_escape_attribr,rrBr>) rr?rrlrkwargsr'r=rervks r%rrRs ((C 99D g~ kD ! % % hoSk ;mD)*ua4HJ #) &E  &z'7'7'9+9!;1 #aA*1- !;"DAq!!U+FF!!U+"166N*1-&)Q78"s4y(<c --.A"5!VT8LNdSj3&'e  yy mDII&'r$>brhrcolimgwbrareabaselinkmetaembedframeinputparamtrackrisindexbasefontc |j}|j}|tur|dt|zn|tur|dt|znj||}|*|r|t||D]}t |||dn9|d|zt |j}|s|r|rCt|jdD]$\} } | rd| z} |d| dt| d &|D]^\} } t| tr | j} t| tr|| j} n t| } |d || d| d `|d |j} |r$| d k(s| d k(r ||n|t||D]}t |||d| tvr|d|zd z|jr|t|jyy)Nrrrc |dSr r#r s r%rz!_serialize_html..r r$rrrrrrrscriptstyler)r'r=rrr_serialize_htmlrrrrr,r_escape_attrib_htmlr HTML_EMPTYr>) rr?rrlrr'r=rerrrltags r%r/r/s ((C 99D g~ kM$//0 % % ht,,-Sk ;mD)*q&$7 #) &E  &z'7'7'9+9!;1 #aA*1- !;"DAq!!U+FF!!U+"166N/2&)Q78" #J99;D8#tw$K--.q&$7:%dSj3&' yy mDII&'r$c||jD] }|| |jr||jyyr:)rr>)rr?parts r%rrs1  d   yy diir$)rhtmlr=c tjd|r tdttj D]\}}||k(s||k(st|=|t|<y)Nzns\d+$z'Prefix format reserved for internal use)rematchrrrr)rrrrs r%rrs`  xx 6"BCC^))+,1 8qF{q!-!N3r$rr5rdfwsdlxsxsidc)$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/cLtd|dt|jd)Nzcannot serialize z (type ))r.rdr rs r%rrs! +/d1D1DE  r$c d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw)N&&r<r>replacer.rrrs r%rrso ) $;<<W-D $;<<V,D $;<<V,D ~ &)"4()AAA#"A#c| d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}d |vr|jd d }d |vr|jd d }d |vr|jd d}|S#ttf$rt|YywxYw)NrBrCrrDrrEr" z rz  z rFrs r%rrs) $;<<W-D $;<<V,D $;<<V,D 4<<<h/D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sBBB;:B;c d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw)NrBrCrrErrJrFrs r%r0r0sm ) $;<<W-D $;<<V,D 4<<<h/D ~ &)"4()rHT)rrrc |dk(rtjntj}t|j |||||||j S)Nrrrrr)rStringIOBytesIOrrgetvalue)r)rrrrrstreams r%rr+s[ ')3R[[]Fvx/>1B&,4H J ?? r$c,eZdZ dZdZdZdZdZy)_ListDataStreamc||_yr:)lst)r2rWs r%r4z_ListDataStream.__init__Es r$cyrr#r7s r%rz_ListDataStream.writableHr$cyrr#r7s r%rz_ListDataStream.seekableKrYr$c:|jj|yr:)rWrZ)r2bs r%rz_ListDataStream.writeNs r$c,t|jSr:)rBrWr7s r%rz_ListDataStream.tellQs488}r$N)r r!r"r4rrrrr#r$r%rUrUCsAr$rUc`g}t|}t|j|||||||S)NrO)rUrr)r)rrrrrrWrSs r%rrTsC C S !Fvx/>1B&,4H J Jr$c t|ts t|}|jtjd|j j }|r|ddk7r tjjdyy)Nr)rr)r,rrsysstdoutrr>)r?r>s r%rrasg dK (4 JJszzIJ. <<>  D 48t# $r$c t|tr|j}|dkrtd|t |syd|zzgfd|dy)Nrz,Initial indentation level must be >= 0, got rc|dz} |}|jr|jjs||_|D]D}t |r |||j r|j jr>||_Fj js ||_yy#t$r|z}j|YwxYwr ) IndexErrorrZr=striprBr>)r?level child_levelchild_indentationchild_indent_children indentationsspaces r%rkz indent.._indent_childrensai  3 ,[ 9  yy  1)DIE5z  4::UZZ%5%5%7. zz!%e,EJ" 3 ,U 3e ;     1 2 3sB))"C C)r,rrrrB)treermrgrkrls ` @@r%rrtsg $ $||~ qyGwOPP t955=()L-,T1r$c@ t}|j|||Sr:)rr )rrrns r%r r s# =DJJvv Kr$c t||tdstddndfdGfddtjj }|}d|_tj||S) N)events_parserrrTFc3\K jEd{|jd}|snj|>j}jEd{}|||_r|j yy7v7*#r|j wwxYww)Ni@) read_eventsrr_close_and_return_rootrootr)rrrvitr pullparserwrs r%iteratorziterparse..iterators %11333{{9-% 446D!--/ / /B~ 4 0  s?B,BBA B'B(B<B,BBB))B,cBeZdZWWjZfdZy)$iterparse..IterParseIteratorc,rjyyr:)r)r2rrs r%__del__z,iterparse..IterParseIterator.__del__s r$N)r r!r"__next__r~)rrzrsr%IterParseIteratorr|sF#,, r$r) rr(r collectionsabcIteratorrvweakrefref) rrqrrrwrrzrxrys ` @@@@r%r r sy  ff=J 66 "fd#  $KOO44  BBG RB Ir$c8eZdZd dddZdZdZdZdZdZy) rN)rrctj|_|xstt |_|d}|j j |j|y)Nr)end)rdeque _events_queuerrrr _setevents)r2rqrrs r%r4zXMLPullParser.__init__sL )..0A);="A >F  2 2F;r$c |j td|r |jj|yy#t$r%}|jj |Yd}~yd}~wwxYw)Nz!feed() called after end of stream)rrrr SyntaxErrorrrZ)r2rexcs r%rzXMLPullParser.feedsc* << @A A  / !!$'  /""))#.. /s9 A'A""A'cH|jj}d|_|Sr:)rrr)r2rvs r%ruz$XMLPullParser._close_and_return_roots ||!!#  r$c& |jyr:)rur7s r%rzXMLPullParser.closes ##%r$c#~K |j}|r*|j}t|tr|||r)yywr:)rpopleftr, Exception)r2rqevents r%rtzXMLPullParser.read_eventss@ ##NN$E%+  s8==cf|j td|jjy)Nz"flush() called after end of stream)rrrflushr7s r%rzXMLPullParser.flush$s( << AB B r$r:) r r!r"r4rrurrtrr#r$r%rrs' r$c |stt}|j||j}i}|j D]}|j d}|s|||<||fS)Nrr6)rrrrrrx)r=rrnidsr?r6s r%rr;si +-0 KK <<>D C  XXd^ CG 9r$c |stt}|D]}|j||jSrr)sequencerr=s r%rrSs: +-0 D <<>r$cTeZdZ d ddddddZdZdZdZdZd Zd Z d d Z d Z y)rNF)comment_factory pi_factoryinsert_comments insert_piscg|_g|_d|_d|_d|_|t }||_||_|t}||_ ||_ |t}||_ yr:) _data_elem_lastr_tailr_comment_factoryrr _pi_factoryrr_factory)r2element_factoryrrrrs r%r4zTreeBuilder.__init__ysn      "%O /.  .J%$  "%O' r$c |jSr:rr7s r%rzTreeBuilder.closesIzzr$c|jr^|jJdj|j}|jr||j_n||j_g|_yyNr)rrjoinrr>r=r2r=s r%_flushzTreeBuilder._flushsP ::zz%wwtzz*::&*DJJO'+DJJODJ r$c< |jj|yr:)rrZr2rs r%rzTreeBuilder.datas* $r$c |j|j||x|_}|jr|jdj |n|j ||_|jj |d|_|S)Nr`r)rrrrrZrr)r2r'attrsr?s r%startzTreeBuilder.startsu  MM#u55 T :: JJrN ! !$ ' ZZ DJ $  r$c |j|jj|_d|_|jSr )rrpoprrrs r%rzTreeBuilder.ends7 ZZ^^%  zzr$cR |j|j|j|Sr:)_handle_singlerrrs r%commentzTreeBuilder.comments/ ""  ! !4#7#7? ?r$cT |j|j|j||Sr:)rrr)r2rr=s r%pizTreeBuilder.pis/ ""   doovt= =r$c||}|rH|j||_|jr|jdj|d|_|S)Nr`r)rrrrZr)r2factoryraargsr?s r%rzTreeBuilder._handle_singlesG~  KKMDJzz 2%%d+DJ r$r:) r r!r"r4rrrrrrrrr#r$r%rresC&(!%$!&5((  " ?=r$rc^eZdZ ddddZdZdZdZdZdZd Z d Z d Z d Z d Z dZy)rN)rrcJ ddlm}|j |d}| t }|x|_|_|x|_|_ |j|_ i|_ |j|_t|dr|j |_t|dr|j$|_t|dr|j(|_t|dr|j,|_t|d r|j0|_t|d r|j4|_t|d r|j8|_d |_d |_d|_ i|_! d |jDz|_#y#t$r" ddl}n#t$r tdwxYwYwxYw#tH$rYywxYw)Nrexpatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrstart_nsend_nsrrrrzExpat %d.%d.%d)% xml.parsersr ImportErrorpyexpat ParserCreaterrrrr_targeterror_error_names_defaultDefaultHandlerExpandr(_startStartElementHandler_endEndElementHandler _start_nsStartNamespaceDeclHandler_end_nsEndNamespaceDeclHandlerrCharacterDataHandlerrCommentHandlerrProcessingInstructionHandler buffer_textordered_attributes_doctypeentity version_infoversionr)r2rrrrs r%r4zXMLParser.__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;E(F( F2E76F7F  FF F"!F"c|j}|j}|D]}|dk(r d|_|||jfd}||_(|dk(r|||j fd}||_F|dk(r6t|jdr|||jfd}n||fd }||_ |d k(r6t|jd r|||jfd }n||fd }||_ |dk(r|||fd}||_ |dk(r|||fd}||_td|zy)Nrrc&|||||fyr:r#)r' attrib_inrrZrs r%handlerz%XMLParser._setevents..handler"sE5i#89:r$rc$||||fyr:r#)r'rrZrs r%rz%XMLParser._setevents..handler'sE3s8,-r$zstart-nsrc&|||||fyr:r#)rrrrZrs r%rz%XMLParser._setevents..handler.sx'<=>r$c,|||xsd|xsdffyrr#)rrrrZs r%rz%XMLParser._setevents..handler2s "ciR'@ABr$zend-nsrc$||||fyr:r#)rrrZrs r%rz%XMLParser._setevents..handler8svf~67r$c||dfyr:r#)rrrZs r%rz%XMLParser._setevents..handler<st}-r$rcJ|||jj|fyr:)rr)r=rrZr2s r%rz%XMLParser._setevents..handler@sE4;;#6#6t#<=>r$rcL|||jj||fyr:)rr) pi_targetrrrZr2s r%rz%XMLParser._setevents..handlerDsE4;;>>)T#BCDr$zunknown event %r)rrrZrrrrrr(rrrrrrrr)r2 events_queueevents_to_reportrrZ event_namers r%rzXMLParser._seteventss5$$*JW$,-)2fC3:0x'4;;1.8'+||8/9.18.y((26?(/%t#3=f!%E7>3 !3j!@AAU+r$cxt|}|j|_|j|jf|_|r:)r codelinenooffsetposition)r2r{errs r% _raiseerrorzXMLParser._raiseerrorKs0::||U\\1  r$cz |j|}|S#t$r|}d|vrd|z}||j|<Y|SwxYw)Nrr)rKeyError)r2rynames r%_fixnamezXMLParser._fixnameQsU $;;s#D   $Dd{Tz#DKK   $s #::cJ|jj|xsd|xsdSr)rrr2rrs r%rzXMLParser._start_ns\s!{{##FLb#)<;B =A>>B Bcx|jj} |jjd|jjdd|jj|y#|j$r}|j |Yd}~Ad}~wwxYw#|jj|wxYw)NFr$)rGetReparseDeferralEnabledSetReparseDeferralEnabledrrr)r2 was_enabledrs r%rzXMLParser.flushskk;;=  ? KK 1 1% 8 KK  c5 ) KK 1 1+ >{{   Q    KK 1 1+ >s)7A//B>BBBBB9)r r!r"r4rrrrrrrrrrrr#r$r%rrsN"&+Z3Bj =0 .34%l *"?r$r)out from_filec $ | | tdd}|tjx}}tt |j fi|}|"|j ||jn| t||||jSdS)Nz:Either 'xml_data' or 'from_file' must be provided as inputr)r) rrrPrrrrrr rR)xml_datarroptionssiors r%rrs I-UVV C {KKM!c .syyDGD EF H    i' _3<<>6$6r$z ^\w+:\w+$ceZdZ dddddddddZefdZdZddZdZd jfd Z d Z d Z dd Z dZdZdZy)rFN) with_comments strip_textrewrite_prefixesqname_aware_tagsqname_aware_attrs exclude_attrs exclude_tagsc2||_g|_||_||_|r t |nd|_|r t |nd|_||_|rt ||_nd|_|rt |j|_ nd|_ dgg|_ g|_ |s6|jjttj!|jjgi|_dg|_d|_d|_d|_d|_y)N)r>rFr)_writer_with_comments _strip_textr|_exclude_attrs _exclude_tags_rewrite_prefixes_qname_aware_tags intersection_find_qname_aware_attrs_declared_ns_stack _ns_stackrZrrr _prefix_map_preserve_space_pending_start _root_seen _root_done_ignored_depth) r2rr$r%r&r'r(r)r*s r%r4zC14NWriterTarget.__init__s  +%4Ac-0t2>S.D!1 %()9%:D "%)D " +./@+A+N+ND (+/D ( <$ #  NN ! !$~';';'="> ? b! %w"r$c#DK||D]}|s|Ed{y7wr:r#)r2ns_stack _reversedrls r%_iter_namespacesz!C14NWriterTarget._iter_namespaces(s$#H-J%%%.%s   c|jdd\}}|j|jD]\}}||k(s d|d|cStd|d|d)NrrrrzPrefix z of QName "" is not declared in scope)splitr@r6r)r2 prefixed_namerrrps r%_resolve_prefix_namez%C14NWriterTarget._resolve_prefix_name-sl$**32 ++DNN;FCF{C54&))<76(+m_D^_``r$c|%|dddk(r|ddjddnd|f\}}n|}t}|j|jD]/\}}||k(r||vr|r|d|n|||fcS|j |1|j ro||j vr|j |}n'dt|j x}|j |<|jdj||f|d|||fS|s d|vr|||fS|j|jD]:\}}||k(s |jdj||f|r|d|n|||fcS|s|||fStd|d ) Nrrrrrrr`z Namespace "rB) rr|r@r5addr1r7rBrZr6r)r2rrr' prefixes_seenurs r%_qnamezC14NWriterTarget._qname4s ;38!93CuQRy''Q/"eHCC ..t/F/FGIAvCxF-7,2&3%(S#EE   f %H  ! !d&&&))#.34S9I9I5J4K1LL))#.  # #B ' . .V} =XQse$c3. .r.S= ..t~~>IAvCx''+22C=A,2&3%(S#EE? S= ;se+EFGGr$cT|js|jj|yyr:)r<rrZrs r%rzC14NWriterTarget.dataYs""" JJ  d ##r$rc||j}|jdd=|jr|jds|j}|j<|jdc}|_|r t |r|nd}|j g|||y|r(|jr|jt|yyyNr`) rr.r8rfr9_looks_like_prefix_namerr:r,_escape_cdata_c14n)r2 _join_textrr qname_texts r%rzC14NWriterTarget._flush]s$**% JJqM   D$8$8$<::D   C/r$c |j4|r2|jDcic]\}}||jvs||}}}|h|}i}|'|j|x} ||<|j| |jX|rV|j |} | r@| D]:} || } t | s|j| x} || <|j| <nd} nd} |j } t|dDcic] }|| | }}|r.|Dcgc]\}}|rd|znd|f}}}|jng}|rVt|jD]:\}}| || vr||vr |||d}||\}} }|j|r|n| |f<|jd}|jj|r|dk(n|jd|j}|d ||dz|r:|d j|Dcgc]\}}d |d t|d c}}|d||t|||dd|_|j"jgycc}}wcc}wcc}}wcc}}w)Nc&|jddS)Nrr)rC)rs r%rz)C14NWriterTarget._start..s!''#q/r$rzxmlns:xmlnsrz+{http://www.w3.org/XML/1998/namespace}spacepreserver`rrrrrrT)r/rrFrHr4rOrKrsortrZrxr8r,r_escape_attrib_c14nrPr:r6)r2r'rrUrRrrrresolved_namesrqattrs attr_namer{ parse_qnamer parsed_qnamesrrr attr_qnamespace_behaviourrs r%rzC14NWriterTarget._starts    *u&+kkmTmdaq@S@S7SQTmET  !151J1J:1V VEN:. JJu   ' ' 311%8F!'I!),E.u58<8Q8QRW8XXu 5 5) "( Fkk 4: 153453qKN*53 4 $2#1KC'-F"'3?#1  NN I u{{}-1%!v+!~:M%nQ&78;A-:1-=* Is  *A!FG . ))$QR ##-*3M%Nq%QR S b!CU04 8UsI/I/3I5 I:Jc|jr|xjdzc_y|jr|j|jd|j |dd|j j t|j dk(|_|jj |jj y)Nrrrr) r<rrr,rKr8rrBr;r5r6rs r%rzC14NWriterTarget.ends      1 $   :: KKM bS)!,-Q/0   "d223q8 ##% r$c<|jsy|jry|jr|jdn(|jr|j r|j |jdt|d|js|jdyy)Nrz)r-r<r;r,r:rrrPrs r%rzC14NWriterTarget.commentsw""      ?? KK  __ KKM d-d34C89 KK r$c8|jry|jr|jdn(|jr|jr|j |j|rd|dt |dnd|d|js|jdyy)Nrz)r<r;r,r:rrrP)r2rrs r%rzC14NWriterTarget.pis     ?? KK  __ KKM :>b,T232 6bPRO U KK r$r:)r r!r"r4reversedr@rFrKrrrrrrrrrr#r$r%rrsj, %"&$#$# J4<& a#HJ$!# 210"C"J   r$rc d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw) NrBrCrrDrrErK rFrs r%rPrPs) $;<<W-D $;<<V,D $;<<V,D 4<<<g.D ~ &)"4()sAAA98A9cP d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}d |vr|jd d }d |vr|jd d }|S#ttf$rt|YywxYw) NrBrCrrDrrJrLz rz rKrhrFrs r%r[r[s) $;<<W-D $;<<V,D $;<<X.D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sBBB%$B%)r)_set_factoriesr:r)z r)?__all__rrar7rHrrcollections.abcrrrrrr r rrrrr rrcontextmanagerrrrr1r/rrrrrrrr0rrrUrrrr r rrrrrrrrcompileUNICODEr8rOrrPr[rc _elementtreerjrr#r$r%rqs!P (       # ^^B $&$  +"+"`\/\/B /+/+b;z0(d 0(d    !*-2$*38(.(,16(, %3! ) )8 )!T"&0b''" !%&* &/l 5p77t",  $vvth?h?Z7tt7<%"**\2::>DDD)&). 3K+712  s E++E32E3__pycache__/ElementPath.cpython-312.opt-2.pyc000064400000035203152531516020014630 0ustar00 {|j7ddlZejdZddZdZdZdZdZdZd Z d Z d Z d Z eee e e e d Z iZGddZddZddZddZddZy)Nz`('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|!=|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@!=\s]+)|\s+c#jK|r|jdnd}d}tj|D]d}|\}}|rR|ddk7rJd|vr.|jdd\}} |st|d||d|fn|r|s |d|d|fn|d}\||d k(}fy#t$rt d|zdwxYww) NFr{:}z!prefix %r not found in prefix map@)getxpath_tokenizer_refindallsplitKeyError SyntaxError) pattern namespacesdefault_namespaceparsing_attributetokenttypetagprefixuris ./usr/lib64/python3.12/xml/etree/ElementPath.pyxpath_tokenizerrJs.8 r*d#++G4 s 3q6S=cz!iiQ/ ^%&Z-?!EEE#+<):C@@@ % K % %5 ^%&IF&RSY]]^sAB3B2%B3B00B3c|j}|4ix|_}|jjD]}|D]}|||< |SN) parent_maprootiter)contextrpes rget_parent_mapr#bsR##J*,,Z""$A ! 1 % c&|dddk(xs|dddk(S)N{*}}*rs r_is_wildcard_tagr,ls# r7e  /s23x4//r$c8ttcdk(rfd}|Sdk(rfd}|Sdddk(r+ddtt dddfd}|Sd dd k(r$dd tdtfd }|St d )Nz{*}*c3LK|D]}|js|ywrr+)r resultelem _isinstance_strs rselectz_prepare_tag..selectvs$txx.Js$$z{}*c3bK|D]%}|j}|s|ddk7s"|'yw)Nrrr+)r r/r0el_tagr1r2s rr3z_prepare_tag..select|s4vt,c1AJ ///r&r'c3lK|D]*}|j}|k(s|s|k(s'|,ywrr+) r r/r0r5r1r2no_nssuffixrs rr3z_prepare_tag..selects;S=K$=&-SYBYJs 444r(r)c3bK|D]%}|j}|s|k(s"|'ywrr+)r r/r0r5r1r2nsns_onlys rr3z_prepare_tag..selects4vt,B1FJr6zinternal parser error, got ) isinstancestrslicelen RuntimeError)rr3r1r2r9r=r>r:s` @@@@@@r _prepare_tagrDps"CK f} @ M9  4 M+ RaE QRs6{lD)!"g   M RST  "Xc"g&  M8>??r$cr|dtrtfd}|Sdddk(rddfd}|S)Nrc(d}|||S)Nc32K|D] }|Ed{y7wrr*)r/r0s r select_childz3prepare_child..select..select_childs"D#OO## r*r r/rH select_tags rr3zprepare_child..selects $g|F';< .selects+Auu|s' ')r,rDnextrr3rKrs @@r prepare_childrQsP (C!#&  = M r7d?ab'C Mr$c d}|S)Nc32K|D] }|Ed{y7wrr*)r r/r0s rr3zprepare_star..selectsDOO rIr*rPrr3s r prepare_starrUs Mr$c d}|S)Nc3$K|Ed{y7wrr*)r r/s rr3zprepare_self..selectss r*rTs r prepare_selfrXs  Mr$c |}|ddk(rdn|ds|dn tdtrtfd}|Sdddk(rddfd}|S#t$rYywxYw) Nr*rzinvalid descendantc(d}|||S)Nc3VK|D] }|jD] }||us| "ywrr)r/r0r"s rrHz8prepare_descendant..select..select_childs,"D!YY[D="#G)#s) )r*rJs rr3z"prepare_descendant..selects $ g|F';< .selects/3A}(s+ +) StopIterationrr,rDrOs @@rprepare_descendantr`s Qx3 1XAh.//!#&  = M r7d?ab'C M5 sA A)(A)c d}|S)Nc3dKt|}i}|D]}||vs||}||vsd||<|ywr)r#)r r/r result_mapr0parents rr3zprepare_parent..selectsH#G,  Dz!#D)+)-Jv& L s 0 0 0r*rTs rprepare_parentres ! Mr$c g}g} |}|ddk(rnL|dk(r|dr|ddddvr d|dddf}|j|dxsd|j|d]d j|}|d k(r |dfd }|S|d k(s|d k(r|d|d  fd} fd}d|vr|S|S|dk(r%tjd|ds |dfd}|S|dk(s(|dk(s#|dk(s|dk(rDtjd|ds+|d|d r  fd} fd}n fd} fd}d|vr|S|S|dk(s |dk(s|dk(ri|dk(r!t |ddz dkrGt d|ddk7r t d|dk(r" t |d dz d"kDr t d#dfd$}|St d%#t$rYywxYw#t$r t d!wxYw)&Nrr])rrz'"'r;-rz@-c3HK|D]}|j|ywrr )r r/r0keys rr3z!prepare_predicate..selects$88C=,J""z@-='z@-!='c3NK|D]}|jk(s|ywrrk)r r/r0rlvalues rr3z!prepare_predicate..selects&88C=E)Js%%c3XK|D] }|jx}|k7s|"ywrrk)r r/r0 attr_valuerlros rselect_negatedz)prepare_predicate..select_negateds0"&((3-/J<uATJs ***z!=z\-?\d+$c3HK|D]}|j|ywr)find)r r/r0rs rr3z!prepare_predicate..selects$99S>-Jrmz.='z.!='z-='z-!='c3K|D]@}|jD]*}dj|jk(s&|@BywNr)r joinitertextr r/r0r"rros rr3z!prepare_predicate..selectsC"D!\\#.771::<0E9"&J!/# .select_negated"sC"D!]]3/771::<0E9"&J!0#rzc3jK|D])}dj|jk(s&|+ywrvrwrxr r/r0ros rr3z!prepare_predicate..select)-"Dwwt}}/58" #(33c3jK|D])}dj|jk7s&|+ywrvr~rs rrrz)prepare_predicate..select_negated-rrz-()z-()-zXPath position >= 1 expectedlastzunsupported functionr7zunsupported expressionr(z)XPath offset from last() must be negativec3 Kt|}i}|D]J} ||}||jf}||vr$|j|j} |||<|||usG|Ly#t$rYYwxYw#t$rd||<Y.wxYwwr)r#rrr IndexError) r r/rcacher0rdrlelemsindexs rr3z!prepare_predicate..selectEs'0JE'-Ftxx(e#"NN4884E*%*5\c :%J &*%)c *sQBA!-B A0BB! A-*B,A--B0B>BBBzinvalid predicate)r_appendrwrematchintr ValueError) rPr signature predicater3rrrrlrros @@@@rprepare_predicaters|II  FE 8s?  H   8a! -q!B'EqS)q"  "IDl  Fi72l"   "&!2~>>CYq\ Bl  EY&0 % 9#6HHZ16l"   "  " # #"&!2~>>C9-f1D   ! %)Eqy!"@AA|v%!"899F"@ ! -1E2:%&QRR $ ) **[   h"@%&>??@sF6G6 GGG)rrZ.z..z//[ceZdZdZdZy)_SelectorContextNc||_yr)r)selfrs r__init__z_SelectorContext.__init__gs  r$)__name__ __module__ __qualname__rrr*r$rrres Jr$rc|dddk(r|dz}|f}|r%|tt|jz } t|}|g}t|}|D] } | ||} |S#t$rt tdkDrtj |dddk(r tdtt||j} |}n#t$rYYywxYwg} |jt|d||n#t$r tddwxYw |}|ddk(r|}n#t$rYnwxYwd|t|<Y wxYw) Nr;/rZdrz#cannot use absolute path on elementrz invalid path)tuplesorteditems_cacherrBclearrrr__next__r_ropsr) r0pathr cache_keyselectorrPrr/r r3s rr|r|osv BCyCczIU6*"2"2"4566 %)$2VFt$G( M9 % v;  LLN 8s?CD DOD*56?? FE    <E!H dE :;  <!.1t; < 8s? FE   %y-%sr A""A!EC  E CECE !DEDED32E3 D?<E>D?? EEc0tt|||dSr)rPr|r0rrs rrtrts tZ0$ 77r$c.tt|||Sr)listr|rs rr r s tZ0 11r$c tt|||}|jy|jS#t$r|cYSwxYwrv)rPr|textr_)r0rdefaultrs rfindtextrsEHT445 99 yy s"1 1 ??r)NN)rcompiler rr#r,rDrQrUrXr`rerrrrr|rtr rr*r$rrsv RZZ   -00&R&  > u+p        'X8 2 r$