class FileInputNode(InputNode): label = _(u"File") description = _(u"Read the content of a file") def __init__(self, *args, **kwargs): InputNode.__init__(self, *args, **kwargs) self.filepath = InterfaceValue(self, 'filepath', default='', type=Interface.PARAMETER, slot=False, doc="file to read") self.output = InterfaceStream(self, 'output', default='EOF', type=Interface.OUTPUT, doc="file content") def run(self): # Read file content and pass to output interface if empty(self.filepath.value): raise FlowError(_("Filepath empty, cannot read file.")) self.info(_("Read content of file '%s'") % self.filepath.value) f = open(self.filepath.value, 'rb') for line in f: self.output.write(line) self.output.flush() f.close()
def __init__(self, *args, **kwargs): super(ShellProcessNode, self).__init__(*args, **kwargs) self.stdin = InterfaceStream(self, 'stdin', default='EOF', type=Interface.INPUT, doc="standard input") self.stdout = InterfaceStream(self, 'stdout', default='EOF', type=Interface.OUTPUT, doc="standard output") self.stderr = InterfaceStream(self, 'stderr', default='EOF', type=Interface.OUTPUT, doc="standard error output") self.command = InterfaceValue(self, 'cmd', default='', type=Interface.PARAMETER, slot=False, doc="command to run") self.result = InterfaceValue(self, 'result', default=0, type=Interface.RESULT, doc="execution code return")
def __init__(self, *args, **kwargs): InputNode.__init__(self, *args, **kwargs) self.output = InterfaceStream(self, 'output', default='EOF', type=Interface.OUTPUT, doc="standard input content")
def __init__(self, *args, **kwargs): InputNode.__init__(self, *args, **kwargs) self.filepath = InterfaceValue(self, 'filepath', default='', type=Interface.PARAMETER, slot=False, doc="file to read") self.output = InterfaceStream(self, 'output', default='EOF', type=Interface.OUTPUT, doc="file content")
class CommandLineStdinInputNode(InputNode): label = _(u"CLI Stdin") description = _(u"Read the Command-Line Interface standard input") def __init__(self, *args, **kwargs): InputNode.__init__(self, *args, **kwargs) self.output = InterfaceStream(self, 'output', default='EOF', type=Interface.OUTPUT, doc="standard input content") def run(self): for line in sys.stdin: self.output.write(line) self.output.flush()
def __init__(self, *args, **kwargs): OutputNode.__init__(self, *args, **kwargs) self.outstream = sys.stdout self.input = InterfaceStream(self, 'input', default='EOF', type=Interface.INPUT, doc="standard output")
def __init__(self, *args, **kwargs): OutputNode.__init__(self, *args, **kwargs) self.filepath = InterfaceValue(self, 'filepath', default='', type=Interface.PARAMETER, slot=False, doc="file to write") self.input = InterfaceStream(self, 'input', default='EOF', type=Interface.INPUT, doc="input to write")