ROOTPLOIT
Server: LiteSpeed
System: Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: niphet (1079)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //opt/hc_python/lib64/python3.12/site-packages/__pycache__/dicttoxml.cpython-312.pyc

g:
ZdZddlmZdZeZddlmZ	ddlmZ	ddlZddl
Z
ddlmZe
j dZ	e	edd
ZdZgZd dZd
ZdZdZdZdZdZdZ dZ!d!dZ"dZ#dZ$d"dZ%d"dZ&d"dZ'dddd	de!d	dddf
dZ(y#e
$r	ddlmZ	Y}wxYw#eZYdxYw#eZYjxYw)#a
Converts a Python dictionary or other native data type into a valid XML string.

Supports item (`int`, `float`, `long`, `decimal.Decimal`, `bool`, `str`, `unicode`, `datetime`, `none` and other number-like objects) and collection (`list`, `set`, `tuple` and `dict`, as well as iterable and dict-like objects) data types, with arbitrary nesting for the collections. Items with a `datetime` type are converted to ISO format strings. Items with a `None` type become empty XML elements.

This module works with both Python 2 and 3.
)unicode_literalsz1.7.16)randint)IterableN)parseString	dicttoxmlFc2|rqddl}td|ztj|tjt
j
dt|jjzytjtjy)Nrz*Debug mode is on. Events are logged at: %s)filenamelevelz
Logging session starts: %s)r
)
datetimeprintloggingbasicConfigINFOLOGinfostrtodayWARNING)debugr	rs   8/opt/hc_python/lib/python3.12/site-packages/dicttoxml.py	set_debugr,si
:hGHXW\\B/!!'')*,	
	'//2crtjd|d	t|dS#t|cYSxYw)zConverts strings with non-ASCII characters to unicode for LOG.
    Python 3 doesn't have a `unicode()` function, so `unicode()` is an alias
    for `str()`, but `str()` doesn't take a second argument, hence this kludge.
    zInside unicode_me(). val = ""utf-8)rrunicodevals r
unicode_mer8s6
HH#
89sG$$s|s'
6c	btjd|d|d|d|dt||S)zReturns a random integerzInside make_id(). element = "z
", start="z", end="r_)rrr)elementstartends   rmake_idr%Fs)HHRWY\
]^wuc233rctjd|dt|}d}|r.|tvrd}tj	|nt|}|r.tdS)z'Returns a unique id for a given elementz#Inside get_unique_id(). element = "rTF)rrr%idsappend)r"this_iddups   r
get_unique_idr,LsVHH
CDgG
C

#CJJwg&Gr7Nrctjd|dt|jdt|jdk(rtjdyt|jdk(rtjdyt|jd	vrtjd
yt|jdvrtjd
yt|jdk(rtjdyt	|t
jrtjdyt	|trtjdyt	|trtjdytjdt|jzt|jS)z0Returns the data type for the xml type attributezInside get_xml_type(). val = "z", type(val) = "rNoneTypez2type(val).__name__ == 'NoneType', returning 'null'nullboolz.type(val).__name__ == 'bool', returning 'bool')rrz8type(val).__name__ in ('str', unicode'), returning 'str'r)intlongz5type(val).__name__ in ('int', long'), returning 'int'r1floatz0type(val).__name__ == 'float', returning 'float'z3isinstance(val, numbers.Number), returning 'number'numberz'isinstance(val, dict), returning 'dict'dictz+isinstance(val, iterable), returning 'list'listztype not found, returning '%s')	rrtype__name__
isinstancenumbersNumberr5iterablers rget_xml_typer=ZsGHHc4PS9K]K]
^_CyZ'EF	
c		v	%AB	
c		1	1KL	
c			.HI	
c		w	&CD	C	(FG	C	:;	C	">?HH
-c1C1C
DE9rcHtjd|dt|dt|ttfvret|}|j
dd}|j
dd}|j
dd}|j
d	d
}|j
dd}|S)
NzInside escape_xml(). s = "z" and type(s) = "r&z&amp;z&quot;'z&apos;<z&lt;>z&gt;)rrr7rrrreplace)ss r
escape_xmlrEsHH1d1g
NOAw3. qM
IIc7#
IIc8$
IIdH%
IIc6"
IIc6"Hrc
tjd|ddj|jDcgc]
\}}|d|dc}}}|dk7rdnd|Scc}}w)z2Returns an attribute string in the form key="val" z!Inside make_attstring(). attr = "r z=")rrjoinitems)attrkv
attrstrings    rmake_attrstringrOsZHHt
>?$**,G,$!Q1-,GHJ&",S"4jAAHsA
ctjdt|zd|d|d}	t|y#t$rYywxYw)z%Checks that a key is a valid XML namez'Inside key_is_valid_xml(). Testing "%s"z(<?xml version="1.0" encoding="UTF-8" ?><z>foo</rBTF)rrrr	Exception)keytest_xmls  rkey_is_valid_xmlrTsDHH
6*S/
JKHKSQHHs8	AActjdt|dt|dt|}t|}t	|r||fSt|j
rd|z|fS	dtt|z|fS#t$rYnwxYwt	|jddr|jdd|fS||d<d}||fS)	z)Tests an XML name and fixes it if invalidz+Inside make_valid_xml_name(). Testing key "z
" with attr "rzn%srGr!namerR)
rrrrErTrisdigitr3
ValueErrorrC)rRrKs  rmake_valid_xml_namerYsHH3D)+S/CdDDy3x}d""
c#h($..

