Main entry point for RegPack
551934
function(input, options) {
		this.preprocess(input, options);
		for (var inputIndex=0; inputIndex < this.inputList.length; ++inputIndex)
		{
			this.input = this.inputList[inputIndex][1][1].replace(/\\/g,'\\\\');
			
			// first stage : configurable crusher
			var output = this.findRedundancies(options);
			this.inputList[inputIndex].push(output);
			
			// second stage : convert token string to regexp
			output = packer.packToRegexpCharClass(options);
			this.inputList[inputIndex].push(output);
			
			// third stage : try a negated regexp instead
			output = packer.packToNegatedRegexpCharClass();
			this.inputList[inputIndex].push(output);
			
		}
	}
1217895
def main():
    
    parser = CommandLine()
    #this block from here: http://stackoverflow.com/a/4042861/5843327
    if len(sys.argv)==1:
        parser.parser.print_help()
        sys.exit(1)
    parser.parse()
    myArgs = parser.args
    print(myArgs)

    # 1. Verify that the current directory isn't already a gloTK project
    cwd = os.path.abspath(os.getcwd())
    if gloTK.utils.dir_is_glotk(cwd):
        raise ValueError("""ERROR: Are you in an empty directory? This appears
        to be a gloTK project directory already. Please try again in a new
        directory!""")

    # 2. Reads in a meraculous config file and outputs all of the associated config
    #    files to $PWD/glotk_info
    configFile = ConfigParse(myArgs.inputConfig)
    gloTK_info=os.path.join(cwd, "gloTK_info")
    gloTK.utils.safe_mkdir(gloTK_info)
    shutil.copyfile(myArgs.inputConfig, os.path.join(gloTK_info, "project_init.config"))
    configFile.save_yaml(os.path.join(gloTK_info, "input_config.yaml"))

    # 3. Make symlinks for each read pair
    gloTK_reads = os.path.join(cwd, "gloTK_reads")
    gloTK.utils.safe_mkdir(gloTK_reads)
    reads0 = os.path.join(gloTK_reads, "reads0")
    gloTK.utils.safe_mkdir(reads0)
      # the files get saved in `project_dir/glotk_reads/reads0
    params_new = configFile.sym_reads_new_config(reads0, sym=True)
      # the yaml config files get saved in `project_dir/glotk_info/read_configs/`
    read_params = os.path.join(gloTK_info, "read_configs")
    gloTK.utils.safe_mkdir(read_params)
    params_new = configFile.save_yaml(os.path.join(read_params, "reads0.yaml"))
173729
function () {
        let noop = function () { };
        let log = {
            error: npmlog.error,
            warn: npmlog.warn,
            info: noop,
            verbose: noop,
            silly: noop,
            http: noop,
            pause: noop,
            resume: noop
        };
        return new RegClient({ log: log });
    }
