관리-도구
편집 파일: easy_xml.pyo
� o�Rac @ s� d d l Z d d l Z d e d � Z d d � Z d e e d � Z i d d 6d d 6d d 6d d 6d d 6d d 6d d 6Z e j d d j e e j e j � � � � Z e d � Z d S( i����Ns utf-8c C s@ d | g } | r# | j d � n t | | | � d j | � S( sy 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. s# <?xml version="1.0" encoding="%s"?>s t ( t appendt _ConstructContentListt join( t contentt encodingt prettyt xml_parts( ( sj /opt/alt/alt-nodejs9/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/easy_xml.pyt XmlToString s ' i c C s� | r d | } d } n d } d } | d } t | t � sW t d t | � � � n | j | d | � | d } | r� t | d t � r� xG t | d j � � D]/ \ } } | j d | t | d t �f � q� W| d } n | r�| j d � t d � | t � } | } | r1| r1| j | � n xJ | D]B } t | t � rc| j t | � � q8t | | | | d � q8W| r�| r�| j | � n | j d | | f � n | j d | � d S( s+ 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. s s R i sR The first item of an EasyXml specification should be a string. Specification was t <i s %s="%s"t attrt >c S s | o t | t � S( N( t isinstancet str( t xt y( ( sj /opt/alt/alt-nodejs9/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/easy_xml.pyt <lambda>W R s </%s>%ss />%sN( R R t ExceptionR t dictt sortedt iteritemst _XmlEscapet Truet reduceR ( R t specificationR t levelt indentationt new_linet namet restt att valt all_stringst multi_linet child_spec( ( sj /opt/alt/alt-nodejs9/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/easy_xml.pyR 9 s: #' c C s� t | | | � } | r<