JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr ٓgd'ddlZddlZddlZdjddDZej dj eZej dZGddZ Gd d e Z Gd d e Z y) N|c#>K|]}dj|yw)z[{0}]N)format).0rs =/opt/hc_python/lib/python3.12/site-packages/dict2xml/logic.py r s%  NN1 s) uÀ-ÖuØ-öuø-˿uͰ-ͽuͿ-῿u‌-‍u⁰-↏uⰀ-⿯u、-퟿u豈-﷏uﷰ-�z(:|[A-Z]|_|[a-z]|{0})z2(\-|\.|[0-9]|\xB7|[\u0300-\u036F]|[\u203F-\u2040])c>eZdZdZdZGddZGddZy) DataSorterz; Used to sort a map of data depending on it's type cT|}t|tjs t|}|SN) isinstance collections OrderedDictsorted)selfdata sorted_datas r keys_fromzDataSorter.keys_from#s& $ 7 78 ,KceZdZdZy)DataSorter.alwaysct|Sr )rrrs rrzDataSorter.always.keys_from*s $< rN__name__ __module__ __qualname__rrralwaysr)s rr ceZdZdZy)DataSorter.neverc|Sr rrs rrzDataSorter.never.keys_from.sKrNrrrrneverr"-s rr$N)rrr__doc__rr r$rrrr r s    rr cNeZdZdZgdZ d dZdZdZdZe dZ y) Nodea Represents each tag in the tree Each node has _either_ a single value or one or more children If it has a value: The serialized result is <%(tag)s>%(value)s If it has children: The serialized result is <%(wrap)s> %(children)s Which one it is depends on the implementation of self.convert ))&z&)z>Nc|j||_|j||_||_|j |_||n t |_||_||_ |j dk(rQt|jtr6|jD]&\}}|jj|||_(yyy)Nflat)sanitize_elementtagwraprdetermine_typetyper data_sorterclosed_tags_foriterables_repeat_wraprstrentitiesreplace) rr/r.rr4r3r2entity replacements r__init__z Node.__init__Fs((-))$/  '') *5*A;z|.%:" 99 :dii#='+}}#  II--fkB (5$> rc |j}d\}}|r"dj|}dj|}|jr3|j|jvrdj|jS|j \}}d}|r|j dk7rfd|D|}n|j rqg}|D]a} | j}| j dk(r|j|5|gd }|jdj|||fc|d Sg}|D]"} |j| j$dj||d |gSdj||||fS) z,Returns the Node serialized as an xml string)r<zz<{0}>z<{0}/>r<iterablec3@K|]}|jywr ) serialize)rcindenters rr z!Node.serialize..ps#L8aAKK$98sr,TF) r/rr3rconvertr1r4r?appendjoin) rrAr/endstartvaluechildrencontentresultr@s ` rr?zNode.serialize\spyy U //$'CNN4(E   DII1E1E$E??499- -,,.x yyJ&"#L8#LdS--F%"#++h"766V+"MM'2'/y$&?G"MM"''5'32G*HI&$FE22F% akk(&;<&77E8FD+A3#GHH wwugs344rc|j}t|tryt|tjj ryt|tjj ryy)a Return the type of the data on this node as an identifying string * Iterable : Supports "for item in data" * Mapping : Supports "for key in data: value = data[key]" * flat : A string or something that isn't iterable or a mapping r,mappingr=)rrr5rabcMappingIterablers rr0zNode.determine_typesKyy dC  koo55 6 koo66 7rc Jd}|j}|j}g}|dk(ri|jj|}|D]E}||}|j t |d||j |j|jG||fS|dk(rS|D]J}|j t d|j||j |j|jL||fSt|}|jr'dj|j||j}||fS)a Convert data on this node into a (value, children) tuple depending on the type of the data If the type is : * flat : Use self.tag to surround the value. value * mapping : Return a list of tags where the key for each child is the wrap for that node * iterable : Return a list of Nodes where self.wrap is the tag for that node r<rL)r4r3r2r=z<{0}>{1}) r1rr2rrCr'r4r3r/r5r.r)rvaltyprrH sorted_keyskeyitems rrBz Node.converts)iiyy ) **44T:K"Cy.2.H.H(,(<(<$($4$4  #>H}%J  .2.H.H(,(<(<$($4$4  "H} d)Cxx&--dhhTXXFH}rc H|rt|tr|jjdrd|z}dj t j |sdndg|Dcgc]0}t j |stj |sdn|2c}zS|Scc}w)a Convert `wrap` into a valid tag name applying the XML Naming Rules. * Names can contain letters, numbers, and other characters * Names cannot start with a number or punctuation character * Names cannot start with the letters xml (or XML, or Xml, etc) * Names cannot contain spaces * Any name can be used, no words are reserved. :ref: http://www.w3.org/TR/REC-xml/#NT-NameChar xml_r<)rr5lower startswithrD NameStartCharmatchNameChar)r/r@s rr-zNode.sanitize_elements JtS)zz|&&u-Tz77)//52>\`a\`WX}22159J3QRR\`ab  Kbs5B )r<r<NTNN) rrrr%r6r:r?r0rB staticmethodr-rrrr'r'2sM">H  "C,.5`$/brr'c&eZdZdZddZdZddZy) ConverterzFLogic for creating a Node tree and serialising that tree into a stringNc.||_||_||_y)aI wrap: The tag that the everything else will be contained within indent: The string that is multiplied at the start of each new line, to represent each level of nesting newlines: A boolean specifying whether we want each tag on a new line. Note that indent only works if newlines is True N)r/indentnewlines)rr/rbrcs rr:zConverter.__init__s    rcb|j|j}|sd}|Ssddfd}|S)zdReturns a function that given a list of strings, will return that list as a single, indented, stringc$dj|S)Nr<)rD)nodeswrappeds rz*Converter._make_indenter..s rr<c3NK|D]}|jdD]}|yw)zYield each line in each node N)split)rfnodelines reachlinez*Converter._make_indenter..eachlines(!D $ 4 0" !1"s#%c|r#dj}dj}nd}d}|j|j|S)a" Indent nodes depending on value of wrapped and indent If not wrapped, then don't indent Otherwise, Seperate each child by a newline and indent each line in the child by one indent unit z {0}z {0}{{0}} rjz{0})rrD)rfrg seperator surroundingrnrbs rretz%Converter._make_indenter..ret sN 'v 6I"0"7"7"?K $I"'K")))..%*IJJr)rbrc)rrcrrrnrbs @@r_make_indenterzConverter._make_indenters@==7C6 3 #  K  rct|j}t|j||||j|S)zICreate a Node tree from the data and return it as a serialized xml string)r/rr4r3r2)rsr'r/r?)rrr4r3r2rAs rbuildzConverter.builds<&&("7+#  )H   r)Nz T)TNN)rrrr%r:rsrurrrr`r`sP !"H rr`) rcollections.abcrerD start_rangescompilerr[r]r objectr'r`rrrr{s xx  " 3::<HI 2::K L(r6rt<<r