C-.{{3$d**DL
C9s5B	BBcztjd|dt|jdd}d|zdzS)z"Wraps a string into CDATA sectionszInside wrap_cdata(). val = "rz]]>z]]]]><![CDATA[>z	<![CDATA[)rrrrCrs r
wrap_cdatar[s8HH#
89
S/
!
!%):
;Cu$$rc6tjd|dy)Nz&Inside default_item_func(). parent = "ritem)rrparents rdefault_item_funcr`sHHF
EFrrootcztjdt|jdt	|d||}t|t
k(rt
||||S|t||||St|tjst|ttfvrt||||St|drt||j||St|t rt#||||||St|t$rt'||||||St)d|dt|jd)zcRoutes the elements of an object to the right function to convert them
    based on their data typez Inside convert(). obj type is: "", obj="r	isoformatUnsupported data type:  ())rrr7r8rr0convert_boolconvert_noner9r:r;rr
convert_kvhasattrrdr5convert_dictr<convert_list	TypeError)objr(	attr_type	item_funccdatar_	item_names       rconvertrts
HHS	@R@RT^_bTc
de&!ICyDIsIu==
{IsIu==#w~~&$s)W~*E)S)U;;sK )S]]_iGG#tCfiEJJ#x CfiEJJ
T#Y=O=OP
QQrctjdt|jdt	|dg}|j
}||}|j
D]\}	}
tjdt	|	dt	|
dt|
jd|sinddt|zi}t|	|\}	}t|
tk(r|t|	|
|||t|
tjst|
ttfvr|t!|	|
|||t#|
d	r%|t!|	|
j%|||t|
tk(r|t|	|
|||7t|
t&r=|rt)|
|d
<|d|	t+|dt-|
||	|||d
|	dt|
t.r=|rt)|
|d
<|d|	t+|dt1|
||	|||d
|	d|
|t3|	|
|||t5d|
dt|
jddj7|S)z#Converts a dict into an XML string.z%Inside convert_dict(): obj type is: "rcrz$Looping inside convert_dict(): key="", val="z", type(val)="idz%srdr7rArB</rerfrgrH)rrr7r8rr)rJr,rYr0rhr9r:r;rrrjrkrdr5r=rOrlr<rmrirnrI)ror(r_rprqrroutputaddlinersrRrrKs            rrlrls$HHS	JsO-FmmG&!IIIKSsOZ_d3i.@.@B	
r4v1F)G"I'T2	T9Lc9eTBC
W^^
,S	c7^0KJsCE4@A
S+
&JsCMMOYtLM
#Y$
Lc9eTBC
T
"+C0V_T*S#sIy%H
X
&+C0V%S#sIy%H	
[Lc9eTBCT#Y'')
] d776?rctjdg}|j}||}|rt|}	t	|D]\}
}tjdt|d|dt
|jd|sind	d|
dzi}t|tjst
|ttfvr|t|||||t|d	r$|t||j|||t
|t k(r|t#|||||t|t$rF|s"|d
|dt'||||||d|d%|d
|d
t'||||||d|dGt|t(r^|s.|d
|dt+|dt-||||||d|d	|d
|dt+|dt-||||||d|d	||t/|d|||t1d|dt
|jddj3|S)z#Converts a list into an XML string.zInside convert_list()z%Looping inside convert_list(): item="z", item_name="z	", type="rrwr!rdrArBrxz
 type="dict">rGz type="list"NrerfrgrH)rrr)r,	enumeraterr7r8r9r:r;rrrjrkrdr0rhr5rlr<rOrmrirnrI)
