403Webshell
Server IP : 104.21.64.206  /  Your IP : 216.73.216.114
Web Server : LiteSpeed
System : Linux premium234.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : pawazvgw ( 969)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/hc_python/lib64/python3.12/site-packages/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/hc_python/lib64/python3.12/site-packages/__pycache__/dicttoxml.cpython-312.pyc
�

���g�:�
�Z�dZddlmZdZeZddlmZ	ddlmZ	ddlZddl
Z
ddlmZe
j d�Z	e	edd
�Zd�ZgZd d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d!d�Z"d�Z#d�Z$d"d�Z%d"d�Z&d"d�Z'dddd	de!d	dddf
d�Z(y#e
$r	ddlmZ	Y�}wxYw#eZY�dxYw#eZY�jxYw)#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�	dicttoxmlFc�2�|rqddl}td|z�tj|tj��t
j
dt|jj��z�ytjtj��y)Nrz*Debug mode is on. Events are logged at: %s)�filename�levelz
Logging session starts: %s)r
)
�datetime�print�logging�basicConfig�INFO�LOG�info�str�today�WARNING)�debugr	rs   �8/opt/hc_python/lib/python3.12/site-packages/dicttoxml.py�	set_debugr,si����
�:�h�G�H����X�W�\�\�B����/���!�!�'�'�)�*�,�	
�	���'�/�/�2�c�r�tjd|�d��	t|d�S#t|�cYSxYw)z�Converts 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)rr�unicode��vals r�
unicode_mer8s6��
�H�H�#�
8�9���s�G�$�$����s�|��s�'�
6c	�b�tjd|�d|�d|�d��|�dt||���S)zReturns a random integerzInside make_id(). element = "z
", start="z", end="r�_)rrr)�element�start�ends   r�make_idr%Fs)���H�H��RW�Y\�
]�^��w�u�c�2�3�3rc��tjd|�d��t|�}d}|r.|tvrd}tj	|�nt|�}|r�.tdS)z'Returns a unique id for a given elementz#Inside get_unique_id(). element = "rTF���)rrr%�ids�append)r"�this_id�dups   r�
get_unique_idr,LsV���H�H��
C�D��g��G�
�C�

