本文整理汇总了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)})
示例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()
示例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
示例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)
示例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
示例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' ]