Main entry point.  input and output are two streams, one readable, the other writable.
355070
function(input, output, literal, cb) {
  var text = '';
  input.on ('data', function gatherer (data) {
    text += '' + data;   // Converting to UTF-8 string.
  });
  input.on ('end', function writer () {
    try {
      var write = function(data) { output.write(data); };
      template(text)(write, literal);
    } catch (e) {
      if (cb) { cb (e); }
    } finally {
      // There are streams you cannot end.
      try {
        output.end ();
      } catch (e) {} finally {
        if (cb) { cb (null); }
      }
    }
  });
}
633928
def main():
    
    shell = Shell()

    print(shell.terminal_type())

    r = shell.execute('pwd')  # copy line replace
    print(r)

    # shell.list()

    # print json.dumps(shell.command, indent=4)

    # test some commands without args
    """
    for cmd in ['whoami', 'pwd']:
        r = shell._execute(cmd)
        print ("---------------------")
        print ("Command: {:}".format(cmd))
        print ("{:}".format(r))
        print ("---------------------")
    """
    r = shell.execute('ls', ["-l", "-a"])
    print(r)

    r = shell.execute('ls', "-l -a")
    print(r)

    r = shell.ls("-aux")
    print(r)

    r = shell.ls("-a", "-u", "-x")
    print(r)

    r = shell.pwd()
    print(r)
208682
def main():
    
    parser = __build_option_parser()
    args = parser.parse_args()
    analyze_ws = AnalyzeWS(args)
    try:
        analyze_ws.set_file(args.file_[0])
    except IOError:
        print 'IOError raised while reading file. Exiting!'
        sys.exit(3)

    # Start the chosen mode
    if args.to_file or args.to_browser:
        analyze_ws.to_file_mode()
        if args.to_browser:
            analyze_ws.to_browser_mode()
    else:
        analyze_ws.interactive_mode()
207581
def run(self):
        
        count = {}

        # NOTE: self.input() actually returns an element for the InputText.output() target
        for f in self.input():  # The input() method is a wrapper around requires() that returns Target objects
            for line in f.open('r'):  # Target objects are a file system/format abstraction and this will return a file stream object
                for word in line.strip().split():
                    count[word] = count.get(word, 0) + 1

        # output data
        f = self.output().open('w')
        for word, count in six.iteritems(count):
            f.write("%s\t%d\n" % (word, count))
        f.close()
1293026
def main(pargs):
    
    input_file = sys.argv[1]
    fp = ParseFileLineByLine(input_file)
    for i in fp:
        print(i)
931929
public static void main(String[] args) throws IOException {
    if (!parseInputArgs(args)) {
      usage();
      System.exit(EXIT_FAILED);
    }
    if (sHelp) {
      usage();
      System.exit(EXIT_SUCCEEDED);
    }
    if (!sNoTimeout && !stdinHasData()) {
      System.exit(EXIT_FAILED);
    }

    JournalFormatter formatter = new ProtoBufJournalFormatter();
    try (JournalInputStream journalStream = formatter.deserialize(System.in)) {
      JournalEntry entry;
      while ((entry = journalStream.read()) != null) {
        System.out.print(entry);
        System.out.println(ENTRY_SEPARATOR);
      }
    }
  }
832172
def main():
    
    args = parse_args()
    configure_logging(args.debug)

    src_path = args.src_path
    dest_path = args.dest_path
    old_str1 = '\\"size\\":' + args.old_size
    old_str2 = '\\"size\\": ' + args.old_size
    new_str = '\\"size\\":' + args.new_size

    logging.info('Input path: %s', src_path)
    logging.info('Output path: %s', dest_path)
    logging.info('old str: %s', old_str1)
    logging.info('old str: %s', old_str2)
    logging.info('new str: %s', new_str)

    if os.path.abspath(src_path) == os.path.abspath(dest_path):
        logging.error('source and destination directiories must be different')
        sys.exit(1)

    # Iterate over input files
    json_files = [f for f in os.listdir(src_path) if f.endswith('.json')]
    for filename in json_files:

        in_file_path = os.path.join(src_path, filename)
        in_file_path = os.path.join(src_path, filename)

        out_file_path = os.path.join(dest_path, filename)
        logging.info('INPUT FILE: %s',in_file_path)
        logging.info('OUTPUT FILE: %s',out_file_path)
        # First beautify input
        pretty = utils.beautify(filename=in_file_path)

        # Iterate the beautified json string line by line
        pretty_replaced = utils.replace(pretty, old_str1, new_str)
        pretty_replaced = utils.replace(pretty_replaced, old_str2, new_str)

        with open(out_file_path, 'w') as output_file:
            output_file.write(pretty_replaced)

    logging.info('This is the end.')
