本文整理汇总了Python中grano.model.Entity.by_id_many方法的典型用法代码示例。如果您正苦于以下问题:Python Entity.by_id_many方法的具体用法?Python Entity.by_id_many怎么用?Python Entity.by_id_many使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grano.model.Entity
的用法示例。
在下文中一共展示了Entity.by_id_many方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: convert
# 需要导入模块: from grano.model import Entity [as 别名]
# 或者: from grano.model.Entity import by_id_many [as 别名]
def convert(serp):
ents = Entity.by_id_many([r['id'] for r in serp], request.account)
results = [ents.get(r['id']) for r in serp]
results = [entities.to_rest_index(r) for r in results]
return results
示例2: __iter__
# 需要导入模块: from grano.model import Entity [as 别名]
# 或者: from grano.model.Entity import by_id_many [as 别名]
def __iter__(self):
rows = self.lq.all()
ids = [r[0] for r in rows]
entities = Entity.by_id_many(ids, self.account)
for (id, score) in rows:
yield {"score": int(score), "entity": entities.get(id)}