本文整理汇总了Python中bamboo.models.calculation.Calculation.create_from_list_or_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Calculation.create_from_list_or_dict方法的具体用法?Python Calculation.create_from_list_or_dict怎么用?Python Calculation.create_from_list_or_dict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bamboo.models.calculation.Calculation
的用法示例。
在下文中一共展示了Calculation.create_from_list_or_dict方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: action
# 需要导入模块: from bamboo.models.calculation import Calculation [as 别名]
# 或者: from bamboo.models.calculation.Calculation import create_from_list_or_dict [as 别名]
def action(dataset):
if json_file:
calculations = safe_json_loads(json_file.file.read())
Calculation.create_from_list_or_dict(dataset, calculations)
success_message = "created calculations from JSON for dataset" ":%s" % dataset_id
elif formula is None or name is None:
raise ArgumentError("Must provide both formula and name argume" "nts, or json_file argument")
else:
Calculation.create(dataset, formula, name, group)
success_message = "created calculation: %s for dataset: %s" % (name, dataset_id)
return {self.SUCCESS: success_message}
示例2: action
# 需要导入模块: from bamboo.models.calculation import Calculation [as 别名]
# 或者: from bamboo.models.calculation.Calculation import create_from_list_or_dict [as 别名]
def action(dataset):
if json_file:
calculations = safe_json_loads(json_file.file.read())
Calculation.create_from_list_or_dict(dataset, calculations)
success_message = 'created calculations from JSON'
elif formula is None or name is None:
raise ArgumentError('Must provide both formula and name argume'
'nts, or json_file argument')
else:
Calculation.create(dataset, formula, name, group)
return self._success('created calculation: %s' % name, dataset_id)
示例3: _action
# 需要导入模块: from bamboo.models.calculation import Calculation [as 别名]
# 或者: from bamboo.models.calculation.Calculation import create_from_list_or_dict [as 别名]
def _action(dataset):
if json_file:
calculations = json.loads(json_file.file.read())
Calculation.create_from_list_or_dict(dataset, calculations)
success_message = ('created calculations from JSON for dataset'
':%s' % dataset_id)
elif formula is None or name is None:
raise ArgumentError('Must provide both formula and name argume'
'nts, or json_file argument')
else:
Calculation.create(dataset, formula, name, group)
success_message = 'created calculation: %s for dataset: %s' % (
name, dataset_id)
return {self.SUCCESS: success_message}