%PDF- %PDF-
| Direktori : /proc/thread-self/root/proc/3522530/root/lib/python2.7/site-packages/salt/utils/ |
| Current File : //proc/thread-self/root/proc/3522530/root/lib/python2.7/site-packages/salt/utils/odict.pyo |
�
���^c @@ sR d Z d d l m Z m Z m Z y d d l m Z Wn! e k
rY d d l m Z n Xd d l m
Z
y) d d l Z d e j f d � � YZ Wn� e e f k
r7y) d d l
Z
d e
j f d � � YZ Wq8e k
r3y d d l m Z Wn! e k
rd d l m Z n Xd e f d
� � YZ q8Xn Xd e f d � � YZ d S(
u�
:codeauthor: Pedro Algarvio (pedro@algarvio.me)
salt.utils.odict
~~~~~~~~~~~~~~~~
This is a compatibility/"importability" layer for an ordered dictionary.
Tries to import from the standard library if python >= 2.7, then from the
``ordereddict`` package available from PyPi, and, as a last resort,
provides an ``OrderedDict`` implementation based on::
http://code.activestate.com/recipes/576669/
It also implements a DefaultOrderedDict Class that serves as a
combination of ``OrderedDict`` and ``defaultdict``
It's source was submitted here::
http://stackoverflow.com/questions/6190331/
i ( t absolute_importt unicode_literalst print_function( t Callable( t sixNt OrderedDictc B@ s e Z d Z RS( N( t __name__t
__module__t Nonet __hash__( ( ( s4 /usr/lib/python2.7/site-packages/salt/utils/odict.pyR % s c B@ s e Z d Z RS( N( R R R t _OrderedDict__hash_( ( ( s4 /usr/lib/python2.7/site-packages/salt/utils/odict.pyR + s ( t get_identc B@ s
e Z d Z d Z d � Z e j d � Z e j d � Z d � Z d � Z
d � Z e d � Z
d � Z d � Z d
� Z d � Z d � Z d
� Z d � Z e Z e � Z e d � Z d d � Z i d � Z d � Z d � Z e d d � � Z d � Z d � Z RS( u) Dictionary that remembers insertion orderc O@ s� t t | � j � t | � d k rC t d j t | � � � � n y | j Wn7 t k
r� g | _ } | | d g | (i | _ n X| j
| | � d S( u� Initialize an ordered dictionary. Signature is the same as for
regular dictionaries, but keyword arguments are not recommended
because their insertion order is arbitrary.
i u% expected at most 1 arguments, got {0}N( t superR t __init__t lent TypeErrort formatt _OrderedDict__roott AttributeErrorR t _OrderedDict__mapt _OrderedDict__update( t selft argst kwdst root( ( s4 /usr/lib/python2.7/site-packages/salt/utils/odict.pyR
K s
c C@ s\ | | k rH | j } | d } | | | g | d <| d <| j | <n | | | | � d S( u! od.__setitem__(i, y) <==> od[i]=yi i N( R R ( R t keyt valuet dict_setitemR t last( ( s4 /usr/lib/python2.7/site-packages/salt/utils/odict.pyt __setitem__^ s
)c C@ s@ | | | � | j j | � \ } } } | | d <| | d <d S( u od.__delitem__(y) <==> del od[y]i i N( R t pop( R R t dict_delitemt link_prevt link_next( ( s4 /usr/lib/python2.7/site-packages/salt/utils/odict.pyt __delitem__h s
c c@ s= | j } | d } x# | | k r8 | d V| d } q Wd S( u od.__iter__() <==> iter(od)i i N( R ( R R t curr( ( s4 /usr/lib/python2.7/site-packages/salt/utils/odict.pyt __iter__q s
c c@ s= | j } | d } x# | | k r8 | d V| d } q Wd S( u# od.__reversed__() <==> reversed(od)i i N( R ( R R R# ( ( s4 /usr/lib/python2.7/site-packages/salt/utils/odict.pyt __reversed__y s
c C@ sp yK x t j | j � D]
} | 2q W| j } | | d g | (| j j � Wn t k
r^ n Xt j | � d S( u. od.clear() -> None. Remove all items from od.N( R t
itervaluesR R R t clearR t dict( R t nodeR ( ( s4 /usr/lib/python2.7/site-packages/salt/utils/odict.pyR'