Viewing File: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pyc
ó
-ÎP`c @ sZ d d l m Z d „ Z d e f d „ ƒ YZ d „ Z d „ Z d „ Z e d „ Z d S(
iÿÿÿÿ( t ElementTreec C s | | j d ƒ d S( Nt }i ( t find( t tag( ( s: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pyt _ns
s t
XmlDictObjectc B s\ e Z d Z d d „ Z d „ Z d „ Z d „ Z e d „ ƒ Z e d „ ƒ Z
d „ Z RS( sD
Adds object like functionality to the standard dictionary.
c C s) | d k r i } n t j | | ƒ d S( N( t Nonet dictt __init__( t selft initdict( ( s: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pyR s c C s
| j | ƒ S( N( t __getitem__( R t item( ( s: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pyt __getattr__ s c C s | j | | ƒ d S( N( t __setitem__( R R t value( ( s: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pyt __setattr__ s c C s! d | k r | j d ƒ Sd Sd S( Nt _textt ( R ( R ( ( s: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pyt __str__ s
c C s` t | t ƒ r) t d „ | j ƒ Dƒ ƒ St | t ƒ rX g | D] } t j | ƒ ^ q? S| Sd S( sT
Static method to wrap a dictionary recursively as an XmlDictObject
c s s* | ] \ } } | t j | ƒ f Vq d S( N( R t wrap( t .0t kt v( ( s: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pys <genexpr>* s N( t
isinstanceR R t itemst listR ( t xR ( ( s: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pyR # s c C s` t | t ƒ r) t d „ | j ƒ Dƒ ƒ St | t ƒ rX g | D] } t j | ƒ ^ q? S| Sd S( Nc s s* | ] \ } } | t j | ƒ f Vq d S( N( R t _un_wrap( R R R ( ( s: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pys <genexpr>4 s ( R R R R R R ( R R ( ( s: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pyR 0 s c C s
t j | ƒ S( sp
Recursively converts an XmlDictObject to a standard dictionary and
returns the result.
( R R ( R ( ( s: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pyt un_wrap: s N( t __name__t
__module__t __doc__R R R
R R t staticmethodR R R ( ( ( s: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pyR s
c C sð t | t ƒ s t ‚ t | t ƒ rÝ xÅ | j ƒ D]¥ \ } } t | ƒ d k ra t | ƒ | _ q1 t | t ƒ r xc | D]/ } t j | ƒ } | j | ƒ t
| | ƒ qw Wq1 t j | ƒ } | j | ƒ t
| | ƒ q1 Wn t | ƒ | _ d S( NR ( R R t AssertionErrorR t strt textR R t Elementt appendt _convert_dict_to_xml_recurse( t parentt dictitemR t childt listchildt elem( ( s: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pyR' B s
c C s: t | j ƒ ƒ d } t j | ƒ } t | | | ƒ | S( s=
Converts a dictionary to an XML ElementTree Element
i ( R t keysR R% R' ( t xmldictt roottagt root( ( s: /usr/lib/python2.7/site-packages/lsm/external/xmltodict.pyt convert_dict_to_xmlW s c C s¤ | ƒ } t t | j ƒ ƒ ƒ d k r‰ d | k rY | d j t t | j ƒ ƒ ƒ ƒ q‰ i | d <| d j t t | j ƒ ƒ ƒ ƒ n x§ | D]Ÿ } t | | ƒ } t | j ƒ | k rt | t | j ƒ t ƒ ró | t | j ƒ j | ƒ q/| t | j ƒ | g | t | j ƒ <q | | t | j ƒ <q W| j
d k rKd } n | j
j ƒ } t | ƒ d k rš| d k r t | ƒ d k r | | d <q n | } | S( Ni t attribR (
t lenR R t updateR t _convert_xml_to_dict_recurseR R R R&