Run the provided script and return its output.  If wait_output is True
        (default) then wait for the script to finish and then print its output,
        otherwise just run the script and don't wait for any output.
515725
def run(self, filename, wait_output=True):
        
        self._pyboard.enter_raw_repl()
        out = None
        if wait_output:
            # Run the file and wait for output to return.
            out = self._pyboard.execfile(filename)
        else:
            # Read the file and run it using lower level pyboard functions that
            # won't wait for it to finish or return output.
            with open(filename, "rb") as infile:
                self._pyboard.exec_raw_no_follow(infile.read())
        self._pyboard.exit_raw_repl()
        return out
108906
def run(self):
        
        while True:
            msg = self._queue.get()
            if msg is _SHUTDOWN:
                break
            if self._enabled:
                print msg
95227
def execute_python_script(self, script):
        
        # Create the local file to copy to remote
        file_handle, filename = tempfile.mkstemp()
        temp_file = os.fdopen(file_handle, "wt")
        temp_file.write(script)
        temp_file.close()

        # Put the file into the remote user directory
        self.put(filename, "python_execute.py")
        command = ["python", "python_execute.py"]

        # Execute the python script on the remote system, clean up, and return the output
        output = self.execute(command, False)
        self.remove("python_execute.py")
        os.unlink(filename)
        return output
1043236
def waitResult(self):
    
    self.thread.execute_queue.join()
    try:
      e = self.thread.exception_queue[threading.get_ident()].get_nowait()
    except queue.Empty:
      return self.thread.result_queue[threading.get_ident()].get_nowait()
    else:
      raise e
1032719
public void executeScript(String pythonScript, PythonOutputHandler outputHandler) {
    // Check if Python is installed
    File file = new File(pythonScriptExecutable);
    if (!file.exists()) {
      throw new MolgenisPythonException("File [" + pythonScriptExecutable + "] does not exist");
    }

    // Check if Python has execution rights
    if (!file.canExecute()) {
      throw new MolgenisPythonException(
          "Can not execute [" + pythonScriptExecutable + "]. Does it have executable permissions?");
    }

    Path tempFile = null;
    try {
      tempFile = Files.createTempFile(null, ".py");
      Files.write(tempFile, pythonScript.getBytes(UTF_8), StandardOpenOption.WRITE);
      String tempScriptFilePath = tempFile.toAbsolutePath().toString();

      // Create r process
      LOG.info("Running python script [{}]", tempScriptFilePath);
      Process process =
          Runtime.getRuntime().exec(getCommand(pythonScriptExecutable, tempScriptFilePath));

      // Capture the error output
      final StringBuilder sb = new StringBuilder();
      PythonStreamHandler errorHandler =
          new PythonStreamHandler(
              process.getErrorStream(), output -> sb.append(output).append("\n"));
      errorHandler.start();

      // Capture r output if an Python output handler is defined
      if (outputHandler != null) {
        PythonStreamHandler streamHandler =
            new PythonStreamHandler(process.getInputStream(), outputHandler);
        streamHandler.start();
      }

      // Wait until script is finished
      process.waitFor();

      // Check for errors
      if (process.exitValue() > 0) {
        throw new MolgenisPythonException(
            "Error running [" + tempScriptFilePath + "]." + sb.toString());
      }

      LOG.info("Script [{}] done", tempScriptFilePath);
    } catch (IOException e) {
      throw new MolgenisPythonException("Exception executing PythonScipt.", e);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new MolgenisPythonException("Exception waiting for PythonScipt to finish", e);
    } finally {
      if (tempFile != null) {
        try {
          Files.delete(tempFile);
        } catch (IOException e) {
          LOG.error("", e);
        }
      }
    }
  }
619628
def execute
      return unless @start && @limit
      @next_to_insert = @start
      while @next_to_insert <= @limit
        stride = @throttler.stride
        affected_rows = @connection.update(copy(bottom, top(stride)))

        if @throttler && affected_rows > 0
          @throttler.run
        end

        @printer.notify(bottom, @limit)
        @next_to_insert = top(stride) + 1
        break if @start == @limit
      end
      @printer.end
    end
1196881
def run(cmd):
    

    status, output = commands.getstatusoutput(cmd)
    if status:
        print(output)
    return status == 0
879806
def run(self):
        
        if not self.block:
            self.output = []
            self.error = []
            self.thread = threading.Thread(target=self.run_non_blocking)
            self.thread.start()
        else:
            self.__create_process()
            self.process.wait()
            if self._stdout is not None:
                self.output = self.process.stdout.read().decode("utf-8")
            if self._stderr is not None:
                self.error = self.process.stderr.read().decode("utf-8")
            self.return_code = self.process.returncode

        return self
