Main method for testing ONLY
422743
static void main(String[] argv) {
	Time time = null;
	TimeFormat in = null;
	TimeFormat out = null;

	if (argv.length >= 3) {
	    System.out.println("Creating out TimeFormat: \"" + argv[2] + "\"");
	    out = new TimeFormat(argv[2]);
	}

	if (argv.length >= 2) {
	    System.out.println("Creating in TimeFormat: \"" + argv[1] + "\"");
	    in = new TimeFormat(argv[1]);
	}
	else {
	    System.out.println("Using default format for in");
	    in = DEFAULT_FORMAT;
	}

	if (out == null)
	    out = in;

	if (argv.length >= 1) {
	    System.out.println("Parsing: \"" + argv[0] + "\" with format \""
			       + in.formatString + "\"");
	    time = in.parse(argv[0]);
	}
	else
	    time = new Time();
	
	System.out.println("Time is \"" +  out.format(time) +
			   "\" according to format \"" + out.formatString + "\"");
    }
521629
function only( testName, expected, callback, async ) {
	var newTest;

	if ( focused )  { return; }

	QUnit.config.queue.length = 0;
	focused = true;

	if ( arguments.length === 2 ) {
		callback = expected;
		expected = null;
	}

	newTest = new Test({
		testName: testName,
		expected: expected,
		async: async,
		callback: callback
	});

	newTest.queue();
}
936336
def main(cls):
        """"""
        cmd = cls()
        cmd._parse_args()
        cmd._setup_logging()
        response = cmd._run()
        output = cmd._handle_response(response)
        if output is not None:
            print(output)
979371
def main(argString=None):
    
    # Getting and checking the options
    args = parseArgs(argString)
    checkArgs(args)

    merge_related_samples(args.ibs_related, args.out, args.no_status)
690739
function main() {

    var database = fs.createWriteStream('./lib/database-min.js', { flags: 'w', encoding: 'utf8' });
    var testFile;

    fs.mkdir('./data', 493, function (error) {  // 493 == 0755 (no octal in strict mode.)
        // ignore errors.
    });
    
    database.write("// Do not edit this file, your changes will be lost.\n");
    database.write("module.exports = { \n");
    getJSON('http://alscan.info/agent_groups/groups.json', function (groups) {
        var s = JSON.stringify(groups);
        database.write("groups:" + s + ",\n");
        testFile = fs.createWriteStream('./data/groups.json', { flags: 'w', encoding: 'utf8' });
        testFile.write(s+"\n");
        testFile.end();
        getJSON('http://alscan.info/agent_sources/sources.json', function (sources) {
            var s = JSON.stringify(sources);
            database.write("sources:" + s + ",\n");
            testFile = fs.createWriteStream('./data/sources.json', { flags: 'w', encoding: 'utf8' });
            testFile.write(s+"\n");
            testFile.end();
            getJSON('http://alscan.info/patterns/patterns.json', function (patterns) {
                database.write("patterns:[\n");
                patterns.forEach(function (pattern) {
                    database.write("{p: new RegExp('" + pattern.pattern + "'), x:" + 
                            agentdb.getX(pattern.groupId, pattern.sourceId) + "},");
                });
                database.write("],\n");
                testFile = fs.createWriteStream('./data/patterns.json', { flags: 'w', encoding: 'utf8' });
                testFile.write(JSON.stringify(patterns)+"\n");
                testFile.end();
                getJSON('http://alscan.info/agents/agents.json', function (agents) {
                    var hash = new HashTable(HASH_TABLE_SIZE, HASH_TABLE_SEED, HASH_TABLE_MULTIPLIER);
                    agents.forEach(function (agent) {
                        if (agent.status < 2) {
                            var obj = { a: agent.agent, x: agentdb.getX(agent.groupId, agent.sourceId) };
                            hash.add('a', obj);
                        }
                    });
                    database.write("table:" + JSON.stringify(hash.table) + ",\n");
                    database.write("HASH_TABLE_SIZE:" + HASH_TABLE_SIZE + ",\n");
                    database.write("HASH_TABLE_SEED:" + HASH_TABLE_SEED + ",\n");
                    database.write("HASH_TABLE_MULTIPLIER:" + HASH_TABLE_MULTIPLIER + ",\n");
                    database.write("hash: undefined\n}\n");
                    testFile = fs.createWriteStream('./data/agents.json', { flags: 'w', encoding: 'utf8' });
                    testFile.write(JSON.stringify(agents)+"\n");
                    testFile.end();
                    if (debug) {
                        var history = hash.getHistory();
                        console.log("Hash table history");
                        for (var n=0; n < history.length; n++) {
                            console.log("  Depth=" + n + ", count=" + history[n] + ", percent=" + (history[n] / HASH_TABLE_SIZE));
                        }
                    }
                });
            });
        });
    });
}
551510
def lint(args):
    """"""
    application = get_current_application()
    if not args:
        args = [application.name, 'tests']
    args = ['flake8'] + list(args)
    run.main(args, standalone_mode=False)