607486
def set_regs(self, regs_dump):
        

        if self.real_stack_top == 0 and self.adjust_stack is True:
            raise SimStateError("You need to set the stack first, or set"
                    "adjust_stack to False. Beware that in this case, sp and bp won't be updated")

        data = self._read_data(regs_dump)
        rdata = re.split(b"\n", data)
        for r in rdata:
            if r == b"":
                continue
            reg = re.split(b" +", r)[0].decode()
            val = int(re.split(b" +", r)[1],16)
            try:
                self.state.registers.store(reg, claripy.BVV(val, self.state.arch.bits))
            # Some registers such as cs, ds, eflags etc. aren't supported in angr
            except KeyError as e:
                l.warning("Reg %s was not set", e)

        self._adjust_regs()
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.')
1299267
def main(*args):
    """"""
    options, args, parser = parse_options(args)

    if options.regex and options.write_changes:
        print('ERROR: --write-changes cannot be used together with '
              '--regex')
        parser.print_help()
        return 1
    word_regex = options.regex or word_regex_def
    try:
        word_regex = re.compile(word_regex)
    except re.error as err:
        print('ERROR: invalid regular expression "%s" (%s)' %
              (word_regex, err), file=sys.stderr)
        parser.print_help()
        return 1

    ignore_words_files = options.ignore_words or []
    ignore_words = set()
    for ignore_words_file in ignore_words_files:
        if not os.path.exists(ignore_words_file):
            print('ERROR: cannot find ignore-words file: %s' %
                  ignore_words_file, file=sys.stderr)
            parser.print_help()
            return 1
        build_ignore_words(ignore_words_file, ignore_words)

    ignore_words_list = options.ignore_words_list or []
    for comma_separated_words in ignore_words_list:
        for word in comma_separated_words.split(','):
            ignore_words.add(word.strip())

    dictionaries = options.dictionary or [default_dictionary]
    misspellings = dict()
    for dictionary in dictionaries:
        if dictionary == "-":
            dictionary = default_dictionary
        if not os.path.exists(dictionary):
            print('ERROR: cannot find dictionary file: %s' % dictionary,
                  file=sys.stderr)
            parser.print_help()
            return 1
        build_dict(dictionary, misspellings, ignore_words)
    colors = TermColors()
    if not options.colors or sys.platform == 'win32':
        colors.disable()

    if options.summary:
        summary = Summary()
    else:
        summary = None

    context = None
    if options.context is not None:
        if (options.before_context is not None) or \
                (options.after_context is not None):
            print('ERROR: --context/-C cannot be used together with '
                  '--context-before/-B or --context-after/-A')
            parser.print_help()
            return 1
        context_both = max(0, options.context)
        context = (context_both, context_both)
    elif (options.before_context is not None) or \
            (options.after_context is not None):
        context_before = 0
        context_after = 0
        if options.before_context is not None:
            context_before = max(0, options.before_context)
        if options.after_context is not None:
            context_after = max(0, options.after_context)
        context = (context_before, context_after)

    exclude_lines = set()
    if options.exclude_file:
        build_exclude_hashes(options.exclude_file, exclude_lines)

    file_opener = FileOpener(options.hard_encoding_detection,
                             options.quiet_level)
    glob_match = GlobMatch(options.skip)

    bad_count = 0
    for filename in args:
        # ignore hidden files
        if is_hidden(filename, options.check_hidden):
            continue

        if os.path.isdir(filename):
            for root, dirs, files in os.walk(filename):
                if glob_match.match(root):  # skip (absolute) directories
                    del dirs[:]
                    continue
                for file_ in files:
                    if glob_match.match(file_):  # skip files
                        continue
                    fname = os.path.join(root, file_)
                    if glob_match.match(fname):  # skip paths
                        continue
                    if not os.path.isfile(fname) or not os.path.getsize(fname):
                        continue
                    bad_count += parse_file(
                        fname, colors, summary, misspellings, exclude_lines,
                        file_opener, word_regex, context, options)

                # skip (relative) directories
                dirs[:] = [dir_ for dir_ in dirs if not glob_match.match(dir_)]

        else:
            bad_count += parse_file(
                filename, colors, summary, misspellings, exclude_lines,
                file_opener, word_regex, context, options)

    if summary:
        print("\n-------8<-------\nSUMMARY:")
        print(summary)
    return bad_count
293092
function main()
	{
		$pkg = new PEAR_PackageFileManager2();

		$e = $pkg->setOptions(array
		(
			'baseinstalldir'    => 'yii',
			'packagedirectory'  => $this->pkgdir,
			'filelistgenerator' => 'file',
			'simpleoutput'      => true,
			'ignore'            => array(),
			'roles' => array('*' => 'php'),
			)
		);

		// PEAR error checking
		if (PEAR::isError($e))
			die($e->getMessage());
		$pkg->setPackage($this->package);
		$pkg->setSummary($this->summary);
		$pkg->setDescription($this->pkgdescription);
		$pkg->setChannel($this->channel);

		$pkg->setReleaseStability($this->state);
		$pkg->setAPIStability($this->state);
		$pkg->setReleaseVersion($this->version);
		$pkg->setAPIVersion($this->version);

		$pkg->setLicense($this->license);
		$pkg->setNotes($this->notes);
		$pkg->setPackageType('php');
		$pkg->setPhpDep('5.1.0');
		$pkg->setPearinstallerDep('1.4.2');

		$pkg->addRelease();
		$pkg->addMaintainer('lead','qxue','Qiang Xue','qiang.xue@gmail.com');

		$test = $pkg->generateContents();

		$e = $pkg->writePackageFile();

		if (PEAR::isError($e))
			echo $e->getMessage();
	}
