JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr ԓg0HbdZddlmZddlmZddlmZddlmZe Z ddl Z e e ee jdddkrdd lmZ dd lmZd Zd Zd ZGddeZGddZdeddddfdZddZ ddZ ddZedk(rnddlZddl Z ejBjDZ!ejFjDZ#ejJdd\Z&ee&Z&dZ' ee!e&e'e Z(e&dk(r e'ge(yyy#e$$rejBZ!ejFZ#YYwxYw#e)$rYywxYw) z:Makes working with XML feel like you are working with JSON)expat) XMLGenerator)AttributesImpl)StringION)) OrderedDict) isgeneratorz Martin Blechz0.14.2MITc eZdZy)ParsingInterruptedN)__name__ __module__ __qualname__8/opt/hc_python/lib/python3.12/site-packages/xmltodict.pyrrsrrcheZdZddddddddedd ddd fd Zd Zd ZdZdZdZ dZ dZ dZ dZ y)_DictSAXHandlerrcyNTr)argss rz_DictSAXHandler.sTrT@#textFN:z#commentcg|_g|_g|_d|_||_||_||_||_||_||_ ||_ ||_ | |_ | |_ | |_| |_| |_| |_||_yN)pathstackdataitem item_depth xml_attribs item_callback attr_prefix cdata_key force_cdatacdata_separator postprocessordict_constructorstrip_whitespacenamespace_separator namespacesnamespace_declarations force_list comment_key)selfr%r'r&r(r)r*r+r,r-r.r/r0r2r3s r__init__z_DictSAXHandler.__init__s    $&*&"&.* 0 0#6 $&6&8#$&rc|j|S|j|j}|dk(r|S|d|||dzd}} |j|}|s|S|jj ||fS#t$r|}Y.wxYw)N)r0rfindr/KeyErrorjoin)r4 full_namei namespacenameshort_namespaces r _build_namez_DictSAXHandler._build_name=s ?? "  OOD44 5 7 #BQ-1Q344  ("ooi8OK++00/41HI I  ('O (sA// A=<A=c tt|tr|S|jt|ddd|dddS)Nrrr8) isinstancedictr-zip)r4attrss r_attrs_to_dictz_DictSAXHandler._attrs_to_dictMs= eT "L$$Sqt!teADqDk%BCCrc*||j|xsd<y)Nr)r1)r4prefixuris rstartNamespaceDeclz"_DictSAXHandler.startNamespaceDeclRs47##FLb1rc|j|}|j|}|r0|jr$|j|d<|j|_|jj ||xsdft |j|jk\r|jj |j|jf|jrg}|jD]e\}}|j|j|z}|jr|j|j||}n||f}|sU|j |g|j|}nd}|xsd|_ g|_ yy)Nxmlns)rArGr1r-r!appendlenr%r"r$r#r&itemsr(r,)r4r<rFr? attr_entrieskeyvalueentrys r startElementz_DictSAXHandler.startElementUsA *##E* T00!88E'N*.*?*?*AD ' $ ./ tyy>T__ , JJ  tyy$))4 5! "'++-JC**4+;+;C+@@C)) $ 2 2499c5 I!$e $++E2#0--l; DIDI! -rc|j|}t|j|jk(re|j}|3|j sdn$|j j|j }|j|j|}|st|jr|j sdn$|j j|j }|j}|jj\|_|_|jr|r|jxsd}|r|jr||j}|B|r|j!||j"||j!|j|||_n1|j!|j|||_nd|_g|_|jjyr )rArOr!r%r$r#r+r;r'rr"popr.stripr*r- push_datar))r4r<r?r$should_continuer#s r endElementz_DictSAXHandler.endElementnsj * tyy>T__ ,99D|$(II!1166tyyA#00DAO"(( :: $ D--22499= 99D#'::>>#3 DIty$$zz|+t((T\,,.NN4> NN499dDA  NN499dDA DIDI rcd|js |g|_y|jj|yr )r#rNr4r#s r charactersz_DictSAXHandler.characterss$yyDI II  T "rc|jr|j}|j|j|j||_yr )r.rXrYr$r3r]s rcommentsz_DictSAXHandler.commentss4  ::.>E rcP|j&|j|j||}||S|\}}||j} ||}t|tr|j ||S||g||< |S#t $r$|j||r |g||<Y|S|||<Y|SwxYwr )r,r!r-rClistrNr:_should_force_list)r4r$rRr#resultrSs rrYz_DictSAXHandler.push_datas    )'' 3=F~ IC <((*D !IE%& T" #DMS   !&&sD1!FS  !S   !s&A8.A88!B%B%$B%c|jsyt|jtr |jS ||jvS#t$r#|j|jdd||cYSwxYw)NFr7)r2rCbool TypeErrorr!)r4rRrSs rrcz"_DictSAXHandler._should_force_listsd doot ,?? " ?$//) ) ???499Sb>3> > ?s A)A/.A/)rrr_dictr5rArGrKrUr[r^r`rYrcrrrrrsb1! ""!##"'"&%(  '!'FJ D 82># F *?rrFrTc td d|i|}t|tr|xsd}|j|}|sd}|j||} d| _|j| _|j| _ |j| _ |j| _|r|j| _d| _|r d} | j$j'| dt-|dr| j/||j4St1|r7|D]} | j3| d | j3d d|j4S| j3|d|j4S#t $rYwxYw#t $rd| _d| _YwxYw) aParse the given XML input and convert it into a dictionary. `xml_input` can either be a `string`, a file-like object, or a generator of strings. If `xml_attribs` is `True`, element attributes are put in the dictionary among regular child elements, using `@` as a prefix to avoid collisions. If set to `False`, they are just ignored. Simple example:: >>> import xmltodict >>> doc = xmltodict.parse(""" ... ... 1 ... 2 ... ... """) >>> doc['a']['@prop'] u'x' >>> doc['a']['b'] [u'1', u'2'] If `item_depth` is `0`, the function returns a dictionary for the root element (default behavior). Otherwise, it calls `item_callback` every time an item at the specified depth is found and returns `None` in the end (streaming mode). The callback function receives two parameters: the `path` from the document root to the item (name-attribs pairs), and the `item` (dict). If the callback's return value is false-ish, parsing will be stopped with the :class:`ParsingInterrupted` exception. Streaming example:: >>> def handle(path, item): ... print('path:%s item:%s' % (path, item)) ... return True ... >>> xmltodict.parse(""" ... ... 1 ... 2 ... """, item_depth=2, item_callback=handle) path:[(u'a', {u'prop': u'x'}), (u'b', None)] item:1 path:[(u'a', {u'prop': u'x'}), (u'b', None)] item:2 The optional argument `postprocessor` is a function that takes `path`, `key` and `value` as positional arguments and returns a new `(key, value)` pair where both `key` and `value` may have changed. Usage example:: >>> def postprocessor(path, key, value): ... try: ... return key + ':int', int(value) ... except (ValueError, TypeError): ... return key, value >>> xmltodict.parse('12x', ... postprocessor=postprocessor) {'a': {'b:int': [1, 2], 'b': 'x'}} You can pass an alternate version of `expat` (such as `defusedexpat`) by using the `expat` parameter. E.g: >>> import defusedexpat >>> xmltodict.parse('hello', expat=defusedexpat.pyexpat) {'a': 'hello'} You can use the force_list argument to force lists to be created even when there is only a single child of a given level of hierarchy. The force_list argument is a tuple of keys. If the key for a given level of hierarchy is in the force_list argument, that level of hierarchy will have a list as a child (even if there is only one sub-element). The index_keys operation takes precedence over this. This is applied after any user-supplied postprocessor has already run. For example, given this input: host1 Linux em0 10.0.0.1 If called with force_list=('interface',), it will produce this dictionary: {'servers': {'server': {'name': 'host1', 'os': 'Linux'}, 'interfaces': {'interface': [ {'name': 'em0', 'ip_address': '10.0.0.1' } ] } } } `force_list` can also be a callable that receives `path`, `key` and `value`. This is helpful in cases where the logic that decides whether a list should be forced is more complex. If `process_comment` is `True` then comment will be added with comment_key (default=`'#comment'`) to then tag which contains comment For example, given this input: 1 2 If called with process_comment=True, it will produce this dictionary: 'a': { 'b': { '#comment': 'b comment', 'c': { '#comment': 'c comment', '#text': '1', }, 'd': '2', }, } r/utf-8NTz4http://apache.org/xml/features/disallow-doctype-declcyr rxs rrzparse..]sdrcy)Nr8rrls rrzparse.._srreadFrr)rrCstrencode ParserCreateordered_attributesAttributeErrorrKStartNamespaceDeclHandlerrUStartElementHandlerr[EndElementHandlerr^CharacterDataHandlerr`CommentHandler buffer_text_reader setFeatureDefaultHandlerExternalEntityRefHandlerhasattr ParseFiler Parser$) xml_inputencodingrprocess_namespacesr/disable_entitiesprocess_commentskwargshandlerparserfeaturechunks rparsersL(2E( &(G)S!&w$$X. " U  F $(!(/'A'AF$!(!5!5F&11F")"4"4F ' 0 0F ;LG NN % %gt 4y&!# << Y E LL & S$ <<  Y% <<;     ;%3F !.:F +  ;s$ E5E, E)(E),FFc|s|S |j|d\}}|j|j|}|r)dj|j |r|nd|||}|S|}|S#t $rY|SwxYw)Nr8z{}{}{}{}r)rsplitgetrXformat startswith ValueError)r?r0ns_sepr(nsns_ress r_process_namespacerks  6;;vq)D 56&,  ==5K2 FD" K26  K   K sA** A76A7cTt|| | |}||||}|y|\}}t|drt|ttfr|g}t |D]S\}}| r|dk(r|dkDr t d| t}nUt|tr|rdnd}n>t|ttfs(| rt|drt| |ff}n t|}t|trt||ff}d}t}g}|jD]\}}||k(r|}|j|rt|| | |}|dk(rOt|tr?|jD]+\}}dj|rd|nd }t|||<-t|ts t|}|||t|d<|j||ft| trd | z} |r|j|| z|j!|t#||r|r|j||D] \}}t%||||||d z|||| | | | "||j'||r|r|j|| z|j)||s?|sC|j|Vy) N__iter__rzdocument with multiple rootstruefalsez@xmlnszxmlns{}rr r8)r0r/ expand_iter)rrrCrprD enumeraterrhrfrPrrrOrNintignorableWhitespacerUr_emitr^r[)rRrScontent_handlerr(r)depth preprocessorprettynewlindentr/r0 full_documentrrdindexvcdatarFchildrenikivkattr child_key child_values rrrzs S*.A; OCc5) >  U 5* %EC;)Ge$q UaZEAI;< < 9A 4 AAc{+wq*5K+-.F a  1~'(AggiFBY}}[)'J8K(35>jT&: " 1(//1!A3"E&)!fd !+!"c*RB/1b[)*+, OORH %! " fc "6\F   / / ?$$S.*?@ h  / / 5&. "I{ )[/y%'<$:&9)  +'/    & &u - h  / / ?""3' e  / / 5k%rc |rt|dk7r tdd}| t}d}|rt||d}n t||}|r|j |j D]\}} t || |fd|i||r|j|r$|j} | j|} | Sy#t$rY| SwxYw)axEmit an XML document for the given `input_dict` (reverse of `parse`). The resulting XML document is returned as a string, but if `output` (a file-like object) is specified, it is written there instead. Dictionary keys prefixed with `attr_prefix` (default=`'@'`) are interpreted as XML node attributes, whereas keys equal to `cdata_key` (default=`'#text'`) are treated as character data. The `pretty` parameter (default=`False`) enables pretty-printing. In this mode, lines are terminated with `' '` and indented with `' '`, but this can be customized with the `newl` and `indent` parameters. r8z$Document must have exactly one root.FNTr) rOrrr startDocumentrPr endDocumentgetvaluedecodert) input_dictoutputrrshort_empty_elementsr must_returnrrRrSs runparsers"ZA-?@@K ~ &vx>&vx8%%' &&( U c5/   )##%! LL*E     s'B;; CC__main__r8c<tj||ftyr)marshaldumpstdout)r!r$s r handle_itemrs dD\6*r)r%r'r-)rr) rrrNF  rNTN)NrjTF)*__doc__ xml.parsersrxml.sax.saxutilsrxml.sax.xmlreaderriorrDrhplatformtuplemaprpython_version_tuple collectionsr inspectr __author__ __version__ __license__ Exceptionrrrrrrrsysrstdinbufferrrtargvr%rrootKeyboardInterruptrrrrs<), S/(//1"15 67&@0      \?\?~#%E!D5pf  !I6XFJ!&(V z   "" HHQRLMZZJ U *#.&*, ? D ! -  $    s$,D&D&D#"D#&D.-D.