662836
def main():
    """"""

    if '--' in sys.argv:
        cli_args = sys.argv[1:sys.argv.index('--')]
        backend_args = sys.argv[sys.argv.index('--') + 1:]
    else:
        cli_args = sys.argv[1:]
        backend_args = []

    args = _cmdline_parser.parse_args(cli_args)
    debug = False
    if args.verbose is None:
        logging_level = logging.WARNING
    elif args.verbose == 1:
        logging_level = logging.INFO
    elif args.verbose == 2:
        logging_level = logging.DEBUG
        debug = True
    else:
        print('error: I can only be so garrulous, try -vv.', file=sys.stderr)
        sys.exit(1)

    logging.basicConfig(level=logging_level)

    if args.spec and args.spec[0].startswith('+') and args.spec[0].endswith('.py'):
        # Hack: Special case for defining a spec in Python for testing purposes
        # Use this if you want to define a Stone spec using a Python module.
        # The module should should contain an api variable that references a
        # :class:`stone.api.Api` object.
        try:
            api = imp.load_source('api', args.api[0]).api  # pylint: disable=redefined-outer-name
        except ImportError as e:
            print('error: Could not import API description due to:',
                  e, file=sys.stderr)
            sys.exit(1)
    else:
        if args.spec:
            specs = []
            read_from_stdin = False
            for spec_path in args.spec:
                if spec_path == '-':
                    read_from_stdin = True
                elif not spec_path.endswith('.stone'):
                    print("error: Specification '%s' must have a .stone extension."
                          % spec_path,
                          file=sys.stderr)
                    sys.exit(1)
                elif not os.path.exists(spec_path):
                    print("error: Specification '%s' cannot be found." % spec_path,
                          file=sys.stderr)
                    sys.exit(1)
                else:
                    with open(spec_path) as f:
                        specs.append((spec_path, f.read()))
            if read_from_stdin and specs:
                print("error: Do not specify stdin and specification files "
                      "simultaneously.", file=sys.stderr)
                sys.exit(1)

        if not args.spec or read_from_stdin:
            specs = []
            if debug:
                print('Reading specification from stdin.')

            if six.PY2:
                UTF8Reader = codecs.getreader('utf8')
                sys.stdin = UTF8Reader(sys.stdin)
                stdin_text = sys.stdin.read()
            else:
                stdin_buffer = sys.stdin.buffer  # pylint: disable=no-member,useless-suppression
                stdin_text = io.TextIOWrapper(stdin_buffer, encoding='utf-8').read()

            parts = stdin_text.split('namespace')
            if len(parts) == 1:
                specs.append(('stdin.1', parts[0]))
            else:
                specs.append(
                    ('stdin.1', '%snamespace%s' % (parts.pop(0), parts.pop(0))))
                while parts:
                    specs.append(('stdin.%s' % (len(specs) + 1),
                                  'namespace%s' % parts.pop(0)))

        if args.filter_by_route_attr:
            route_filter, route_filter_errors = parse_route_attr_filter(
                args.filter_by_route_attr, debug)
            if route_filter_errors:
                print('Error(s) in route filter:', file=sys.stderr)
                for err in route_filter_errors:
                    print(err, file=sys.stderr)
                sys.exit(1)

        else:
            route_filter = None

        if args.route_whitelist_filter:
            with open(args.route_whitelist_filter) as f:
                route_whitelist_filter = json.loads(f.read())
        else:
            route_whitelist_filter = None

        try:
            # TODO: Needs version
            api = specs_to_ir(specs, debug=debug,
                              route_whitelist_filter=route_whitelist_filter)
        except InvalidSpec as e:
            print('%s:%s: error: %s' % (e.path, e.lineno, e.msg), file=sys.stderr)
            if debug:
                print('A traceback is included below in case this is a bug in '
                      'Stone.\n', traceback.format_exc(), file=sys.stderr)
            sys.exit(1)
        if api is None:
            print('You must fix the above parsing errors for generation to '
                  'continue.', file=sys.stderr)
            sys.exit(1)

        if args.whitelist_namespace_routes:
            for namespace_name in args.whitelist_namespace_routes:
                if namespace_name not in api.namespaces:
                    print('error: Whitelisted namespace missing from spec: %s' %
                          namespace_name, file=sys.stderr)
                    sys.exit(1)
            for namespace in api.namespaces.values():
                if namespace.name not in args.whitelist_namespace_routes:
                    namespace.routes = []
                    namespace.route_by_name = {}
                    namespace.routes_by_name = {}

        if args.blacklist_namespace_routes:
            for namespace_name in args.blacklist_namespace_routes:
                if namespace_name not in api.namespaces:
                    print('error: Blacklisted namespace missing from spec: %s' %
                          namespace_name, file=sys.stderr)
                    sys.exit(1)
                else:
                    namespace = api.namespaces[namespace_name]
                    namespace.routes = []
                    namespace.route_by_name = {}
                    namespace.routes_by_name = {}

        if route_filter:
            for namespace in api.namespaces.values():
                filtered_routes = []
                for route in namespace.routes:
                    if route_filter.eval(route):
                        filtered_routes.append(route)

                namespace.routes = []
                namespace.route_by_name = {}
                namespace.routes_by_name = {}
                for route in filtered_routes:
                    namespace.add_route(route)

        if args.attribute:
            attrs = set(args.attribute)
            if ':all' in attrs:
                attrs = {field.name for field in api.route_schema.fields}
        else:
            attrs = set()

        for namespace in api.namespaces.values():
            for route in namespace.routes:
                for k in list(route.attrs.keys()):
                    if k not in attrs:
                        del route.attrs[k]

        # Remove attrs that weren't specified from the route schema
        for field in api.route_schema.fields[:]:
            if field.name not in attrs:
                api.route_schema.fields.remove(field)
                del api.route_schema._fields_by_name[field.name]
            else:
                attrs.remove(field.name)

        # Error if specified attr isn't even a field in the route schema
        if attrs:
            attr = attrs.pop()
            print('error: Attribute not defined in stone_cfg.Route: %s' %
                  attr, file=sys.stderr)
            sys.exit(1)

    if args.backend in _builtin_backends:
        backend_module = __import__(
            'stone.backends.%s' % args.backend, fromlist=[''])
    elif not os.path.exists(args.backend):
        print("error: Backend '%s' cannot be found." % args.backend,
              file=sys.stderr)
        sys.exit(1)
    elif not os.path.isfile(args.backend):
        print("error: Backend '%s' must be a file." % args.backend,
              file=sys.stderr)
        sys.exit(1)
    elif not Compiler.is_stone_backend(args.backend):
        print("error: Backend '%s' must have a .stoneg.py extension." %
              args.backend, file=sys.stderr)
        sys.exit(1)
    else:
        # A bit hacky, but we add the folder that the backend is in to our
        # python path to support the case where the backend imports other
        # files in its local directory.
        new_python_path = os.path.dirname(args.backend)
        if new_python_path not in sys.path:
            sys.path.append(new_python_path)
        try:
            backend_module = imp.load_source('user_backend', args.backend)
        except Exception:
            print("error: Importing backend '%s' module raised an exception:" %
                  args.backend, file=sys.stderr)
            raise

    c = Compiler(
        api,
        backend_module,
        backend_args,
        args.output,
        clean_build=args.clean_build,
    )
    try:
        c.build()
    except BackendException as e:
        print('%s: error: %s raised an exception:\n%s' %
              (args.backend, e.backend_name, e.traceback),
              file=sys.stderr)
        sys.exit(1)

    if not sys.argv[0].endswith('stone'):
        # If we aren't running from an entry_point, then return api to make it
        # easier to do debugging.
        return api