296718
def main():
    
    parser = argparse.ArgumentParser(
        description='Performs classification/regression from the command-line. Calls JVM start/stop automatically.')
    parser.add_argument("-j", metavar="classpath", dest="classpath", help="additional classpath, jars/directories")
    parser.add_argument("-X", metavar="heap", dest="heap", help="max heap size for jvm, e.g., 512m")
    parser.add_argument("-t", metavar="train", dest="train", required=True, help="Training set file")
    parser.add_argument("-T", metavar="test", dest="test", help="Test set file")
    parser.add_argument("-c", metavar="class index", dest="classindex", help="1-based class attribute index")
    parser.add_argument("-d", metavar="outmodel", dest="outmodel", help="model output file name")
    parser.add_argument("-l", metavar="inmodel", dest="inmodel", help="model input file name")
    parser.add_argument("-x", metavar="num folds", dest="numfolds", help="number of folds for cross-validation")
    parser.add_argument("-s", metavar="seed", dest="seed", help="seed value for randomization")
    parser.add_argument("-v", action="store_true", dest="notrainstats", help="no statistics for training")
    parser.add_argument("-o", action="store_true", dest="onlystats", help="only statistics, don't output model")
    parser.add_argument("-i", action="store_true", dest="irstats", help="output information retrieval statistics")
    parser.add_argument("-k", action="store_true", dest="itstats", help="output information theoretic statistics")
    parser.add_argument("-m", metavar="costmatrix", dest="costmatrix", help="cost matrix file")
    parser.add_argument("-g", metavar="graph", dest="graph", help="output file for graph (if supported)")
    parser.add_argument("classifier", help="classifier classname, e.g., weka.classifiers.trees.J48")
    parser.add_argument("option", nargs=argparse.REMAINDER, help="additional classifier options")
    parsed = parser.parse_args()
    jars = []
    if parsed.classpath is not None:
        jars = parsed.classpath.split(os.pathsep)
    params = []
    if parsed.train is not None:
        params.extend(["-t", parsed.train])
    if parsed.test is not None:
        params.extend(["-T", parsed.test])
    if parsed.classindex is not None:
        params.extend(["-c", parsed.classindex])
    if parsed.outmodel is not None:
        params.extend(["-d", parsed.outmodel])
    if parsed.inmodel is not None:
        params.extend(["-l", parsed.inmodel])
    if parsed.numfolds is not None:
        params.extend(["-x", parsed.numfolds])
    if parsed.seed is not None:
        params.extend(["-s", parsed.seed])
    if parsed.notrainstats:
        params.append("-v")
    if parsed.onlystats:
        params.append("-o")
    if parsed.irstats:
        params.append("-i")
    if parsed.itstats:
        params.append("-k")
    if parsed.costmatrix is not None:
        params.extend(["-m", parsed.costmatrix])
    if parsed.graph is not None:
        params.extend(["-g", parsed.graph])

    jvm.start(jars, max_heap_size=parsed.heap, packages=True)

    logger.debug("Commandline: " + join_options(sys.argv[1:]))

    try:
        classifier = Classifier(classname=parsed.classifier)
        if len(parsed.option) > 0:
            classifier.options = parsed.option
        print(Evaluation.evaluate_model(classifier, params))
    except Exception, e:
        print(e)
    finally:
        jvm.stop()
1026307
def main():
    """"""
    description = ('PATH can be either the path to a scratch file, or a '
                   'directory containing scratch files. Multiple PATH '
                   'arguments can be provided.')
    parser = OptionParser(usage='%prog -p PLUGIN_NAME [options] PATH...',
                          description=description,
                          version='%prog {}'.format(__version__))
    parser.add_option('-d', '--plugin-dir', metavar='DIR',
                      help=('Specify the path to a directory containing '
                            'plugins. Plugins in this directory take '
                            'precedence over similarly named plugins '
                            'included with Hairball.'))
    parser.add_option('-p', '--plugin', action='append',
                      help=('Use the named plugin to perform analysis. '
                            'This option can be provided multiple times.'))
    parser.add_option('-k', '--kurt-plugin', action='append',
                      help=('Provide either a python import path (e.g, '
                            'kelp.octopi) to a package/module, or the path'
                            ' to a python file, which will be loaded as a '
                            'Kurt plugin. This option can be provided '
                            'multiple times.'))
    parser.add_option('-q', '--quiet', action='store_true',
                      help=('Prevent output from Hairball. Plugins may still '
                            'produce output.'))
    parser.add_option('-C', '--no-cache', action='store_true',
                      help='Do not use Hairball\'s cache.', default=False)
    options, args = parser.parse_args(sys.argv[1:])

    if not options.plugin:
        parser.error('At least one plugin must be specified via -p.')
    if not args:
        parser.error('At least one PATH must be provided.')

    if options.plugin_dir:
        if os.path.isdir(options.plugin_dir):
            sys.path.append(options.plugin_dir)
        else:
            parser.error('{} is not a directory'.format(options.plugin_dir))

    hairball = Hairball(options, args, cache=not options.no_cache)
    hairball.initialize_plugins()
    hairball.process()
    hairball.finalize()
