def pick(self, _id: str): """ Given an id find the element with the top level id. We aren't searching lower level_ids. After we pull all of the """ self.set_entity() self.keystore.reset() doc = self.client.load_document(_id) dd = doc.__dict__ doc = ADict(**dd) _id = doc.pop("id", None) doc.pop("payload", None) doc_z = len(doc) > 0 if len(self.subs) == 0: if not doc_z: return None doc.update({"id": _id}) return doc if doc_z: sub_dicts = self.find_sub_dictionaries(_id) # if len(sub_dicts) > 0: doc.update(sub_dicts) doc.update({"id": _id}) return doc return None
def single_doc_check_convert(doc): item = doc.__dict__ item_conv = ADict(**item) item_conv_id = item_conv.pop("id", None) item_conv.pop("payload", None) return item_conv, bool(item_conv)
def dictify(doc, is_id=True): item = ADict(**doc.__dict__) item.pop("super_id", None) item.pop("payload", None) if is_id == False: item.pop("id", None) return item
def doc_convert(doc): item = doc.__dict__ item_conv = ADict(**item) # item_conv_id = item_conv.pop("id", None) item_conv.pop("payload", None) return item_conv
def dictify(doc): item = ADict(**doc.__dict__) item.pop("super_id", None) item.pop("payload", None) return item