616756
def main(args=None):
    
    cfg.configureLogger()
    wireHandlers(cfg)
    # get config from a flask standard place not our config yml
    app.run(debug=cfg.runInDebug(), host='0.0.0.0', port=cfg.getPort())
800335
public static void main(String[] args) {
        DependencyRandomIndexingMain drim = new DependencyRandomIndexingMain();
        try {
            drim.run(args);
        }
        catch (Throwable t) {
            t.printStackTrace();
        }
    }
270657
public static void main(String[] args) throws IOException, TrustyUriException {
		for (String arg : args) {
			check(arg);
		}
	}
63841
def main(args, prog_name):
  """"""
  # get options and arguments
  ui = getUI(prog_name, args)

  if ui.optionIsSet("test"):
    # just run unit tests
    unittest.main(argv=[sys.argv[0]])
  elif ui.optionIsSet("help"):
    # just show help
    ui.usage()
  else:
    verbose = (ui.optionIsSet("verbose") is True) or DEFAULT_VERBOSITY

    # get output handle
    out_fh = sys.stdout
    if ui.optionIsSet("output"):
      out_fh = open(ui.getValue("output"), "w")

    # get window size...
    window_size = DEFAULT_WINDOW_SIZE
    if ui.optionIsSet("window"):
      window_size = ui.getValue("window")

    # get the window anchoring location
    windowCentre = DEFAULT_WINDOW_CENTRE
    if ui.optionIsSet("centre"):
      windowCentre = ui.getValue("centre")
      if windowCentre not in WINDOW_CENTRE_OPTIONS:
        sys.stderr.write("un-recognised window anchor position: " +
                         str(windowCentre) + "\n")
        sys.exit(1)

    args = ui.getAllArguments()
    assert(len(args) == 3 or len(args) == 4)
    region_fn = ui.getArgument(0)
    ga_path = ui.getArgument(1)
    index_fn = None
    if len(args) == 3:
      spec = ui.getArgument(2)
    else:
      index_fn = ui.getArgument(2)
      spec = ui.getArgument(3)

    extensions = (ui.getValue("extensions").strip().split(",") if
                  ui.optionIsSet("extensions") else None)
    index_extensions = (ui.getValue("index-extensions").strip().split(",") if
                        ui.optionIsSet("index-extensions") else None)
    fail_no_index = ui.optionIsSet("fail-no-index")
    mi_seqs = (MissingSequenceHandler[ui.getValue("missing")]
               if ui.optionIsSet("missing")
               else MissingSequenceHandler.TREAT_AS_ALL_GAPS)
    species = ([x.strip() for x in ui.getValue("species").split(",")] if
               ui.optionIsSet("species") else None)

    # build the genome alignment
    alig = (load_just_in_time_genome_alignment(ga_path, spec, extensions,
                                               index_extensions, fail_no_index,
                                               verbose)
            if os.path.isdir(ga_path)
            else build_genome_alignment_from_file(ga_path, spec, index_fn,
                                                  verbose))

    # get the profile and write it to the output stream
    profile = processBED(open(region_fn), alig, window_size, CENTRE,
                         mi_seqs, species, verbose)
    out_fh.write("\n\n" + ", ".join(str(x) for x in profile) + "\n")
