本文整理汇总了Python中solar.dblayer.solar_models.Resource.childs方法的典型用法代码示例。如果您正苦于以下问题:Python Resource.childs方法的具体用法?Python Resource.childs怎么用?Python Resource.childs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solar.dblayer.solar_models.Resource
的用法示例。
在下文中一共展示了Resource.childs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_updated
# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import childs [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)]
示例2: test_resource_childs
# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import childs [as 别名]
def test_resource_childs(rk):
k1 = next(rk)
k2 = next(rk)
k3 = next(rk)
r1 = create_resource(k1, {'name': 'first',
'inputs': {'input1': 10,
'input2': 15}})
r2 = create_resource(k2, {'name': 'first',
'inputs': {'input1': None,
'input2': None}})
r3 = create_resource(k3, {'name': 'first',
'inputs': {'input1': None,
'input2': None}})
r2.connect(r3, {'input1': 'input1'})
r1.connect(r2, {'input1': 'input1'})
r1.save()
r2.save()
r3.save()
assert set(Resource.childs([r1.key])) == {r1.key, r2.key, r3.key}
示例3: load_childs
# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import childs [as 别名]
def load_childs(parents):
return [Resource(r) for r in
DBResource.multi_get(DBResource.childs(parents))]