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


Python Resource.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import __init__ [as 别名]
    def __init__(self, parentObject=None, resourceDescriptor = {}):
        Resource.__init__(self)
        # The resources dictionary is for subclasses of RESTfulResource, routable as http endpoints
        # The Properties dictionary is for serializable objects and strings, get/put but not routable
        self.Resources = RESTfulDictEndpoint(self.resources) #make resources endpoint from the dictionary
        # make properties resource and it's endpoint
        self._properties = {}
        self.Properties = RESTfulDictEndpoint(self._properties) #make Properties endpoint from its dict
        # make an entry in resources to point to properties
        self.Resources.update({'Properties': self.Properties}) # put Properties into the resource dict
        self.Resources.update({'thisObject': self}) #self-identity
        # initialize Properties by putting in the constructor properties
        
        self._resourceDescriptor = resourceDescriptor # for settings and properties update

        if parentObject == None : #no parent means this is a base object, fill in base settings
            self.Resources.update({'baseObject': self})
            self.Resources.update({'parentObject': self})
            self.Properties.update({'pathFromBase': ''})
            self.Properties.update({'resourceName': 'baseObject'})
            self.Properties.update({'resourceClass': 'SmartObject'})
        else : # fill in properties and identity of parent, base, and path to base
            self.Properties.update({'resourceName': resourceDescriptor['resourceName']}) 
            self.Properties.update({'resourceClass': resourceDescriptor['resourceClass']})
            self.Resources.update({'parentObject' : parentObject.Resources.get('thisObject')})
            self.Resources.update({'baseObject': parentObject.Resources.get('baseObject') })
            self.Properties.update({'pathFromBase': self.Resources.get('parentObject').Properties.get('pathFromBase') \
                                   + '/' + self.Properties.get('resourceName')})
            
        self._parseContentTypes = ['*/*'] 
        self._serializeContentTypes = ['*/*']
        self.defaultResources = None
        
        self.resources.update({'l': ResourceList(self)})
开发者ID:EmuxEvans,项目名称:SmartObject,代码行数:36,代码来源:RESTfulResource.py

示例2: __init__

# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import __init__ [as 别名]
 def __init__(self,max_cores=1,name='Cores'):
     
     Resource.__init__(self)
     
     cores = self.manager.BoundedSemaphore(max_cores)
     
     in_service = InService(     \
         inbox = self.checkinbox ,
         cores = cores           ,
         name  = name+'_checkin' ,
     )        
     
     out_service = OutService(    \
         inbox = self.checkoutbox ,
         cores = cores            ,
         name  = name+'_checkout' ,
     )        
     
     self.name = name
     self.max_cores   = max_cores
     self.cores       = cores
     self.in_service  = in_service
     self.out_service = out_service
     
     self.start()
开发者ID:Aircraft-Design-UniNa,项目名称:SUAVE,代码行数:27,代码来源:ComputeCores.py

示例3: __init__

# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import __init__ [as 别名]
    def __init__(self, name):
        Resource.__init__(self, name)

        self._registry = {}
        self._resources = {}

        return
开发者ID:Netflix,项目名称:vmaf,代码行数:9,代码来源:ResourceManager.py

示例4: __init__

# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import __init__ [as 别名]
 def __init__(self, appName="", AVs=None, executions=None):
    Resource.__init__(self,appName,"application")
    if AVs == None:
       self.attributes = []
    else:
       self.attributes = []
       self.addAttributes(AVs)
    if executions == None:
       self.executions = []
    else:
       self.executions = []
       self.addExecutions(executions)
开发者ID:heathharrelson,项目名称:PerfTrack,代码行数:14,代码来源:Application.py

示例5: __init__

# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import __init__ [as 别名]
 def __init__(self, resName="", AttrVals=None):
     Resource.__init__(self, resName, "execution", AttrVals)
     self.performanceResults = []
     self.application = None
开发者ID:heathharrelson,项目名称:PerfTrack,代码行数:6,代码来源:Execution.py

示例6: __init__

# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import __init__ [as 别名]
 def __init__(self):
     Resource.__init__(self)
     self._parseContentTypes = [] 
     self._serializeContentTypes = []
     self.defaultClass = 'RESTfulResource' # class name, override in derived classes
     self.wellKnownClasses = [ 'Description' , 'Observers' , 'PropertyOfInterest' , 'SmartObject' , 'RESTfulResource' , 'Agent' ]
开发者ID:OSIOT,项目名称:OBSOLETE-IoT-Toolkit,代码行数:8,代码来源:RESTfulResource.py


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