intended to be run as background thread to collect parser output
779378
def read_output_lines(self):
        ""
        while True:
            chars = self.corenlp_process.stdout.readline()
            if chars == '':  # EOF
                break
            self.out.write(chars)
768976
def run(cls):
        
        sigint_handler.override()
        # set settings.USE_CACHE before constructing parser, since constructing
        # parser requires loaded assistants
        settings.USE_CACHE = False if '--no-cache' in sys.argv else True
        cls.register_console_logging_handler(logger.logger)
        is_log_file = logger.add_log_file_handler(settings.LOG_FILE)
        if not is_log_file:
            logger.logger.warning("Could not create log file '{0}'.".format(settings.LOG_FILE))
        cls.inform_of_short_bin_name(sys.argv[0])
        top_assistant = bin.TopAssistant()
        tree = top_assistant.get_subassistant_tree()
        argparser = argparse_generator.ArgparseGenerator.\
            generate_argument_parser(tree, actions=actions.actions)
        parsed_args = vars(argparser.parse_args())

        parsed_args_decoded = dict()
        for k, v in parsed_args.items():
            parsed_args_decoded[k] = \
                v.decode(utils.defenc) if not six.PY3 and isinstance(v, str) else v
        parsed_args_decoded['__ui__'] = 'cli'

        if parsed_args.get('da_debug'):
            cls.change_logging_level(logging.DEBUG)

        # Prepare Action/PathRunner
        if actions.is_action_run(**parsed_args_decoded):
            to_run = actions.get_action_to_run(**parsed_args_decoded)(**parsed_args_decoded)
        else:
            parsed_args = cls.transform_executable_assistant_alias(parsed_args_decoded)
            path = top_assistant.get_selected_subassistant_path(**parsed_args_decoded)
            to_run = path_runner.PathRunner(path, parsed_args_decoded)

        try:
            to_run.run()
        except exceptions.ExecutionException:
            # error is already logged, just catch it and silently exit here
            sys.exit(1)
281140
def run
      if result = analyze
        synthesize(result)
      else
        puts parser.failure
        exit ERRNO_PARSE_ERROR
      end
    end
201807
def capture_output_from_running_process(context: RunContext) -> None:
    
    # Get the raw output one line at a time
    _output = context.capture.readline(block=False)

    if _output:

        line = decode_and_filter(_output, context)

        if line:
            if not context.mute:

                # Print in real time
                _LOGGER_PROCESS.debug(line)

            # Buffer the line
            context.process_output_chunks.append(line)

        # Get additional output if any
        return capture_output_from_running_process(context)

    return None
208993
private void writeRead() {
		// Execute on background thread as we don't know how large this is
		new AsyncTask<Void, Void, Void>() {
			@Override
			protected Void doInBackground(Void... params) {
				// Get editor & basic variables
				SharedPreferences.Editor editor = mPrefs.edit();
				int size = readList.size();
				boolean value;

				editor.putInt("READ_ARRAY_SIZE", size);
				for(int i = 0, key; i < size; i++) {
					key = readList.keyAt(i);
					value = readList.get(key);

					editor.putInt("READ_ARRAY_KEY_" + i, key);
					editor.putBoolean("READ_ARRAY_VALUE_" + i, value);
				}
				editor.commit();

				return null;
			}
		}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
	}
1057477
def output_capturing():
    """"""
    out = sys.stdout

    sys.stdout = StringIO()

    try:
        yield

    finally:
        sys.stdout = out
662830
def run_updater_in_background(self):
        
        thread = threading.Thread(target=self.updater_loop())
        thread.daemon = True
        thread.start()
1188472
public void executeInBackground() 
    {
        
        Thread t = new Thread() {

            public void run() {
                try{
                    execute();
                }catch(Exception e) {
                    notifyException(e);
                }
            }
        };
        
        t.start();
        
    }
1203316
def main(github_token, github_api_url, progress):
    """"""
    global progress_reporter_cls
    progress_reporter_cls.reportProgress = sys.stdout.isatty() and progress
    if progress_reporter_cls.reportProgress:
        progress_reporter_cls = _progress_bar
    global _github_token_cli_arg
    _github_token_cli_arg = github_token
    global _github_api_url
    _github_api_url = github_api_url
