本文整理汇总了Python中solar.dblayer.solar_models.Resource.multi_get方法的典型用法代码示例。如果您正苦于以下问题:Python Resource.multi_get方法的具体用法?Python Resource.multi_get怎么用?Python Resource.multi_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solar.dblayer.solar_models.Resource
的用法示例。
在下文中一共展示了Resource.multi_get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_by_tags
# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import multi_get [as 别名]
def load_by_tags(tags):
tags = set(tags)
candids_all = set()
for tag in tags:
candids = DBResource.tags.filter(tag)
candids_all.update(set(candids))
return [Resource(r) for r in DBResource.multi_get(candids_all)]
示例2: load_all
# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import multi_get [as 别名]
def load_all(startswith=None):
if startswith:
start = startswith
end = startswith + '~'
candids = DBResource.bucket.get_index("$key", start, end).results
else:
candids = DBResource.updated.filter(StrInt.p_min(), StrInt.p_max())
return [Resource(r) for r in DBResource.multi_get(candids)]
示例3: load_updated
# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import multi_get [as 别名]
def load_updated(since=None, with_childs=True):
if since is None:
startkey = StrInt.p_min()
else:
startkey = since
candids = DBResource.updated.filter(startkey, StrInt.p_max())
if with_childs:
candids = DBResource.childs(candids)
return [Resource(r) for r in DBResource.multi_get(candids)]
示例4: load_by_tags
# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import multi_get [as 别名]
def load_by_tags(query):
if isinstance(query, (list, set, tuple)):
query = '|'.join(query)
parsed_tags = get_string_tokens(query)
r_with_tags = [DBResource.tags.filter(tag) for tag in parsed_tags]
r_with_tags = set(itertools.chain(*r_with_tags))
resources = [Resource(r) for r in DBResource.multi_get(r_with_tags)]
return filter(lambda n: Expression(query, n.tags).evaluate(), resources)
示例5: load_all
# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import multi_get [as 别名]
def load_all():
candids = DBResource.updated.filter(StrInt.p_min(), StrInt.p_max())
return [Resource(r) for r in DBResource.multi_get(candids)]
示例6: load_by_names
# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import multi_get [as 别名]
def load_by_names(names):
return [Resource(r) for r in DBResource.multi_get(names)]
示例7: load_childs
# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import multi_get [as 别名]
def load_childs(parents):
return [Resource(r) for r in
DBResource.multi_get(DBResource.childs(parents))]