当前位置: 首页>>代码示例>>Python>>正文


Python Resource.get方法代码示例

本文整理汇总了Python中solar.dblayer.solar_models.Resource.get方法的典型用法代码示例。如果您正苦于以下问题:Python Resource.get方法的具体用法?Python Resource.get怎么用?Python Resource.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在solar.dblayer.solar_models.Resource的用法示例。


在下文中一共展示了Resource.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load

# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import get [as 别名]
def load(name):
    r = DBResource.get(name)

    if not r:
        raise Exception('Resource {} does not exist in DB'.format(name))

    return Resource(r)
开发者ID:Mirantis,项目名称:solar,代码行数:9,代码来源:resource.py

示例2: add_events

# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import get [as 别名]
def add_events(resource, lst):
    resource = Resource.get(resource)
    events = resource.events
    # TODO: currently we don't track mutable objects
    events.extend([ev.to_dict() for ev in lst])
    resource.events = events
    # import pdb; pdb.settrace()
    resource.save_lazy()
开发者ID:aglarendil,项目名称:solar,代码行数:10,代码来源:api.py

示例3: remove_event

# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import get [as 别名]
def remove_event(ev):
    to_remove = ev.to_dict()
    resource = ev.parent
    resource = Resource.get(resource)
    # TODO: currently we don't track mutable objects
    events = resource.events
    events.remove(to_remove)
    resource.events = events
    resource.save_lazy()
开发者ID:aglarendil,项目名称:solar,代码行数:11,代码来源:api.py

示例4: insert

# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import get [as 别名]
 def insert(self, changed_resources, changes_graph):
     changed_resources.append(self.parent_node)
     try:
         location_id = Resource.get(self.parent).inputs['location_id']
     except (DBLayerNotFound, DBLayerSolarException):
         location_id = None
     changes_graph.add_node(
         self.parent_node, status='PENDING',
         target=location_id,
         errmsg='', type='solar_resource',
         args=[self.parent, self.parent_action])
开发者ID:loles,项目名称:solar-1,代码行数:13,代码来源:controls.py

示例5: insert

# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import get [as 别名]
    def insert(self, changed_resources, changes_graph):

        if self.parent_node in changes_graph:
            if self.child_node not in changes_graph:
                try:
                    location_id = Resource.get(self.child).inputs[
                        'location_id']
                except DBLayerNotFound:
                    location_id = None
                changes_graph.add_node(
                    self.child_node, status='PENDING',
                    target=location_id,
                    errmsg='', type='solar_resource',
                    args=[self.child, self.child_action])

            changes_graph.add_edge(
                self.parent_node, self.child_node, state=self.state)
            changed_resources.append(self.child_node)
开发者ID:aglarendil,项目名称:solar,代码行数:20,代码来源:controls.py

示例6: all_events

# 需要导入模块: from solar.dblayer.solar_models import Resource [as 别名]
# 或者: from solar.dblayer.solar_models.Resource import get [as 别名]
def all_events(resource):
    return [create_event(e) for e in Resource.get(resource).events]
开发者ID:aglarendil,项目名称:solar,代码行数:4,代码来源:api.py


注:本文中的solar.dblayer.solar_models.Resource.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。