

def pb_to_entity(self, pb):
    key = None
    kind = None
    if pb.key().path().element_size():
        key = Key(reference=pb.key())
        kind = key.kind()
    modelclass = Model._lookup_model(kind, self.default_model)
    entity = modelclass._from_pb(pb, key=key, set_key=False)
    if self.want_pbs:
        entity._orig_pb = pb
    return entity

dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/model.py ModelAdapter.pb_to_entity/original