HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //proc/self/root/usr/lib/python3.6/site-packages/gyp/__pycache__/easy_xml.cpython-36.opt-1.pyc
3

��S]>�@s�ddlZddlZddlZddlZyeWn ek
rHddlmZYnXddd�Zddd�Zdd	d
�Z	ddd
ddddd�Z
ejddje
eje
j����Zddd�ZdS)�N)�reduce�utf-8FcCs.d|g}|r|jd�t|||�dj|�S)ay Writes the XML content to disk, touching the file only if it has changed.

  Visual Studio files have a lot of pre-defined structures.  This function makes
  it easy to represent these structures as Python data structures, instead of
  having to create a lot of function calls.

  Each XML element of the content is represented as a list composed of:
  1. The name of the element, a string,
  2. The attributes of the element, a dictionary (optional), and
  3+. The content of the element, if any.  Strings are simple text nodes and
      lists are child elements.

  Example 1:
      <test/>
  becomes
      ['test']

  Example 2:
      <myelement a='value1' b='value2'>
         <childtype>This is</childtype>
         <childtype>it!</childtype>
      </myelement>

  becomes
      ['myelement', {'a':'value1', 'b':'value2'},
         ['childtype', 'This is'],
         ['childtype', 'it!'],
      ]

  Args:
    content:  The structured content to be converted.
    encoding: The encoding to report on the first XML line.
    pretty: True if we want pretty printing with indents and new lines.

  Returns:
    The XML content as a string.
  z#<?xml version="1.0" encoding="%s"?>�
�)�append�_ConstructContentList�join)�content�encoding�pretty�	xml_parts�r
�/usr/lib/python3.6/easy_xml.py�XmlToStrings
'

rc
Cs`|rd|}d}nd}d}|d}t|t�s<tdt|���|j|d|�|dd�}|r�t|dt�r�x6t|dj��D]"\}}	|jd	|t|	d
d�f�q~W|dd�}|�rN|jd�td
d�|d
�}
|
}|r�|r�|j|�x:|D]2}t|t��r|jt|��q�t	||||d�q�W|�r:|�r:|j|�|jd||f�n|jd|�dS)a+ Appends the XML parts corresponding to the specification.

  Args:
    xml_parts: A list of XML parts to be appended to.
    specification:  The specification of the element.  See EasyXml docs.
    pretty: True if we want pretty printing with indents and new lines.
    level: Indentation level.
  z  rrrzRThe first item of an EasyXml specification should be a string.  Specification was �<�Nz %s="%s"T)�attr�>cSs|ot|t�S)N)�
isinstance�str)�x�yr
r
r�<lambda>^sz'_ConstructContentList.<locals>.<lambda>z</%s>%sz/>%s)
rr�	Exceptionr�dict�sorted�items�
_XmlEscaperr)
rZ
specificationr�levelZindentationZnew_line�name�restZat�valZall_stringsZ
multi_lineZ
child_specr
r
rr@s:





rc	Cs�t|||�}|rptjdkrp|jdd�}tj�d}|rp|j�|j�krpy|j|�j|�}Wnt	k
rnYnXyt
|d�}|j�}|j�Wnd}YnX||kr�t
|d�}|j
|�|j�dS)a: Writes the XML content to disk, touching the file only if it has changed.

  Args:
    content:  The structured content to be written.
    path: Location of the file.
    encoding: The encoding to report on the first line of the XML file.
    pretty: True if we want pretty printing with indents and new lines.
  z
rr�rN�w)r�os�linesep�replace�localeZgetdefaultlocale�upper�decode�encode�AttributeError�open�read�close�write)	r	�pathr
rZwin32Z
xml_stringZdefault_encoding�fZexistingr
r
r�WriteXmlIfChangedps&




r2z&quot;z&apos;z&lt;z&gt;z&amp;z&#xA;z&#xD;)�"�'rr�&r�
z(%s)�|cs�fdd�}tj||�S)z& Escape a string for inclusion in XML.cs.|j|j�|j��}�r&|dkr&|St|S)Nr4)�string�start�end�_xml_escape_map)�match�m)rr
rr&�sz_XmlEscape.<locals>.replace)�_xml_escape_re�sub)�valuerr&r
)rrr�sr)rF)r)rFF)F)�rer$r'�sysr�	NameError�	functoolsrrr2r;�compiler�map�escape�keysr>rr
r
r
r�<module>s*
0
0
#