本文整理匯總了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]),
[])