
    W'Fg(	                     P    S SK r  " S S\5      rS rS rS rS rS rSS	 jrS
 r	g)    Nc                       \ rS rSrS rSrg)DevError   c                 6    [         R                  U SU-  5        g )Nzprogramming error: %s)RuntimeError__init__)selfmsgs     +/usr/share/virt-manager/virtinst/xmlutil.pyr   DevError.__init__   s    d$;c$AB     N)__name__
__module____qualname____firstlineno__r   __static_attributes__r   r   r   r   r      s    Cr   r   c                 @    U c  / $ [        U [        5      (       d  U /$ U $ )N)
isinstancelist)ls    r   listifyr      s%    y	4  s
r   c                     U (       aZ  U R                  SS5      n U R                  SS5      n U R                  SS5      n U R                  SS5      n U R                  S	S
5      n U $ )z5
Replaces chars ' " < > & with xml safe counterparts
&z&amp;'z&apos;"z&quot;<z&lt;>z&gt;)replace)xmls    r   
xml_escaper!      s\     kk#w'kk#x(kk$)kk#v&kk#v&Jr   c                 r    U nUR                  S5      nUSS  H  n[        X$5      nM     [        X#S   5      $ )zReturn value of attribute identified by `prop_path`

Look up the attribute of `obj` identified by `prop_path`
(separated by "."). If any component along the path is missing an
`AttributeError` is raised.

.N)splitgetattr)obj	prop_pathparentpiecespieces        r   get_prop_pathr,   &   sB     F__S!F'  6":&&r   c                 t    U nUR                  S5      nUSS  H  n[        X55      nM     [        X4S   U5      $ )zSet value of attribute identified by `prop_path`

Set the attribute of `obj` identified by `prop_path` (separated by
".") to `value`. If any component along the path is missing an
`AttributeError` is raised.
r#   Nr$   )r%   r&   setattr)r'   r(   valuer)   r*   r+   s         r   set_prop_pathr0   6   sD     F__S!F'  6":u--r   c                  (    S[         R                  ;   $ )NVIRTINST_TEST_SUITE)osenvironr   r   r   in_testsuiter5   E   s     BJJ..r   c                     SS K nUR                  U R                  S5      UR                  S5      X#S9nSR                  U5      $ )Nr      )fromfiletofile )difflibunified_diff
splitlinesjoin)origstrnewstrr8   r9   r;   dlists         r   diffrB   I   sH      q!6#4#4Q#7 ! .E 775>r   c                     SS K nU R                  5       nU(       d  U $ SnSnUS    H  nUS:w  a    O	US-  nM     U H+  nUR                  SUS-  -  U5      (       a  XdS  nX6S-   -  nM-     U$ )Nr   r:    r7   z	^%s *<.*$
)rer=   match)r    rF   linesretunindentclines          r   unindent_device_xmlrM   Q   s    NNE

CH1X8A 
 88LHsN3T::	?Dd{  Jr   )OriginalNew)
r3   r   r   r   r!   r,   r0   r5   rB   rM   r   r   r   <module>rP      s;    
C| C

' ./r   