piper_plugin.py

来自「这是一个支持向量机的代码」· Python 代码 · 共 31 行

PY
31
字号
from util import GetInputfrom common_interface import Fileimport util,tempfileplugin_name  = "General Command"def create(callback):    command = GetInput(question='Command:')    if not command: return None    return Piper(command,callback)class Piper:    input_description = [('input', File)]    output_description = [('output', None)]    def __init__(self,command,callback):        self.command = command        self.callback = callback    def configure(self):        command = GetInput(question='Command:',default=self.command)        if command:             self.command = command            return True    def run(self,input):        filename = tempfile.mktemp()        f = open(filename,'wb')        cmd = self.command        if input: cmd += '< %s' % input.pathname        util.run_command(cmd, f.write, self.callback.log)        f.close()        return {'output': File(filename)}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?