예제 #1
0
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()
예제 #2
0
 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")
예제 #3
0
 def __init__(self, *args, **kwargs):
     InputNode.__init__(self, *args, **kwargs)
     self.output = InterfaceStream(self,
                                   'output',
                                   default='EOF',
                                   type=Interface.OUTPUT,
                                   doc="standard input content")
예제 #4
0
 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")
예제 #5
0
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()
예제 #6
0
 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")
예제 #7
0
파일: file.py 프로젝트: Zincr0/florun
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()
예제 #8
0
 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")
예제 #9
0
파일: file.py 프로젝트: Zincr0/florun
 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")