<s> """<STR_LIT>""" <EOL> import vistrails . core . modules <EOL> import vistrails . core . modules . module_registry <EOL> from vistrails . core . modules . vistrails_module import Module , ModuleError , NotCacheable <EOL> from vistrails . core . modules . basic_modules import Float , Integer <EOL> identifier = '<STR_LIT>' <EOL> version = '<STR_LIT>' <EOL> name = '<STR_LIT>' <EOL> old_identifiers = [ '<STR_LIT>' ] <EOL> class TestTupleExecution ( Module ) : <EOL> def compute ( self ) : <EOL> v1 , v2 = self . get_input ( '<STR_LIT:input>' ) <EOL> self . set_output ( '<STR_LIT>' , v1 + v2 ) <EOL> class TestDynamicModuleError ( Module ) : <EOL> def compute ( self ) : <EOL> c = TestDynamicModuleError ( ) <EOL> c . die ( ) <EOL> def die ( self ) : <EOL> raise ModuleError ( self , "<STR_LIT>" ) <EOL> class TestChangeVistrail ( NotCacheable , Module ) : <EOL> def compute ( self ) : <EOL> if self . has_input ( '<STR_LIT:foo>' ) : <EOL> v1 = self . get_input ( '<STR_LIT:foo>' ) <EOL> else : <EOL> v1 = <NUM_LIT:0> <EOL> if v1 != <NUM_LIT:12> : <EOL> self . change_parameter ( '<STR_LIT:foo>' , v1 + <NUM_LIT:1> ) <EOL> class TestCustomNamed ( Module ) : <EOL> pass <EOL> class TestOptionalPorts ( Module ) : <EOL> pass <EOL> def initialize ( ) : <EOL> reg = vistrails . core . modules . module_registry . get_module_registry ( ) <EOL> reg . add_module ( TestTupleExecution ) <EOL> reg . add_input_port ( TestTupleExecution , '<STR_LIT:input>' , [ Float , Float ] ) <EOL> reg . add_output_port ( TestTupleExecution , '<STR_LIT>' , ( Float , '<STR_LIT>' ) ) <EOL> reg . add_module ( TestDynamicModuleError ) <EOL> reg . add_module ( TestChangeVistrail ) <EOL> reg . add_input_port ( TestChangeVistrail , '<STR_LIT:foo>' , Integer ) <EOL> reg . add_module ( TestCustomNamed , name = '<STR_LIT>' ) <EOL> reg . add_input_port ( TestCustomNamed , '<STR_LIT:input>' , Float ) <EOL> reg . add_module ( TestOptionalPorts ) <EOL> reg . add_input_port ( TestOptionalPorts , '<STR_LIT:foo>' , Float , optional = True ) <EOL> reg . add_output_port ( TestOptionalPorts , '<STR_LIT:foo>' , Float , optional = True ) </s>
