Parses the arguments and options.
353074
def parse_args():
    """"""
    parser = argparse.ArgumentParser(
        prog="geneparse-indexer",
        description="Genotype file indexer."
    )

    # IMPUTE2 files
    group = parser.add_argument_group("IMPUTE2 index")
    group.add_argument(
        "--impute2", metavar="IMPUTE2", type=str, nargs="+",
        help="Index an IMPUTE2 genotype file format. The file can be plain "
             "text or bgzipped.",
    )

    # BGEN files
    group = parser.add_argument_group("BGEN index")
    group.add_argument(
        "--bgen", metavar="BGEN", type=str, nargs="+",
        help="Index a BGEN genotype file. This requires 'bgenix' to be in the "
             "PATH.",
    )
    group.add_argument(
        "--legacy", action="store_true",
        help="Index the file using the '-with-rowid' option. This flag "
             "enables compatibility with SQLITE prior to version 3.8.2. See "
             "https://bitbucket.org/gavinband/bgen/wiki/bgenix for more "
             "information.",
    )

    return parser.parse_args()
634053
def parse_options(arguments=None):
    
    if arguments is None:
        arguments = sys.argv[1:]
    if isinstance(arguments, str):
        arguments = arguments.split()
    if isinstance(arguments, argparse.Namespace):
        return arguments
    parser = create_args_parser()
    args = parser.parse_args(arguments)
    # pprint(args.__dict__)

    args.dialect = args.dialect.lower()
    if args.dialect not in ['lisp', 'newlisp', 'clojure', 'scheme', 'all', '']:
        parser.error("`{0}' is not a recognized dialect".format(args.dialect))

    args.backup_dir = os.path.expanduser(args.backup_dir)
    if not os.path.exists(args.backup_dir):
        parser.error("Directory `{0}' does not exist".format(args.backup_dir))

    if len(args.files) > 1 and args.output_file:
        parser.error('Cannot use the -o flag when more than one file is specified')

    if not args.files:
        # Indentation from standard input
        if args.modify and not args.output_file:
            args.modify = False
        args.backup = False
        args.warning = False

    if args.output_diff:
        # If someone requests a diff we assume he/she doesn't want the file to be
        # modified
        args.modify = False

    return args
541830
def parse_args():
    """"""
    parser = arguments.parser(__doc__)
    parser.args('streams', help='streams to use')
    parser.opt('-p', '--paste', 'paste text from clipboard')
    parser.opt('-i', '--stdin', 'wait for text from stdin')
    return parser.parse_args()
1181062
def _parser_options():
    """"""
    #We have two options: get some of the details from the config file,
    import argparse
    from acorn import base
    pdescr = "ACORN setup and custom configuration"
    parser = argparse.ArgumentParser(parents=[base.bparser], description=pdescr)
    for arg, options in script_options.items():
        parser.add_argument(arg, **options)
        
    args = base.exhandler(examples, parser)
    if args is None:
        return

    return args
1257305
function parseOptions(globals, data, options) {
    if (_.isString(options.filter)) {
        options.filter = resolvePaths(globals, data, options.filter);
    }

    return options;
}
1150321
def parse_options(cls, options):
        """"""
        cls.known_modules = {
            project2module(k): v.split(",")
            for k, v in [
                x.split(":[")
                for x in re.split(r"],?", options.known_modules)[:-1]
            ]
        }
1128537
def parse_options!(args)
			@options = {}
			opts = ::OptionParser.new do |opts|
				opts.banner = "Usage: syswatch [options]\n\n  Options:"

				opts.on("-f", "--foreground", "Do not daemonize, just run in foreground.") do |f|
					@options[:foreground] = f
				end

				opts.on("-v", "--verbose", "Be verbose, print out some messages.") do |v|
					@options[:verbose] = v
				end

				opts.on("-t", "--test", "Test notifications.") do |t|
					@options[:test] = t
				end

				opts.on("-c", "--config [FILE]", "Use a specific config file, instead of `#{SysWatch::DEFAULTS[:config]}`") do |config|
					@options[:config] = config
				end
			end
			opts.parse! args
		end
1296068
def parse_options options = {}, request = ''
      options.each do |opt, value|
        case opt
        when :timeout, :paging, :mode
          request += "&#{opt}=#{value}"
        when :callback, :stats
          request += "&#{opt}"
        when :fields
          request += "&#{opt}=" + value.join(',') if value.is_a?(Array)
        end
      end
      request
    end
1369097
def parse(self):
        
        self._options, self._arguments = self._parse_args()
        self._arguments = self._arguments or ['.']

        if not self._validate_options(self._options):
            raise IllegalConfiguration()

        self._run_conf = self._create_run_config(self._options)

        config = self._create_check_config(self._options, use_defaults=False)
        self._override_by_cli = config
941674
def parse_options(**kwargs):
    """"""
    return {camelize(key): value
            for key, value in kwargs.items()
            if value is not None}
78626
def parse_options(settings):
    ''''''
    optlist, args = getopt(sys.argv, 'x', [])
    settings['configfile'] = args[1]
    return settings
