def _items(self): for x in ordereddict.__iter__(self): yield x, ordereddict.__getitem__(self, x) done = [] # list of processed merge items, kept for masking for merged in getattr(self, merge_attrib, []): for x in merged[1]: if ordereddict.__contains__(self, x): continue for y in done: if x in y: break else: yield x, ordereddict.__getitem__(merged[1], x) done.append(merged[1])
def __getitem__(self, key): try: return ordereddict.__getitem__(self, key) except KeyError: for merged in getattr(self, merge_attrib, []): if key in merged[1]: return merged[1][key] raise
def non_merged_items(self): for x in ordereddict.__iter__(self): yield x, ordereddict.__getitem__(self, x)