rJr(r_rprqrrryrzrsr*ir]rKs
             rrmrm'sHH
$%
FmmG&!I
'U#4tid)<)<>	
rDWac*B"DdGNN+tDzc7^/KJy$	5$GH
T;
'Jy$..*:IudST
$Z4
LD)UDIJ
d
# sFIy%P sFIy%Ph
't4 sIy)USt4 sIy)US\LD)UDIJd4j))+
e$j776?rc
4tjdt|dt|dt|jd|i}t||\}}|rt
||d<t|}d||d|dk(rt|n
t|d	|dS)
z/Converts a number or string into an XML elementzInside convert_kv(): key="rv", type(val) is: "rr7rArBTrx)
rrrr7r8rYr=rOr[rErRrrprrrKrNs      rrjrjjsHH3C$s)*<*<>|#C.IC#C(V &JZ D=
3jo=rc
0tjdt|dt|dt|jd|i}t||\}}|rt
||d<t|}d||dt|jd|dS)	z&Converts a boolean into an XML elementzInside convert_bool(): key="rvrrr7rArBrx)
rrrr7r8rYr=rOrlowerrs      rrhrhsHH33S	
|#C.IC#C(V &J!:ws|/A/A/CSIIrctjdt|dt|dt|dt||i}t	||\}}|rt||d<t
|}d||d|dS)	z)Converts a null value into an XML elementzInside convert_none(): key="z". val="z", attr_type="z", attr=r7rAz></rB)rrrrrYr=rOrs      rriristHH339D		
|#C.IC#C(V &JS11rTzUTF-8c
tjdt|jdt	|dg}|j
}|dk(r@|dk(r|dk(r	|dn|d|	z|d|d	t
||||||
d|d	n|t
|||||d
|
dk(rdj|Sdj|jd
S)ayConverts a python object into XML.
    Arguments:
    - root specifies whether the output is wrapped in an XML root element
      Default is True
    - custom_root allows you to specify a custom root element.
      Default is 'root'
    - ids specifies whether elements get unique ids.
      Default is False
    - attr_type specifies whether elements get a data type attribute.
      Default is True
    - item_func specifies what function should generate the element name for
      items in a list.
      Default is 'item'
    - cdata specifies whether string values should be wrapped in CDATA sections.
      Default is False
    z#Inside dicttoxml(): type(obj) is: "rcrTFz<?xml version="1.0" ?>z$<?xml version="1.0" encoding="%s" ?>rArBr^rxrHr)	rrr7r8rr)rtrIencode)
roracustom_rootxml_declarationr(rprqrrinclude_encodingencodingreturn_bytesryrzs
             rrrs:HH49CUCUWabeWf
gh
FmmGt|d"5(01>(KLS)YkJ
		S)YbIJuwwv
776?!!'**r)Fz
dicttoxml.log)ii?B)ra)FN))__doc__
__future__r__version__versionrandomrcollections.abcrr<ImportErrorcollectionsr:r
xml.dom.minidomr	getLoggerrrrr2r1rrr(r%r,r=rErOrTrYr[r`rtrlrmrjrhrirrr<module>rs(
14
'g$

	3		4%P	
B@%
R8<~@F*J(2.
!2+g101G
Ds'B
BB$
BBB!$B*