pds4_tools.extern.ordered_dict module

class OrderedDict(*args, **kwds)[source]

Bases: dict

Dictionary that remembers insertion order, for Python 2.6 and below

Code from: http://code.activestate.com/recipes/576693/ An inherited dict maps keys to values. The inherited dict provides __getitem__, __len__, __contains__, and get. The remaining methods are order-aware. Big-O running times for all methods are the same as for regular dictionaries.

The internal self.__map dictionary maps keys to links in a doubly linked list. The circular doubly linked list starts and ends with a sentinel element. The sentinel element never gets deleted (this simplifies the algorithm). Each link is stored as a list of length three: [PREV, NEXT, KEY].

clear() None.  Remove all items from D.[source]
popitem() (k, v), remove and return some (key, value) pair as a[source]

2-tuple; but raise KeyError if D is empty.

keys() a set-like object providing a view on D's keys[source]
values() an object providing a view on D's values[source]
items() a set-like object providing a view on D's items[source]
iterkeys()[source]
itervalues()[source]
iteritems()[source]
update([E, ]**F) None.  Update D from dict/iterable E and F.[source]

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

pop(k[, d]) v, remove specified key and return the corresponding value.[source]

If key is not found, d is returned if given, otherwise KeyError is raised

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D[source]
copy() a shallow copy of D[source]
classmethod fromkeys(iterable, value=None)[source]
viewkeys()[source]
viewvalues()[source]
viewitems()[source]