Get options from arguments.
552474
function options(o, k, a, i) {
  if(k==='--help') o.help = true;
  else if(k==='--version') o.version = true;
  else if(k==='-l' || k==='--log') o.log = true;
  else if(k==='-i' || k==='--id') o.id = a[++i];
  else if(k==='-v' || k==='--video') o.video = a[++i];
  else if(k==='-t' || k==='--thumbnail') o.thumbnail = a[++i];
  else if(k==='-c' || k==='--caption') o.caption = a[++i];
  else if(k==='-m' || k==='--meta') o.meta = a[++i];
  else if(k==='-d' || k==='--descriptionpath') o.descriptionpath = a[++i];
  else if(k==='-ci' || k==='--client_id') o.client_id = a[++i];
  else if(k==='-ct' || k==='--client_token') o.client_token = a[++i];
  else if(k==='-ot' || k==='--title') o.title = a[++i];
  else if(k==='-od' || k==='--description') o.description = a[++i];
  else if(k==='-ok' || k==='--tags') o.tags = a[++i];
  else if(k==='-ol' || k==='--language') o.language = a[++i];
  else if(k==='-oc' || k==='--category') o.category = a[++i];
  else if(k==='-op' || k==='--privacystatus') o.privacystatus = a[++i];
  else if(k==='-oe' || k==='--embeddable') o.embeddable = true;
  else if(k==='-ol' || k==='--license') o.license = a[++i];
  else if(k==='-os' || k==='--publicstatsviewable') o.publicstatsviewable = true;
  else if(k==='-opa' || k==='--publishat') o.publishat = a[++i];
  else if(k==='-ord' || k==='--recordingdate') o.recordingdate = a[++i];
  else if(k==='-opi' || k==='--playlistids') o.playlistids = a[++i];
  else if(k==='-opt' || k==='--playlisttitles') o.playlisttitles = a[++i];
  else if(k==='-ola' || k==='--location_latitude') o.location_latitude = a[++i];
  else if(k==='-olo' || k==='--location_longitude') o.location_longitude = a[++i];
  else if(k==='-old' || k==='--locationdescription') o.locationdescription = a[++i];
  else if(k==='-uc' || k==='--upload_chunk') o.upload_chunk = a[++i];
  else if(k==='-ur' || k==='--upload_rate') o.upload_rate = a[++i];
  else if(k==='-ut' || k==='--upload_time') o.upload_time = a[++i];
  else if(k==='-ap' || k==='--auth_port') o.auth_port = a[++i];
  else if(k==='-ah' || k==='--auth_headless') o.auth_headless = true;
  else o.input = a[i];
  return i+1;
}
270456
public static String getOptionValue(String[] args, String optionName) {
		String opt = "-" + optionName + "=";
		for (String arg : args) {
			if (arg.startsWith(opt))
				return arg.substring(opt.length());
		}
		return null;
	}
1094250
def get_arguments(self):
    """"""
    # In python 2, the command line is unicode, which needs to be converted to string before pickling;
    # In python 3, the command line is bytes, which can be pickled directly
    args = loads(self.grid_arguments)['kwargs'] if isinstance(self.grid_arguments, bytes) else loads(self.grid_arguments.encode())['kwargs']
    # in any case, the commands have to be converted to str
    retval = {}
    if 'pe_opt' in args:
      retval['pe_opt'] = args['pe_opt']
    if 'memfree' in args and args['memfree'] is not None:
      retval['memfree'] = args['memfree']
    if 'hvmem' in args and args['hvmem'] is not None:
      retval['hvmem'] = args['hvmem']
    if 'gpumem' in args and args['gpumem'] is not None:
      retval['gpumem'] = args['gpumem']
    if 'env' in args and len(args['env']) > 0:
      retval['env'] = args['env']
    if 'io_big' in args and args['io_big']:
      retval['io_big'] = True

    # also add the queue
    if self.queue_name is not None:
      retval['queue'] = str(self.queue_name)

    return retval
897287
def parse_args(argv=None):
    """"""
    parser = ArgumentParser()
    parser.add_argument('--password', dest="password", type=str)
    parser.add_argument('--user', dest="user", type=str)
    parser.add_argument('--config-file', dest="config_file", type=str)

    options = parser.parse_args(argv)
    return options
