def get(self, key, otherwise = None): """Make this a little dict-like looking""" for d in self.stack: value = bm_extract.extract(d, key, otherwise = otherwise) if value != None: return value return None
def Render(self, results, context): results = [] currentd = {} last_grouper = bm_extract.MARKER items = context.as_list(self.input) for itemd in items: grouper = bm_extract.extract(itemd, self.grouper) if grouper == None: continue if grouper != last_grouper: last_grouper = grouper currentd = { "grouper" : grouper, "list" : [], } results.append(currentd) currentd["list"].append(itemd) context[self.output] = results
def get(self, path, **ad): return bm_extract.extract(self.private, path, **ad)