��#���C��J�J�w���g�&�G���r�7�Nrc��tjd|�dt|�j�d��t|�jdk(rtjd�yt|�jdk(rtjd�yt|�jd	vrtjd
�yt|�jdvrtjd
�yt|�jdk(rtjd�yt	|t
j�rtjd�yt	|t�rtjd�yt	|t�rtjd�ytjdt|�jz�t|�jS)z0Returns the data type for the xml type attributezInside get_xml_type(). val = "z", type(val) = "r�NoneTypez2type(val).__name__ == 'NoneType', returning 'null'�null�boolz.type(val).__name__ == 'bool', returning 'bool')rrz8type(val).__name__ in ('str', unicode'), returning 'str'r)�int�longz5type(val).__name__ in ('int', long'), returning 'int'r1�floatz0type(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')	rr�type�__name__�
isinstance�numbers�Numberr5�iterablers r�get_xml_typer=ZsG���H�H�c�4�PS�9�K]�K]�
^�_��C�y���Z�'����E�F��	
�c��	�	�v�	%����A�B��	
�c��	�	�1�	1����K�L��	
�c��	�	��	.����H�I��	
�c��	�	�w�	&����C�D��	�C����	(����F�G��	�C��	����:�;��	�C��	"����>�?���H�H�
-��c��1C�1C�
D�E���9���rc�H�tjd|�dt|��d��t|�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;)rrr7rrr�replace)�ss r�
escape_xmlrE�s����H�H�1�d�1�g�
N�O��A�w�3��.� ��q�M��
�I�I�c�7�#��
�I�I�c�8�$��
�I�I�d�H�%��
�I�I�c�6�"��
�I�I�c�6�"���Hrc
���tjd|�d��dj|j�D��cgc]
\}}|�d|�d���c}}�}|dk7rdnd�|��Scc}}w)z2Returns an attribute string in the form key="val" z!Inside make_attstring(). attr = "r� z="�)rr�join�items)�attr�k�v�
attrstrings    r�make_attrstringrO�sZ���H�H�t�
>�?����$�*�*�,�G�,�$�!�Q��1�-�,�G�H�J�&�"�,�S�"�4�j�A�A��Hs�A
c��tjdt|�z�d|�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)�key�test_xmls  r�key_is_valid_xmlrT�sD���H�H�
6�*�S�/�
J�K�HK�S�Q�H���H��������s�8�	A�Ac��tjdt|��dt|��d��t|�}t|�}t	|�r||fSt|�j
�rd|z|fS	dtt|��z|fS#t$rYnwxYwt	|jdd��r|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)
rrrrErTr�isdigitr3�
ValueErrorrC)rRrKs  r�make_valid_xml_namerY�s����H�H��3���D�)�+���S�/�C��d��D�����D�y���3�x������}�d�"�"�
���c�#�h��(�$�.�.���
��
������C��-�.��{�{�3��$�d�*�*��D��L�
�C���9�s�5B�	B�Bc�z�tjd|�d��t|�jdd�}d|zdzS)z"Wraps a string into CDATA sectionszInside wrap_cdata(). val = "rz]]>z]]]]><![CDATA[>z	<![CDATA[)rrrrCrs r�
wrap_cdatar[�s8���H�H�#�
8�9�
�S�/�
!�
!�%�):�
;�C����u�$�$rc�6�tjd|�d��y)Nz&Inside default_item_func(). parent = "r�item)rr��parents r�default_item_funcr`�s���H�H�F�
E�F�r�rootc�z�tjdt|�j�dt	|��d��||�}t|�t
k(rt
||||�S|�t||||�St|tj�st|�ttfvrt||||�St|d�rt||j�||�St|t �rt#||||||�St|t$�rt'||||||�St)d|�dt|�j�d���)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�	isoformat�Unsupported data type: � (�))rrr7r8rr0�convert_bool�convert_noner9r:r;rr�
convert_kv�hasattrrdr5�convert_dictr<�convert_list�	TypeError)�objr(�	attr_type�	item_func�cdatar_�	item_names       r�convertrt�s
���H�H��S�	�@R�@R�T^�_b�Tc�
d�e��&�!�I��C�y�D���I�s�I�u�=�=�
�{��I�s�I�u�=�=��#�w�~�~�&�$�s�)��W�~�*E��)�S�)�U�;�;��s�K� ��)�S�]�]�_�i��G�G��#�t���C��f�i��E�J�J��#�x� ��C��f�i��E�J�J�
��T�#�Y�=O�=O�P�
Q�Qrc��tjdt|�j�dt	|��d��g}|j
}||�}|j
�D�]\}	}
tjdt	|	��dt	|
��dt|
�j�d��|sinddt|�zi}t|	|�\}	}t|
�tk(r|t|	|
|||����t|
tj�st|
�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|
�j�d���dj7|�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_rprqrr�output�addlinersrRrrKs            rrlrl�s$���H�H��S�	���J�s�O�-���F��m�m�G��&�!�I��I�I�K���S�����s�O�Z��_�d�3�i�.@�.@�B�	
��r�4���v�1F�)G�"I��'��T�2�	��T���9����L��c�9�e�T�B�C�
��W�^�^�
,��S�	�c�7�^�0K��J�s�C��E�4�@�A�
�S�+�
&��J�s�C�M�M�O�Y��t�L�M�
�#�Y�$�
��L��c�9�e�T�B�C�
��T�
"��+�C�0��V����_�T�*��S�#�s�I�y�%�H���
���X�
&��+�C�0��V������%��S�#�s�I�y�%�H��	�
��[��L��c�9�e�T�B�C���T�#�Y�'�'�)��
�] �d�7�7�6�?�rc��tjd�g}|j}||�}|rt|�}	t	|�D�]�\}
}tjdt|��d|�dt
|�j�d��|sind	�d|
dz��i}t|tj�st
|�ttfvr|t|||||����t|d	�r$|t||j�|||����t
|�t k(r|t#|||||����t|t$�rF|s"|d
|�dt'||||||��d|�d����%|d
|�d
t'||||||��d|�d����Gt|t(�r^|s.|d
|�dt+|��dt-||||||��d|�d�	����|d
|�dt+|��dt-||||||��d|�d�	����|�|t/|d|||�����t1d|�dt
|�j�d���dj3|�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's���H�H�
$�%�
�F��m�m�G��&�!�I�
���'���U�#���4�����t��i��d��)<�)<�>�	
��r�D�W�a��c�*B�"D���d�G�N�N�+�t�D�z�c�7�^�/K��J�y�$�	�5�$�G�H�
�T�;�
'��J�y�$�.�.�*:�I�u�d�S�T�
�$�Z�4�
��L��D�)�U�D�I�J�
��d�
#���� ��s�F�I�y�%�P������ ��s�F�I�y�%�P������h�
'�����t�4� ��s�I�y�)�U�S�������t�4� ��s�I�y�)�U�S�����\��L��D�)�U�D�I�J���d�4�j�)�)�+��
�e$�j�7�7�6�?�rc
�4�tjdt|��dt|��dt|�j�d��|�i}t||�\}}|rt
|�|d<t|�}d|�|�d|dk(rt|�n
t|��d	|�d�S)
z/Converts a number or string into an XML elementzInside convert_kv(): key="rv�", type(val) is: "rr7rArBTrx)
rrrr7r8rYr=rOr[rE�rRrrprrrKrNs      rrjrjjs����H�H��3���C��$�s�)�*<�*<�>���|���#�C��.�I�C���#�C�(��V�� ��&�J��Z� �D�=�
�3��j��o�=���rc
�0�tjdt|��dt|��dt|�j�d��|�i}t||�\}}|rt
|�|d<t|�}d|�|�dt|�j��d|�d�S)	z&Converts a boolean into an XML elementzInside convert_bool(): key="rvr�rr7rArBrx)
rrrr7r8rYr=rOr�lowerr�s      rrhrhs����H�H��3���3���S�	���
���|���#�C��.�I�C���#�C�(��V�� ��&�J�!�:�w�s�|�/A�/A�/C�S�I�Irc��tjdt|��dt|��dt|��dt|����|�i}t	||�\}}|rt|�|d<t
|�}d|�|�d|�d�S)	z)Converts a null value into an XML elementzInside convert_none(): key="z". val="z", attr_type="z", attr=r7rAz></rB)rrrrrYr=rOr�s      rriri�st���H�H��3���3���9���D�	�	
���|���#�C��.�I�C���#�C�(��V�� ��&�J���S�1�1rTzUTF-8c
��tjdt|�j�dt	|��d��g}|j
}|dk(r@|dk(r|dk(r	|d�n|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)rtrI�encode)
rora�custom_root�xml_declarationr(rprqrr�include_encoding�encoding�return_bytesryrzs
             rrr�s���:�H�H�4��9�CU�CU�Wa�be�Wf�
g�h�
�F��m�m�G��t�|��d�"��5�(��0�1��>�(�K�L�����S�)�Y��k�J��
�	�	���S�)�Y��b�I�J��u���w�w�v���
�7�7�6�?�!�!�'�*�*r)Fz
dicttoxml.log)i��i?B)ra)FN))�__doc__�
__future__r�__version__�version�randomr�collections.abcrr<�ImportError�collectionsr:r
�xml.dom.minidomr�	getLoggerrrrr2r1rrr(r%r,r=rErOrTrYr[r`rtrlrmrjrhrir�rr�<module>r�s���(���
���1�4�
��'��g����$����
��
	3�	�	��4��%�P	
�B���@%��
R�8<�~@�F�*J�(2�.���
��!�����2+��g�1�0�1����G��
��D�s'�B
�B�B$�
B�B�B!�$B*

Youez - 2016 - github.com/yon3zu
LinuXploit