507634
def main(cls):
        
        chain = cls.create()
        args = chain._run_argparser(sys.argv[1:])
        chain._run_chain(sys.stdout, args.dry_run)
        chain._finalize(args.dry_run)
885896
def main():
    """"""
    parser = argparse.ArgumentParser(description='Stress test applications.')
    parser.add_argument('config_path', help='Path to configuration file.')
    args = parser.parse_args()
    try:
        configuration = load_configuration(args.config_path)
    except InvalidConfigurationError:
        print("\nConfiguration is not valid.")
        print('Example:\n{}'.format(help_configuration))
        return 1
    print("Starting up ...")
    futures = []
    with ProcessPoolExecutor(configuration[PROCESSORS]) as executor:
        for _ in range(configuration[PROCESSES]):
            futures.append(executor.submit(execute_test, configuration))
    print("... finished")
    test_stats = combine_test_stats([f.result() for f in futures])
    show_test_stats(test_stats)
    return 0
252057
def main():
    
    global cf_verbose, cf_show_comment, cf_charset
    global cf_extract, cf_test_read, cf_test_unrar
    global cf_test_memory

    psw = None

    # parse args
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'p:C:hvcxtRM')
    except getopt.error as ex:
        print(str(ex), file=sys.stderr)
        sys.exit(1)

    for o, v in opts:
        if o == '-p':
            psw = v
        elif o == '-h':
            xprint(usage)
            return
        elif o == '-v':
            cf_verbose += 1
        elif o == '-c':
            cf_show_comment = 1
        elif o == '-x':
            cf_extract = 1
        elif o == '-t':
            cf_test_read += 1
        elif o == '-T':
            cf_test_unrar = 1
        elif o == '-M':
            cf_test_memory = 1
        elif o == '-C':
            cf_charset = v
        else:
            raise Exception("unhandled switch: " + o)

    args2 = []
    for a in args:
        if a[0] == "@":
            for ln in open(a[1:], 'r'):
                fn = ln[:-1]
                args2.append(fn)
        else:
            args2.append(a)
    args = args2

    if not args:
        xprint(usage)

    # pypy .readinto()+memoryview() is buggy
    #if cf_test_read > 1 and hasattr(sys, 'pypy_version_info'):
    #    cf_test_read = 1

    for fn in args:
        test(fn, psw)