917021
private function parsePathArguments()
    {
        if (null !== $this->arguments) {
            return;
        }

        $arguments = [];
        preg_match('/^' . self::pattern($this->configuredPath) . '/', $this->calledPath, $arguments);
        array_shift($arguments);
        $names  = [];
        $this->arguments = [];
        preg_match_all('/[{][^}]*[}]/', str_replace('/', '\/', $this->configuredPath), $names);
        foreach ($names[0] as $key => $name) {
            if (isset($arguments[$key])) {
                $this->arguments[str_replace(['{', '}'], '', $name)] = $arguments[$key];
            }
        }
    }
189226
protected function parseOptions() {
        $this->config['options'] = [];

        foreach ($this->options as $option) {
            $found = false;

            $types = [];

            if (array_key_exists('short', $option)) {
                $types['-'] = $option['short'];
            }

            if (array_key_exists('long', $option)) {
                $types['--'] = $option['long'];
            }

            foreach ($types as $prefix => $name) {
                $key = $prefix . $name;
                $value = null;

                for ($i = 1; $i < count($this->config['args']); $i++) {
                    if (strpos($this->config['args'][$i], $key, 0) === 0) {
                        switch ($option['value']) {
                            case self::NO_VALUE:
                                $value = true;
                                break;
                            case self::OPTION_REQUIRED:
                            case self::OPTION_NOT_REQUIRED:
                                if (strpos($this->config['args'][$i], $key . '=', 0) === 0) {
                                    $value = str_replace(
                                        $key . '=',
                                        '',
                                        $this->config['args'][$i]
                                    );
                                } elseif (array_key_exists(($i + 1), $this->config['args']) &&
                                    substr($this->config['args'][$i + 1], 0, strlen($prefix)) !== $prefix) {
                                    $value = $this->config['args'][$i + 1];
                                } else {
                                    throw new Exception(sprintf(
                                        'Option "%s" needs a value',
                                        $key
                                    ), ExitApp::BAD_USER_INTERACTION);
                                }
                                break;
                        }

                        if (array_key_exists($name, $this->config['options']) &&
                            !is_array($this->config['options'][$name])) {
                            $this->config['options'][$name] = [
                                $this->config['options'][$name],
                                $value
                            ];
                        } elseif (array_key_exists($name, $this->config['options']) &&
                            is_array($this->config['options'][$name])) {
                            $this->config['options'][$name][] = $value;
                        } else {
                            $this->config['options'][$name] = $value;
                        }

                        $found = true;
                    }
                }
            }

            if ($found === false && $option['value'] === self::OPTION_REQUIRED) {
                $message = '';

                if (array_key_exists('short', $option) && array_key_exists('long', $option)) {
                    $message = sprintf(
                        'Required option "-%s" or "--%s" is missing',
                        $option['short'],
                        $option['long']
                    );
                } elseif (array_key_exists('short', $option) && !array_key_exists('long', $option)) {
                    $message = sprintf(
                        'Required option "-%s" is missing',
                        $option['short']
                    );
                } elseif (!array_key_exists('short', $option) && array_key_exists('long', $option)) {
                    $message = sprintf(
                        'Required option "--%s" is missing',
                        $option['long']
                    );
                }

                throw new Exception($message, ExitApp::BAD_USER_INTERACTION);
            }
        }

        return $this;
    }
377965
def parse_other_args(opts, options)
      opts.on('-q', '--offline-queueing') do
        options[:offline_queueing] = true
      end

      opts.on('-F', '--filter-params [PARAMS}') do |params|
        options[:filter_params] = params.split(/\s*,\s*/)
      end

      opts.on('--help') do
        puts Usage.scan(__FILE__)
        exit
      end
    end
1067961
private void parse(String[] args) {
        for (int i=0; i<args.length; i++) {
            if (opt_with_value.containsKey(args[i])) {
                String key = opt_with_value.get(args[i]);
                values.put(key, args[i+1]);
                i++;
            } else if (args[i].startsWith("-")) {
                opt_without_value.add(args[i]);
            } else {
                arglist.add(args[i]);
            }
        }
    }
450493
def parse_options(options)
      options = Shellwords.split(options) unless options.is_a?(Array)
      parser = Thor::Options.new(self.class.class_options)
      parser.parse(options)
    end
958259
function parseOptions(opts) {
  opts = opts || {};
  var argv = [];
  var options = {};
  var process_argv = process.argv;
  for (var i = 2; i < process_argv.length; i++) {
    if (process_argv[i].indexOf('--') == 0) {
      var arg = process_argv[i];
      if (arg.indexOf("=") > 0) {
        var arg_kv = arg.split('=');
        arg = arg_kv[0];
        arg = arg.replace('--','');
        arg = replaceAll(arg, '-', '_');
        options[arg] = arg_kv[1];
        if (typeof opts[arg] == 'string') {
          if (opts[arg] == 'int' || opts[arg] == 'integer') {
            options[arg] = parseInt(options[arg]);
          } else if (opts[arg] == 'float') {
            options[arg] = parseFloat(options[arg]);
          }
        } else if (typeof opts[arg] == 'object') {
          if (opts[arg].type == 'array') {
            var sep = opts[arg].separator || opts[arg].sep || ',';
            options[arg] = options[arg].split(sep);
          }
        }
      } else {
        arg = arg.replace('--','');
        arg = replaceAll(arg, '-', '_');
        options[arg] = true;
      }
    } else {
      argv.push(process_argv[i]);
    }
  }
  options.argv = argv;
  return options;
}