68392
def main(argv=sys.argv):
    """"""
    parser = setup_parser()

    (opts, args) = parser.parse_args(argv[1:])

    if not args:
        parser.error('A package path is required.')

    rootpath, excludes = args[0], args[1:]
    if not opts.destdir:
        parser.error('An output directory is required.')
    if opts.header is None:
        opts.header = path.normpath(rootpath).split(path.sep)[-1]
    if opts.suffix.startswith('.'):
        opts.suffix = opts.suffix[1:]
    if not path.isdir(rootpath):
        print >>sys.stderr, '%s is not a directory.' % rootpath
        sys.exit(1)
    if not path.isdir(opts.destdir):
        if not opts.dryrun:
            os.makedirs(opts.destdir)
    rootpath = path.normpath(path.abspath(rootpath))
    excludes = normalize_excludes(rootpath, excludes)
    modules = recurse_tree(rootpath, excludes, opts)
    if opts.full:
        from sphinx import quickstart as qs
        modules.sort()
        prev_module = ''
        text = ''
        for module in modules:
            if module.startswith(prev_module + '.'):
                continue
            prev_module = module
            text += '   %s\n' % module
        d = dict(
            path = opts.destdir,
            sep  = False,
            dot  = '_',
            project = opts.header,
            author = opts.author or 'Author',
            version = opts.version or '',
            release = opts.release or opts.version or '',
            suffix = '.' + opts.suffix,
            master = 'index',
            epub = True,
            ext_autodoc = True,
            ext_viewcode = True,
            makefile = True,
            batchfile = True,
            mastertocmaxdepth = opts.maxdepth,
            mastertoctree = text,
        )
        if not opts.dryrun:
            qs.generate(d, silent=True, overwrite=opts.force)
    elif not opts.notoc:
        create_modules_toc_file(modules, opts)
808925
def main(argv=None):
    """"""
    parser = argparse.ArgumentParser(description="Process raw HTML to baked"
                                                 " (embedded numbering and"
                                                 " collation)")
    parser.add_argument('-v', '--version', action="version",
                        version=__version__, help='Report the library version')
    parser.add_argument("css_rules",
                        type=argparse.FileType('rb'),
                        help="CSS3 ruleset stylesheet recipe")
    parser.add_argument("html_in", nargs="?",
                        type=argparse.FileType('r'),
                        help="raw HTML file to bake (default stdin)",
                        default=sys.stdin)
    parser.add_argument("html_out", nargs="?",
                        type=argparse.FileType('w'),
                        help="baked HTML file output (default stdout)",
                        default=sys.stdout)
    parser.add_argument('-s', '--stop-at', action='store', metavar='<pass>',
                        help='Stop baking just before given pass name')
    parser.add_argument('-d', '--debug', action='store_true',
                        help='Send debugging info to stderr')
    parser.add_argument('-q', '--quiet', action='store_true',
                        help="Quiet all on stderr except errors")
    parser.add_argument('-c', '--coverage-file', metavar='coverage.lcov',
                        type=FileTypeExt('w'),
                        help="output coverage file (lcov format). If "
                        "filename starts with '+', append coverage info.")
    parser.add_argument('--use-repeatable-ids', action='store_true',
                        help="use repeatable id attributes instead of uuids "
                        "which is useful for diffing")
    args = parser.parse_args(argv)

    formatter = logging.Formatter('%(name)s %(levelname)s %(message)s')
    handler = logging.StreamHandler(sys.stderr)
    handler.setFormatter(formatter)
    logger.addHandler(handler)

    use_quiet_log = (args.quiet and logging.ERROR)
    use_debug_log = (args.debug and logging.DEBUG)

    # Debug option takes higher priority than quiet warnings option
    logger.setLevel(use_debug_log or use_quiet_log or logging.WARNING)

    try:
        easybake(args.css_rules, args.html_in, args.html_out, args.stop_at,
                 args.coverage_file, args.use_repeatable_ids)
    finally:
        if args.css_rules:
            args.css_rules.close()
        if args.html_in:
            args.html_in.close()
        if args.html_out:
            args.html_out.close()
        if args.coverage_file:
            args.coverage_file.close()