1263119
public static void main (String args[])
  {
    // Create the monitor
    FileMonitor monitor = new FileMonitor (1000);

    // Add some files to listen for
    monitor.addFile (new File ("/Users/garth/cloudhopper/dev/utility/java/ch-commons-io/trunk/tmp/"));
    //monitor.addFile (new File ("/home/jacob/test2.txt"));
    //monitor.addFile (new File ("/home/jacob/"));    

    // Add a dummy listener
    monitor.addListener (monitor.new TestListener());

    // Avoid program exit
    while (!false) ;
  }
182390
function only(testName, callback) {
  	if (focused$1) {
  		return;
  	}

  	config.queue.length = 0;
  	focused$1 = true;

  	var newTest = new Test({
  		testName: testName,
  		callback: callback
  	});

  	newTest.queue();
  }
317559
def __main():
    '''
    '''
    if len(sys.argv) < 3:
        sys.stderr.write('usage: {0} <detail|list> <system|system+user>\n'.format(sys.argv[0]))
        sys.exit(64)
    user_pkgs = False
    version_only = False
    if six.text_type(sys.argv[1]) == 'list':
        version_only = True
    if six.text_type(sys.argv[2]) == 'system+user':
        user_pkgs = True
    import salt.utils.json
    import timeit

    def run():
        '''
        Main run code, when this module is run directly
        '''
        pkg_list = WinSoftware(user_pkgs=user_pkgs, version_only=version_only)
        print(salt.utils.json.dumps(pkg_list.data, sort_keys=True, indent=4))  # pylint: disable=superfluous-parens
        print('Total: {}'.format(len(pkg_list)))  # pylint: disable=superfluous-parens

    print('Time Taken: {}'.format(timeit.timeit(run, number=1)))