ó
Yé?_c           @   s›  d  Z  y d d l m Z Wn! e k
 r= d d l m Z n Xd d l m Z d d l m	 Z	 y d d l
 m Z WnI e k
 r½ y d d l m Z Wq¾ e k
 r¹ d d l m Z q¾ Xn Xd d l m Z y
 e Z Wn e k
 rñ e Z n Xy
 e Z Wn e k
 re Z n Xd Z d	 Z d
 Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e e d e d „ Z d d d „ Z  d d d d e d d d d e d „
 Z! d d e e d „ Z" e# d k r—d d l$ Z$ d d l% Z% y e$ j& j' Z& e$ j( j' Z( Wn# e) k
 re$ j& Z& e$ j( Z( n Xe$ j* d \ Z+ e, e+ ƒ Z+ d „  Z- y> e e& d e+ d e- d  e. ƒZ/ e+ d k re- g  e/ ƒ n  Wq—e0 k
 r“q—Xn  d S(!   s:   Makes working with XML feel like you are working with JSONiÿÿÿÿ(   t   pyexpat(   t   expat(   t   XMLGenerator(   t   AttributesImpl(   t   StringIO(   t   OrderedDicts   Martin Blechs   0.12.0t   MITt   ParsingInterruptedc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyR   "   s   t   _DictSAXHandlerc           B   sƒ   e  Z d  d „  e d d e d d e e d d d d „ Z d „  Z d „  Z d	 „  Z	 d
 „  Z
 d „  Z d „  Z d „  Z d „  Z RS(   i    c          G   s   t  S(   N(   t   True(   t   args(    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyt   <lambda>)   s    t   @s   #textt    t   :c         C   s©   g  |  _  g  |  _ g  |  _ d  |  _ | |  _ | |  _ | |  _ | |  _ | |  _	 | |  _
 | |  _ | |  _ |	 |  _ |
 |  _ | |  _ | |  _ t ƒ  |  _ | |  _ d  S(   N(   t   patht   stackt   datat   Nonet   itemt
   item_deptht   xml_attribst   item_callbackt   attr_prefixt	   cdata_keyt   force_cdatat   cdata_separatort   postprocessort   dict_constructort   strip_whitespacet   namespace_separatort
   namespacesR   t   namespace_declarationst
   force_list(   t   selfR   R   R   R   R   R   R   R   R   R   R    R!   R#   (    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyt   __init__'   s$    																c         C   s   |  j  s | S| j |  j ƒ } | d k r/ | S| |  | | d } } |  j  j | | ƒ } | sg | S|  j j | | f ƒ Sd  S(   Niÿÿÿÿi   (   R!   t   rfindR    t   gett   join(   R$   t	   full_namet   it	   namespacet   namet   short_namespace(    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyt   _build_nameH   s    	c         C   sC   t  | t ƒ r | S|  j t | d d  d … | d d  d … ƒ ƒ S(   Ni    i   i   (   t
   isinstancet   dictR   t   zip(   R$   t   attrs(    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyt   _attrs_to_dictU   s    c         C   s   | |  j  | p d <d  S(   NR   (   R"   (   R$   t   prefixt   uri(    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyt   startNamespaceDeclZ   s    c         C   sX  |  j  | ƒ } |  j | ƒ } | rI |  j rI |  j | d <t ƒ  |  _ n  |  j j | | p^ d  f ƒ t |  j ƒ |  j k rT|  j	 j |  j
 |  j f ƒ |  j r3g  } xv | j ƒ  D]h \ } } |  j |  j  | ƒ } |  j rû |  j |  j | | ƒ } n | | f } | rµ | j | ƒ qµ qµ W|  j | ƒ } n d  } | pBd  |  _
 g  |  _ n  d  S(   Nt   xmlns(   R.   R3   R"   R   R   t   appendR   t   lenR   R   R   R   R   t   itemsR   R   R   (   R$   R)   R2   R,   t   attr_entriest   keyt   valuet   entry(    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyt   startElement]   s*    		c         C   s¼  |  j  | ƒ } t |  j ƒ |  j k r |  j } | d  k rc |  j sK d  n |  j j |  j ƒ } n  |  j	 |  j | ƒ } | s t
 ƒ  ‚ q n  t |  j ƒ r™|  j s« d  n |  j j |  j ƒ } |  j } |  j j ƒ  \ |  _ |  _ |  j r| r| j ƒ  pd  } n  | r2|  j r2| d  k r2|  j ƒ  } n  | d  k	 r{| r]|  j | |  j | ƒ n  |  j |  j | | ƒ |  _ q«|  j |  j | | ƒ |  _ n d  |  _ g  |  _ |  j j ƒ  d  S(   N(   R.   R9   R   R   R   R   R   R   R(   R   R   R   t   popR   t   stripR   R   t	   push_dataR   (   R$   R)   R,   R   t   should_continueR   (    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyt
   endElementv   s4    				c         C   s,   |  j  s | g |  _  n |  j  j | ƒ d  S(   N(   R   R8   (   R$   R   (    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyt
   characters•   s    	c         C   sâ   |  j  d  k	 rF |  j  |  j | | ƒ } | d  k r7 | S| \ } } n  | d  k ra |  j ƒ  } n  y= | | } t | t ƒ r | j | ƒ n | | g | | <Wn= t k
 rÝ |  j | | ƒ rÐ | g | | <qÞ | | | <n X| S(   N(	   R   R   R   R   R/   t   listR8   t   KeyErrort   _should_force_list(   R$   R   R<   R   t   resultR=   (    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyRB   ›   s"    
c         C   sf   |  j  s t St |  j  t ƒ r& |  j  Sy | |  j  k SWn( t k
 ra |  j  |  j d  | | ƒ SXd  S(   Niÿÿÿÿ(   R#   t   FalseR/   t   boolt	   TypeErrorR   (   R$   R<   R=   (    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyRH   °   s    	N(   R   R	   R   RJ   R   R   R%   R.   R3   R6   R?   RD   RE   RB   RH   (    (    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyR
   &   s*   							R   c   
      K   sE  t  d | |  } t |  t ƒ rB | s0 d } n  |  j | ƒ }  n  | sQ d } n  | j | | ƒ } y t | _ Wn t k
 rƒ n X| j	 | _
 | j | _ | j | _ | j | _ t | _ | ry d }	 | j j |	 t ƒ Wqt k
 rd „  | _ d „  | _ qXn  t |  d ƒ r.| j |  ƒ n | j |  t ƒ | j S(   s  Parse the given XML input and convert it into a dictionary.

    `xml_input` can either be a `string` or a file-like object.

    If `xml_attribs` is `True`, element attributes are put in the dictionary
    among regular child elements, using `@` as a prefix to avoid collisions. If
    set to `False`, they are just ignored.

    Simple example::

        >>> import xmltodict
        >>> doc = xmltodict.parse("""
        ... <a prop="x">
        ...   <b>1</b>
        ...   <b>2</b>
        ... </a>
        ... """)
        >>> doc['a']['@prop']
        u'x'
        >>> doc['a']['b']
        [u'1', u'2']

    If `item_depth` is `0`, the function returns a dictionary for the root
    element (default behavior). Otherwise, it calls `item_callback` every time
    an item at the specified depth is found and returns `None` in the end
    (streaming mode).

    The callback function receives two parameters: the `path` from the document
    root to the item (name-attribs pairs), and the `item` (dict). If the
    callback's return value is false-ish, parsing will be stopped with the
    :class:`ParsingInterrupted` exception.

    Streaming example::

        >>> def handle(path, item):
        ...     print('path:%s item:%s' % (path, item))
        ...     return True
        ...
        >>> xmltodict.parse("""
        ... <a prop="x">
        ...   <b>1</b>
        ...   <b>2</b>
        ... </a>""", item_depth=2, item_callback=handle)
        path:[(u'a', {u'prop': u'x'}), (u'b', None)] item:1
        path:[(u'a', {u'prop': u'x'}), (u'b', None)] item:2

    The optional argument `postprocessor` is a function that takes `path`,
    `key` and `value` as positional arguments and returns a new `(key, value)`
    pair where both `key` and `value` may have changed. Usage example::

        >>> def postprocessor(path, key, value):
        ...     try:
        ...         return key + ':int', int(value)
        ...     except (ValueError, TypeError):
        ...         return key, value
        >>> xmltodict.parse('<a><b>1</b><b>2</b><b>x</b></a>',
        ...                 postprocessor=postprocessor)
        OrderedDict([(u'a', OrderedDict([(u'b:int', [1, 2]), (u'b', u'x')]))])

    You can pass an alternate version of `expat` (such as `defusedexpat`) by
    using the `expat` parameter. E.g:

        >>> import defusedexpat
        >>> xmltodict.parse('<a>hello</a>', expat=defusedexpat.pyexpat)
        OrderedDict([(u'a', u'hello')])

    You can use the force_list argument to force lists to be created even
    when there is only a single child of a given level of hierarchy. The
    force_list argument is a tuple of keys. If the key for a given level
    of hierarchy is in the force_list argument, that level of hierarchy
    will have a list as a child (even if there is only one sub-element).
    The index_keys operation takes precendence over this. This is applied
    after any user-supplied postprocessor has already run.

        For example, given this input:
        <servers>
          <server>
            <name>host1</name>
            <os>Linux</os>
            <interfaces>
              <interface>
                <name>em0</name>
                <ip_address>10.0.0.1</ip_address>
              </interface>
            </interfaces>
          </server>
        </servers>

        If called with force_list=('interface',), it will produce
        this dictionary:
        {'servers':
          {'server':
            {'name': 'host1',
             'os': 'Linux'},
             'interfaces':
              {'interface':
                [ {'name': 'em0', 'ip_address': '10.0.0.1' } ] } } }

        `force_list` can also be a callable that receives `path`, `key` and
        `value`. This is helpful in cases where the logic that decides whether
        a list should be forced is more complex.
    R    s   utf-8s4   http://apache.org/xml/features/disallow-doctype-declc         S   s   d  S(   N(   R   (   t   x(    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyR   A  s    c          W   s   d S(   Ni   (    (   RM   (    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyR   C  s    t   readN(   R
   R/   t   _unicodet   encodeR   t   ParserCreateR   t   ordered_attributest   AttributeErrorR6   t   StartNamespaceDeclHandlerR?   t   StartElementHandlerRD   t   EndElementHandlerRE   t   CharacterDataHandlert   buffer_textt   _readert
   setFeaturet   DefaultHandlert   ExternalEntityRefHandlert   hasattrt	   ParseFilet   ParseR   (
   t	   xml_inputt   encodingR   t   process_namespacesR    t   disable_entitiest   kwargst   handlert   parsert   feature(    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyt   parse»   s>    h						R   c         C   s   | s
 |  Sy |  j  | d ƒ \ } }  Wn t k
 r9 nR X| j | j | ƒ ƒ } | r… d j | j | ƒ rs | n d | | |  ƒ n |  }  |  S(   Ni   s   {}{}{}{}R   (   t   rsplitt
   ValueErrorR'   RA   t   formatt
   startswith(   R,   R!   t   ns_sepR   t   nst   ns_res(    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyt   _process_namespaceK  s    9s   #texti    s   
s   	c         C   s  t  |  | |
 | ƒ }  | d  k	 rO | |  | ƒ } | d  k r@ d  S| \ }  } n  t | d ƒ s} t | t ƒ s} t | t ƒ r‰ | g } n  xÿt | ƒ D]ñ\ } } | rÏ | d k rÏ | d k rÏ t d ƒ ‚ n  | d  k rç t ƒ  } nQ t | t	 ƒ r| rt
 d ƒ } q8t
 d ƒ } n t | t ƒ s8t
 | ƒ } n  t | t ƒ r_t | | f f ƒ } n  d  } t ƒ  } g  } x| j ƒ  D]\ } } | | k r¥| } qn  | j | ƒ rst  | | |
 | ƒ } | d k r;t | t ƒ r;xN | j ƒ  D]@ \ } } d j | rd j | ƒ n d	 ƒ } t
 | ƒ | | <qñWqn  t | t
 ƒ sYt
 | ƒ } n  | | | t | ƒ <qn  | j | | f ƒ qW| r¤| j | |	 ƒ n  | j |  t | ƒ ƒ | rÖ| rÖ| j | ƒ n  xI | D]A \ } } t | | | | | | d
 | | | |	 d | d |
 ƒ