721801
def run(command, get_output=False, cwd=None):
    
    if cwd is None:
        cwd = GITPATH

    cprint('===')
    cprint('===  Command: ', command)
    cprint('===  CWD:     ', cwd)
    cprint('===')

    if get_output:
        proc = capture_stdout(command, cwd=cwd)
        out = proc.stdout.read().decode()
        print(out, end='')
        check_exit_code(proc.returncode)
        return out
    else:
        proc = sarge_run(command, cwd=cwd)
        check_exit_code(proc.returncode)
215358
def run_command(command):
    
    try:
        check_ouput = getattr(
            subprocess, 'check_output', subprocess.check_call)
        result = check_ouput(command, stderr=subprocess.STDOUT, shell=True)
        if check_ouput.__name__ == 'check_output':
            return 0, result
        else:
            return result, None
    except subprocess.CalledProcessError as e:
        return e.returncode, getattr(e, 'output', None)
133687
def run(self):
        
        if self.running or self.finished:
            return
        try:
            self.running = True
            while True:
                future = self.future
                if not future.done():
                    return
                self.future = None
                try:
                    orig_stack_contexts = stack_context._state.contexts
                    exc_info = None

                    try:
                        value = future.result()
                    except Exception:
                        self.had_exception = True
                        exc_info = sys.exc_info()
                    future = None

                    if exc_info is not None:
                        try:
                            yielded = self.gen.throw(*exc_info)
                        finally:
                            # Break up a reference to itself
                            # for faster GC on CPython.
                            exc_info = None
                    else:
                        yielded = self.gen.send(value)

                    if stack_context._state.contexts is not orig_stack_contexts:
                        self.gen.throw(
                            stack_context.StackContextInconsistentError(
                                'stack_context inconsistency (probably caused '
                                'by yield within a "with StackContext" block)'))
                except (StopIteration, Return) as e:
                    self.finished = True
                    self.future = _null_future
                    if self.pending_callbacks and not self.had_exception:
                        # If we ran cleanly without waiting on all callbacks
                        # raise an error (really more of a warning).  If we
                        # had an exception then some callbacks may have been
                        # orphaned, so skip the check in that case.
                        raise LeakedCallbackError(
                            "finished without waiting for callbacks %r" %
                            self.pending_callbacks)
                    self.result_future.set_result(_value_from_stopiteration(e))
                    self.result_future = None
                    self._deactivate_stack_context()
                    return
                except Exception:
                    self.finished = True
                    self.future = _null_future
                    self.result_future.set_exc_info(sys.exc_info())
                    self.result_future = None
                    self._deactivate_stack_context()
                    return
                if not self.handle_yield(yielded):
                    return
                yielded = None
        finally:
            self.running = False
635653
def run(self, output=None, error=None):
        

        pylint_output = output if output is not None else sys.stdout
        pylint_error = error if error is not None else sys.stderr
        savedout, savederr = sys.__stdout__, sys.__stderr__
        sys.stdout = pylint_output
        sys.stderr = pylint_error

        pylint_files = self.get_files_from_dir(os.curdir)
        self._print_line(
            "Using pylint "
            + colorama.Fore.RED
            + pylint.__version__
            + colorama.Fore.RESET
            + " for python "
            + colorama.Fore.RED
            + PYTHON_VERSION
            + colorama.Fore.RESET
        )

        self._print_line("pylint running on the following files:")
        for pylint_file in pylint_files:
            # we need to recast this as a string, else pylint enters an endless recursion
            split_file = str(pylint_file).split("/")
            split_file[-1] = colorama.Fore.CYAN + split_file[-1] + colorama.Fore.RESET
            pylint_file = "/".join(split_file)
            self._print_line("- " + pylint_file)
        self._print_line("----")

        if not self._is_using_default_rcfile():
            self.args += ["--rcfile={}".format(self.rcfile)]

        exit_kwarg = {"do_exit": False}

        run = pylint.lint.Run(self.args + pylint_files, **exit_kwarg)
        sys.stdout = savedout
        sys.stderr = savederr

        sys.exit(run.linter.msg_status)
648244
def _wait_for_output(self):
        
        # Here we should get an empty list or list with a tuple [(fd, event)]
        # When we get list with a tuple we can use readline method on
        # the file descriptor.
        poll_result = self.poll_obj.poll(0)

        if poll_result:
            line = self.output().readline()
            if self._banner.match(line):
                return True

        return False
1155591
def output_callback(self, out, process_status):
        
        self.final_status.append(process_status)
        self.final_output.append(out)
81768
async def stdout(self) -> AsyncGenerator[str, None]:
        """"""
        await self.wait_running()
        async for line in self._subprocess.stdout:  # type: ignore
            yield line
291821
def wait(self):
        
        self.thread.join()
        if self.error is not None:
            return self.error
        return self.result
165252
def wait_for_start(self):
        
        er = self.exec_rabbitmqctl(
            'wait', ['--pid', '1', '--timeout', str(int(self.wait_timeout))])
        output_lines(er, error_exc=TimeoutError)