482774
def main(args=None):
    """"""
    args = sys.argv[1:]
    parser = argparse.ArgumentParser()
    parser.add_argument("safe_file", type=str, nargs='+')
    parser.add_argument("--granules", action="store_true")
    parsed = parser.parse_args(args)

    pp = pprint.PrettyPrinter()
    for safe_file in parsed.safe_file:
        with s2reader.open(safe_file) as safe_dataset:
            if parsed.granules:
                pp.pprint(
                    dict(
                        safe_file=safe_file,
                        granules=[
                            dict(
                                granule_identifier=granule.granule_identifier,
                                footprint=str(granule.footprint),
                                srid=granule.srid,
                                # cloudmask_polys=str(granule.cloudmask),
                                # nodata_mask=str(granule.nodata_mask),
                                cloud_percent=granule.cloud_percent
                                )
                            for granule in safe_dataset.granules
                            ]
                        )
                    )
            else:
                pp.pprint(
                    dict(
                        safe_file=safe_file,
                        product_start_time=safe_dataset.product_start_time,
                        product_stop_time=safe_dataset.product_stop_time,
                        generation_time=safe_dataset.generation_time,
                        footprint=str(safe_dataset.footprint),
                        bounds=str(safe_dataset.footprint.bounds),
                        granules=len(safe_dataset.granules),
                        granules_srids=list(set([
                            granule.srid
                            for granule in safe_dataset.granules
                            ]))
                        )
                    )
            print "\n"
738073
function main() {
  config = createConfig(process.argv.slice(2));

  if (config.options.help) {
    config.options.showHelp(NODE_DEBUG_MODE);
    process.exit();
  }

  if (config.options.version) {
    config.options.showVersion();
    process.exit();
  }

  process.on('SIGINT', function() {
     process.exit();
  });

  startInspectorProcess(function(error, result) {
    if (error) {
      console.error(formatNodeInspectorError(error));
      process.exit(1);
    }

    var url = result.address.url;
    var isUnixSocket = result.address.isUnixSocket;

    startDebuggedProcess(function(error) {
      if (error) {
        console.error('Cannot start %s: %s', config.subproc.script, error.message || error);
        process.exit(2);
      }

      openBrowserAndPrintInfo(url, isUnixSocket);
    });
  });
}
950183
def main():
    """"""
    logging.basicConfig(format=LOGGING_FORMAT)
    log = logging.getLogger(__name__)

    parser = argparse.ArgumentParser()
    add_debug(parser)
    add_app(parser)
    add_properties(parser)
    add_env(parser)
    add_region(parser)
    args = parser.parse_args()

    logging.getLogger(__package__.split('.')[0]).setLevel(args.debug)

    log.debug('Parsed arguments: %s', args)

    asgpolicy = AutoScalingPolicy(app=args.app, prop_path=args.properties, env=args.env, region=args.region)

    asgpolicy.create_policy()
334500
def setup_regex(self):
        """"""
        #Regex for matching the entire body of the type and getting top-level modifiers.
        self._RX_TYPE = r"\n\s*type(?P<modifiers>,\s+(public|private))?(\s*::)?\s+(?P<name>[A-Za-z0-9_]+)" + \
                        r"(?P<contents>.+?)end\s*type(\s+(?P=name))?"
        self.RE_TYPE = re.compile(self._RX_TYPE, re.DOTALL | re.I)
        #This regex is the same as RE_TYPE, only the contents are removed from the definition.
        self._RX_SIG =  r"type(?P<modifiers>,\s+(public|private))?(\s+::)?\s+(?P<name>[A-Za-z0-9_]+)"
        self.RE_SIG = re.compile(self._RX_SIG, re.I)

        #Regex for finding if the type is private
        self._RX_PRIV = "private.+?(contains)?"
        self.RE_PRIV = re.compile(self._RX_PRIV, re.DOTALL | re.I)
        #Regex for finding methods buried in a type declaration.
        self._RX_EXEC = r"^\s*(?P<modifiers>[^:]+)\s+::\s+(?P<name>[A-Za-z0-9_]+)" + \
                        r"(\s+=>\s+(?P<points>[A-Za-z0-9_]+))?$"
        self.RE_EXEC = re.compile(self._RX_EXEC, re.M | re.I)
        #Regex for getting text after contains statement
        self._RX_CONTAINS = "\n\s*contains(?P<remainder>.+)"
        self.RE_CONTAINS = re.compile(self._RX_CONTAINS, re.DOTALL | re.I)
830357
def main():
    """"""
    register_config_opts()
    common_config.init(sys.argv[1:])
    neutron_config.setup_logging()
    proxy = MetadataProxy()
    proxy.run()
409469
def regex_in_package_file(regex, filename, package_name, return_match=False):
    
    filepath = package_file_path(filename, package_name)
    return regex_in_file(regex, filepath, return_match=return_match)