qÝW| d  k	 r>| j | ƒ n  | r^| r^| j | |	 ƒ n  | j |  ƒ | r– | r– | j | ƒ q– q– Wd  S(   Nt   __iter__i    s   document with multiple rootst   truet   falses   @xmlnss   xmlns{}s   :{}R   i   R!   R    (   Rp   R   R]   R/   t   _basestringR0   t	   enumerateRj   R   RK   RO   R:   Rl   Rk   R9   R8   t   ignorableWhitespaceR?   R   t   _emitRE   RD   (   R<   R=   t   content_handlerR   R   t   deptht   preprocessort   prettyt   newlt   indentR    R!   t   full_documentRI   t   indext   vt   cdataR2   t   childrent   ikt   ivt   kt   attrt	   child_keyt   child_value(    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyRw   Z  sx    		$s   utf-8c   
      K   s  | r' t  |  ƒ d k r' t d ƒ ‚ n  t } | d k rK t ƒ  } t } n  | rf t | | t ƒ } n t | | ƒ } | rˆ | j ƒ  n  x3 |  j ƒ  D]% \ } }	 t	 | |	 | d | | q• W| rÑ | j
 ƒ  n  | r| j ƒ  }	 y |	 j | ƒ }	 Wn t k
 r	n X|	 Sd S(   sx  Emit an XML document for the given `input_dict` (reverse of `parse`).

    The resulting XML document is returned as a string, but if `output` (a
    file-like object) is specified, it is written there instead.

    Dictionary keys prefixed with `attr_prefix` (default=`'@'`) are interpreted
    as XML node attributes, whereas keys equal to `cdata_key`
    (default=`'#text'`) are treated as character data.

    The `pretty` parameter (default=`False`) enables pretty-printing. In this
    mode, lines are terminated with `'
'` and indented with `'	'`, but this
    can be customized with the `newl` and `indent` parameters.

    i   s$   Document must have exactly one root.R~   N(   R9   Rj   RJ   R   R   R   R   t   startDocumentR:   Rw   t   endDocumentt   getvaluet   decodeRS   (
   t
   input_dictt   outputRa   R~   t   short_empty_elementsRd   t   must_returnRx   R<   R=   (    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyt   unparse¤  s.    		t   __main__Ni   c         C   s   t  j |  | f t ƒ t S(   N(   t   marshalt   dumpt   stdoutR   (   R   R   (    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyt   handle_itemÜ  s    R   R   R   (1   t   __doc__t   defusedexpatR    R   t   ImportErrort   xml.parserst   xml.sax.saxutilsR   t   xml.sax.xmlreaderR   t	   cStringIOR   t   iot   collectionsR   t
   basestringRt   t	   NameErrort   strt   unicodeRO   t
   __author__t   __version__t   __license__t	   ExceptionR   t   objectR
   R   RJ   R   Rh   Rp   Rw   R‘   R   t   sysR“   t   stdint   bufferR•   RS   t   argvR   t   intR–   R0   t   roott   KeyboardInterrupt(    (    (    sz   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/xmltodict/xmltodict.pyt   <module>   s~   



•	@	*				