Exemplo n.º 1
0
 def from_entity(self, entity: datastore.Entity) -> Document:
     data = dict(entity.items())
     if self.pk_field not in data:
         data[self.pk_field] = entity.id
     return self.doc_klass.Meta.from_dict(data=data)
Exemplo n.º 2
0
def entity_asdict(entity: Entity) -> Dict[str, Any]:
    return {
        k: entity_asdict(v) if isinstance(v, Entity) else v
        for k, v in entity.items()
    }