本文整理汇总了Python中vistrails.core.vistrail.controller.VistrailController.add_module方法的典型用法代码示例。如果您正苦于以下问题:Python VistrailController.add_module方法的具体用法?Python VistrailController.add_module怎么用?Python VistrailController.add_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vistrails.core.vistrail.controller.VistrailController
的用法示例。
在下文中一共展示了VistrailController.add_module方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_pipeline
# 需要导入模块: from vistrails.core.vistrail.controller import VistrailController [as 别名]
# 或者: from vistrails.core.vistrail.controller.VistrailController import add_module [as 别名]
def make_pipeline(self):
"""Creates an example pipeline that is used to conduct tests.
"""
vistrail = Vistrail()
controller = VistrailController(vistrail)
controller.change_selected_version(0)
# 0 1 2 7 8
# | / \ \ /
# 3 4 5 9
# | / \
# 6 10 11
modules = [controller.add_module('org.vistrails.vistrails.basic',
'String')
for i in xrange(12)]
def connect(outmod, inmod):
controller.add_connection(
modules[outmod].id,
'value',
modules[inmod].id,
'value')
for (outmod, inmod) in [(0, 3),
(1, 4), (1, 5), (5, 6),
(7, 9), (8, 9), (9, 10), (9, 11)]:
connect(outmod, inmod)
return controller, modules
示例2: test_find_modules_by_type
# 需要导入模块: from vistrails.core.vistrail.controller import VistrailController [as 别名]
# 或者: from vistrails.core.vistrail.controller.VistrailController import add_module [as 别名]
def test_find_modules_by_type(self):
"""Tests the find_modules_by_type() function.
"""
vistrail = Vistrail()
controller = VistrailController(vistrail)
controller.change_selected_version(0)
mod1 = controller.add_module('org.vistrails.vistrails.basic',
'String')
mod2 = controller.add_module('org.vistrails.vistrails.basic',
'Float')
mod3 = controller.add_module('org.vistrails.vistrails.basic',
'String')
mod4 = controller.add_module('org.vistrails.vistrails.basic',
'Integer')
from dat.vistrails_interface import find_modules_by_type
from vistrails.core.modules.basic_modules import Boolean, Float, String
self.assertEqual(
set(m.id for m in find_modules_by_type(
controller.current_pipeline,
[String])),
set([mod1.id, mod3.id]))
self.assertEqual(
[m.id for m in find_modules_by_type(
controller.current_pipeline,
[Float])],
[mod2.id, mod4.id])
self.assertEqual(
find_modules_by_type(
controller.current_pipeline,
[Boolean]),
[])