801106
@Override
  public synchronized void start() {
    if (thread != null) {
      throw new IllegalThreadStateException("Parser already started");
    }

    String name = getThreadName() + "(" + getUri().toString() + ")";

    CountDownLatch startSignal = new CountDownLatch(1);
    Runnable runnable = getRunnable(startSignal);

    thread = new Thread(runnable, name);
    thread.start();

    // Block until the thread has started
    try {
      startSignal.await();
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
    }
  }
1282799
def main():
    """"""
    # Prepare.
    if os.name == 'nt':
        locale.setlocale(locale.LC_ALL, 'english-us')
    else:
        locale.resetlocale()
    response = requests.get(OPTIONS['<url>'], stream=True)
    content_length = None if OPTIONS['--ignore-length'] else int(response.headers.get('Content-Length'))
    progress_bar = ProgressBarWget(content_length, eta_every=4)
    thread = DownloadThread(response)
    print_every_seconds = 0.25

    # Download.
    thread.start()
    while True:
        progress_bar.numerator = thread.bytes_downloaded
        print(progress_bar, end='\r')
        sys.stdout.flush()

        # For undefined downloads (no content-length), check if thread has stopped. Loop only checks defined downloads.
        if not thread.isAlive():
            progress_bar.force_done = True
            break
        if progress_bar.done:
            break

        time.sleep(print_every_seconds)
    print(progress_bar)
1363474
def output_before_run(self, run):
        
        # output in terminal
        runSet = run.runSet
        try:
            OutputHandler.print_lock.acquire()

            try:
                runSet.started_runs += 1
            except AttributeError:
                runSet.started_runs = 1

            timeStr = time.strftime("%H:%M:%S", time.localtime()) + "   "
            progressIndicator = " ({0}/{1})".format(runSet.started_runs, len(runSet.runs))
            terminalTitle = TERMINAL_TITLE.format(runSet.full_name + progressIndicator)
            if self.benchmark.num_of_threads == 1:
                util.printOut(terminalTitle + timeStr + self.format_sourcefile_name(run.identifier, runSet), '')
            else:
                util.printOut(terminalTitle + timeStr + "starting   " + self.format_sourcefile_name(run.identifier, runSet))
        finally:
            OutputHandler.print_lock.release()
174126
def hog(concurrency, requests, limit, timeout,
        params, paramfile, headers, headerfile, method, url):
    ''''''

    params = parse_from_list_and_file(params, paramfile)
    headers = parse_from_list_and_file(headers, headerfile)

    # Running information
    click.echo(HR)
    click.echo("Hog is running with {} threads, ".format(concurrency) +
          "{} requests ".format(requests) +
          "and timeout in {} second(s).".format(timeout))
    if limit != 0:
        click.echo(">>> Limit: {} request(s) per second.".format(limit))
    click.echo(HR)

    # Let's begin!
    result = Hog(callback).run(url, params, headers, method, timeout, concurrency, requests, limit)

    sys.stdout.write("\n")
    print_result(result)
797392
public static void main(String[] args) throws Exception {
        OptionParser parser = null;
        OptionSet options = null;
        try {
            parser = getParser();
            options = parser.parse(args);
        } catch(OptionException oe) {
            parser.printHelpOn(System.out);
            printUsageAndDie("Exception when parsing arguments : " + oe.getMessage());
            return;
        }

        /* validate options */
        if(options.has("help")) {
            parser.printHelpOn(System.out);
            printUsage();
            return;
        }
        if(!options.hasArgument("url") || !options.hasArgument("in-dir")
           || !options.hasArgument("out-dir")) {
            parser.printHelpOn(System.out);
            printUsageAndDie("Missing a required argument.");
            return;
        }

        String url = (String) options.valueOf("url");

        String inDir = (String) options.valueOf("in-dir");
        Utils.mkdirs(new File(inDir));

        String outDir = (String) options.valueOf("out-dir");
        Utils.mkdirs(new File(outDir));

        List<String> storeNames = null;
        if(options.hasArgument("store-names")) {
            @SuppressWarnings("unchecked")
            List<String> list = (List<String>) options.valuesOf("store-names");
            storeNames = list;
        }

        Integer keyParallelism = DEFAULT_KEY_PARALLELISM;
        if(options.hasArgument("parallelism")) {
            keyParallelism = (Integer) options.valueOf("parallelism");
        }

        Integer progressPeriodOps = DEFAULT_PROGRESS_PERIOD_OPS;
        if(options.hasArgument("progress-period-ops")) {
            progressPeriodOps = (Integer) options.valueOf("progress-period-ops");
        }

        Integer outputBatchSize = DEFAULT_OUTPUT_BATCH_SIZE;
        if(options.hasArgument("output-batch-size")) {
            outputBatchSize = (Integer) options.valueOf("output-batch-size");
        }

        boolean details = options.has("details");

        try {
            KeyVersionFetcherCLI sampler = new KeyVersionFetcherCLI(url,
                                                                    inDir,
                                                                    outDir,
                                                                    storeNames,
                                                                    keyParallelism,
                                                                    progressPeriodOps,
                                                                    outputBatchSize,
                                                                    details);

            try {
                if(!sampler.sampleStores()) {
                    logger.error("Key-versions were not successfully sampled from some stores.");
                }
            } finally {
                sampler.stop();
            }

        } catch(Exception e) {
            logger.error("Exception during key-version sampling: ", e);
        }
    }