941674
def parse_options(**kwargs):
    """"""
    return {camelize(key): value
            for key, value in kwargs.items()
            if value is not None}
671169
def args(self):
        """"""
        if self._args is None:
            parser = self._build_parser()
            self._args = parser.parse_args()
        return self._args
604222
def get_options(argv):
    
    arg_parser = make_arg_parser()
    options, unknown = arg_parser.parse_known_args(argv)
    if unknown:
        arg_parser.print_help()
        raise exceptions.UnknownArguments(
            "unknown args: {0!r}".format(unknown))
    options.print_help = arg_parser.print_help
    return options
628313
def _download_args(options):
    """"""
    return dict(
        version=options.version,
        download_base=options.download_base,
        downloader_factory=options.downloader_factory,
        to_dir=options.to_dir,
    )
376377
def _get_args(self, kwargs):
        '''
        
        '''
        _args = list()
        _kwargs = salt.utils.args.clean_kwargs(**kwargs)

        return _args, _kwargs
104898
def get_env_args(env):
    """"""
    for arg, val in env.vars.get('global_args', {}).items():
        if val is True:
            yield '--%s' % arg
        elif isinstance(val, int):
            for _ in range(val):
                yield '--%s' % arg
        elif val is None:
            continue
        else:
            yield '--%s=%s' % (arg, val)
1321661
def _arg2opt(arg):
    '''
    
    '''
    res = [o for o, a in option_toggles.items() if a == arg]
    res += [o for o, a in option_flags.items() if a == arg]
    return res[0] if res else None
788148
def parse_options(given, available):
    """"""
    for key, value in sorted(given.items()):
        if not value:
            continue
        if key in available:
            yield "--{0}={1}".format(key, value)
463945
def get_args(method_or_func):
    """"""
    try:
        # Python 3.0+
        args = list(inspect.signature(method_or_func).parameters.keys())
    except AttributeError:
        # Python 2.7
        args = inspect.getargspec(method_or_func).args
    return args
287209
def extract_kwargs(args, exp_keys, exp_elems):
    """"""
    arg_dict = {}    # For arguments that have values
    arg_set = set()  # For arguments that are True or False (present in set if True)
    for key, val in args.items():
        if exp_keys is not None and key in exp_keys and val:
            arg_dict[key] = val
        elif exp_elems is not None and key in exp_elems and val:
            arg_set.add(key)
    return {'dict':arg_dict, 'set':arg_set}
928484
def to_args(self):
        
        def has_value(name, value):
            """ Test for non-null option values.
            """
            null_values = ("False", "None", "[]", '""', "''", "0")
            if not value or value in null_values:
                return False
            if name in _arg_defaults:
                if str(value) == str(_arg_defaults[name]):
                    return False
            return True

        def filter_opt(name, value):
            """ Filter out preset and null-valued options.
            """
            if name in ("add_preset", "del_preset", "desc", "note"):
                return False
            return has_value(name, value)

        def argify(name, value):
            """ Convert sos option notation to command line arguments.
            """
            # Handle --verbosity specially
            if name.startswith("verbosity"):
                arg = "-" + int(value) * "v"
                return arg

            name = name.replace("_", "-")

            value = ",".join(value) if _is_seq(value) else value

            if value is not True:
                opt = "%s %s" % (name, value)
            else:
                opt = name

            arg = "--" + opt if len(opt) > 1 else "-" + opt
            return arg

        opt_items = sorted(self.dict().items(), key=lambda x: x[0])
        return [argify(n, v) for (n, v) in opt_items if filter_opt(n, v)]
388213
def getArgs():
    """"""
    try:
        nb_to_launch = int(sys.argv[1])
    except:
        nb_to_launch = 0

    if nb_to_launch == 0:
        nb_to_launch = getCPUcount()

    try:
        verbosity = int(sys.argv[2])
    except:
        verbosity = 3

    return nb_to_launch, verbosity, sys.argv[3:]
1184654
def args(self) -> str:
        """"""
        return '{}{}{}{}{}'.format(
            to_ascii_hex(self._index, 2),
            to_ascii_hex(self._group_number, 2),
            to_ascii_hex(self._unit_number, 2),
            to_ascii_hex(int(self._enable_status), 4),
            to_ascii_hex(int(self._switches), 4))