688818
def main():
    """"""

    parser = argparse.ArgumentParser()
    parser.add_argument("--input_dir", help="The Input file directory", default="doc_templates/")
    parser.add_argument("--output_dir", help="Where to store the processed files", default="current_docs/")
    parser.add_argument("--java_src_dir", help="Where Java snippet source files are located",
                        default="src/test/java/io/improbable/snippet/")
    parser.add_argument("--python_src_dir", help="Where Python snippet source files are located",
                        default="src/test/python/")
    parser.add_argument("--debug", action='store_true', help="Turn on script debugging")

    args = parser.parse_args()
    if args.debug:
        logging.basicConfig(level=logging.DEBUG)

    snippet_store = {}
    for_all_files_in_dir(args.java_src_dir, lambda x: read_file_snippets(args.java_src_dir + x, snippet_store))
    for_all_files_in_dir(args.python_src_dir, lambda x: read_file_snippets(args.python_src_dir + x, snippet_store))
    stripped_snippet_store = {k: strip_block_whitespace(v) for k, v in snippet_store.items()}
    printd(str(stripped_snippet_store))
    check_output_dir_exists(args.output_dir)
    for_all_in_subdirs(args.input_dir, lambda x: do_rewrites(x,
                                                             args.input_dir,
                                                             args.output_dir,
                                                             stripped_snippet_store))
690868
def main():
    """"""
    parser = build_command_parser()
    options = parser.parse_args()
    file_pointer = options.filename
    input_format = options.input_format

    with file_pointer:
        json_data = json.load(file_pointer)

    if input_format == SIMPLE_JSON:
        report = Report(json_data)
    elif input_format == EXTENDED_JSON:
        report = Report(
            json_data.get('messages'),
            json_data.get('stats'),
            json_data.get('previous'))

    print(report.render(), file=options.output)
1245536
public static void main(String[] args) {
    if (args.length < 2) {
      System.err.println("Input and output files not provided");
      System.err
          .println("You need to provide both the input serialized java fst model");
      System.err.println("and the output binary openfst model.");
      System.exit(1);
    }

    MutableFst fst = FstInputOutput.readFstFromBinaryResource(args[0]);

    // Serialize the java fst model to disk
    System.out.println("Saving as openfst text model...");
    Convert.export(fst, args[1]);
  }
503428
def main():
    
    parser = argparse.ArgumentParser()
    parser.add_argument("-o", "--out", help="Output results to a file instead of stdout", default=None)
    parser.add_argument("-p", "--path", help="Specifies the target directory to search in", default=os.getcwd())
    options = parser.parse_args()

    try:
        scanner = Scanner(path=options.path, output=options.out)
        scanner.run()
        scanner.output()
        
    except ScannerException as e:
        print("[!] Error, %s" % str(e))
        exit(1)
893504
def main():
    """"""
    conf.init(), db.init(conf.DbPath)
    inqueue = LineQueue(sys.stdin).queue
    outqueue = type("", (), {"put": lambda self, x: print("\r%s" % x, end=" ")})()
    if "--quiet" in sys.argv: outqueue = None
    if conf.MouseEnabled:    inqueue.put("mouse_start")
    if conf.KeyboardEnabled: inqueue.put("keyboard_start")
    start(inqueue, outqueue)
874490
function startStream () {
  process.stdin.setEncoding('utf8')
  process.stdin.on('data', function(data) {
    return {
      "--parse"     : function (string) {
        var result = parse(string)
        process.stdout.write(JSON.stringify(result, null, 2))
      },
      "--serialize" : function (string) {
        var result = serialize(JSON.parse(string))
        process.stdout.write(result)
      }
    }[$mode](data)
  })
}
18758
def main():
    ''''''
    global output
    if len(sys.argv[1:]) == 1:
        with io.open(sys.argv[1], 'r', encoding='utf-8') as f:
            output = load(f)
    else:
        output = load(sys.stdin)

    dump(output, sys.stdout)
321262
def main():
    
    # Define Parser object and add to toil
    parser = build_parser()
    Job.Runner.addToilOptions(parser)
    args = parser.parse_args()
    # Store inputs from argparse
    inputs = {'config': args.config,
              'config_fastq': args.config_fastq,
              'input': args.input,
              'unc.bed': args.unc,
              'hg19.transcripts.fa': args.fasta,
              'composite_exons.bed': args.composite_exons,
              'normalize.pl': args.normalize,
              'output_dir': args.output_dir,
              'rsem_ref.zip': args.rsem_ref,
              'chromosomes.zip': args.chromosomes,
              'ebwt.zip': args.ebwt,
              'ssec': args.ssec,
              's3_dir': args.s3_dir,
              'sudo': args.sudo,
              'single_end_reads': args.single_end_reads,
              'upload_bam_to_s3': args.upload_bam_to_s3,
              'uuid': None,
              'sample.tar': None,
              'cpu_count': None}

    # Launch jobs
    Job.Runner.startToil(Job.wrapJobFn(download_shared_files, inputs), args)
777959
def main():
    
    source_lines = (line.rstrip() for line in sys.stdin)
    console = InteractiveInterpreter()
    console.runsource('import turicreate')
    source = ''
    try:
        while True:
            source = source_lines.next()
            more = console.runsource(source)
            while more:
                next_line = source_lines.next()
                print '...', next_line
                source += '\n' + next_line
                more = console.runsource(source)
    except StopIteration:
        if more:
            print '... '
            more = console.runsource(source + '\n')
1004989
private static void writeStream(final InputStream input, final FileWriter writer)
            throws IOException
    {
        writeStream(input, writer, LineEndingStyle.LOCAL);
    }