63840
public void run()
    {
        if(evalOnly)
            throw new RuntimeException("bsh Interpreter: No stream");

        /*
          We'll print our banner using eval(String) in order to
          exercise the parser and get the basic expression classes loaded...
          This ameliorates the delay after typing the first statement.
        */
        if ( interactive && null == getParent() ) try {
            eval("printBanner();");
        } catch ( EvalError e ) {
            println( "BeanShell " + VERSION );
        }

        // init the callstack.
        CallStack callstack = new CallStack( globalNameSpace );

        SimpleNode node = null;
        EOF = false;
        int idx = -1;
        while( !Thread.interrupted() && !EOF )
        {
            try
            {
                if ( interactive )
                    console.prompt(getBshPrompt());

                EOF = readLine();

                if( get_jjtree().nodeArity() > 0 )  // number of child nodes
                {

                    node = (SimpleNode) (get_jjtree().rootNode());
                    // nodes remember from where they were sourced
                    node.setSourceFile( sourceFileInfo );

                    if( DEBUG.get() )
                        node.dump(">");
                    if ( TRACE )
                        println( "// " +node.getText() );


                    Object ret = node.eval( callstack, this );

                    // sanity check during development
                    if ( callstack.depth() > 1 )
                        throw new InterpreterError(
                            "Callstack growing: "+callstack);

                    if(ret instanceof ReturnControl)
                        ret = ((ReturnControl)ret).value;

                    if (interactive) {
                        if( ret != Primitive.VOID )
                        {
                            setu("$_", ret);
                            setu("$"+(++idx%10), ret);
                            if ( showResults )
                                println("--> $" + (idx%10) + " = " + StringUtil.typeValueString(ret));
                        } else if ( showResults )
                            println("--> void");
                    }
                }
            }
            catch(ParseException e)
            {
                error("Parser Error: " + e.getMessage(DEBUG.get()));
                if ( DEBUG.get() )
                    e.printStackTrace();
                if( !interactive )
                    EOF = true;
                parser.reInitInput(getIn());
            }
            catch(InterpreterError e)
            {
                error("Internal Error: " + e.getMessage());
                if(!interactive)
                    EOF = true;
            }
            catch(TargetError e)
            {
                error("Target Exception: " + e.getMessage() );
                if ( e.inNativeCode() )
                    e.printStackTrace( DEBUG.get(), getErr() );
                if(!interactive)
                    EOF = true;
                setu("$_e", e.getTarget());
            }
            catch (EvalError e)
            {
                if ( interactive )
                    error( "Evaluation Error: "+e.getMessage() );
                else
                    error( "Evaluation Error: "+e.getRawMessage() );
                if(DEBUG.get())
                    e.printStackTrace();
                if(!interactive)
                    EOF = true;
            }
            catch(Exception e)
            {
                error("Unknown error: " + e);
                if ( DEBUG.get() )
                    e.printStackTrace();
                if(!interactive)
                    EOF = true;
            }
            finally
            {
                get_jjtree().reset();
                // reinit the callstack
                if ( callstack.depth() > 1 ) {
                    callstack.clear();
                    callstack.push( globalNameSpace );
                }
            }
        }

        if ( interactive && exitOnEOF )
            System.exit(0);
    }
185012
def run(self, *args):
        """"""

        params = self.parser.parse_args(args)
        sources = params.source
        code = self.autocomplete(sources)

        return code
1313000
def post_parse(self):
        """"""
        if self.cache and not self.cache_loaded:
            self.cache_writer_cls(self.file_name, self.wavefront).write()