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].