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].
- popitem() (k, v), remove and return some (key, value) pair as a [source]¶
2-tuple; but raise KeyError if D is empty.
- 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]