Parse all updater and detector related arguments from args.

    Returns a list of ("name", { "k": "v"})

    :param args: argparse arguments
325500
def parse_cmdline_args(args, classes):
    
    if args is None:
        raise ValueError("args must not be None")
    parsed_args = {}
    for kls in classes:
        prefix = kls.configuration_key_prefix()
        name = kls.configuration_key
        if getattr(args, "%s_%s" % (prefix, name), False):
            logging.debug(
                "Gathering initargs for '%s.%s'", prefix, name)
            initargs = {}
            for arg_name in kls.init_argnames():
                val = getattr(args, "%s_%s_%s" %
                              (prefix, name, arg_name))
                if val is not None:
                    initargs[arg_name] = val
            if prefix not in parsed_args:
                parsed_args[prefix] = []
            parsed_args[prefix].append((name, initargs))
    return parsed_args
626361
def parse_command_line(self, argv=None):
        
        if self.config:
            parser = argparse.ArgumentParser(add_help=False)
            self.settings['config'].add_argument(parser)
            opts, _ = parser.parse_known_args(argv)
            if opts.config is not None:
                self.set('config', opts.config)

            self.params.update(self.import_from_module())

        parser = self.parser()
        opts = parser.parse_args(argv)
        for k, v in opts.__dict__.items():
            if v is None:
                continue
            self.set(k.lower(), v)
769216
def _parse_args(cls):
        
        cls.parser = argparse.ArgumentParser()
        cls.parser.add_argument(
            "symbol", help="Symbol for horizontal line", nargs="*")
        cls.parser.add_argument(
            "--color", "-c", help="Color of the line", default=None, nargs=1)
        cls.parser.add_argument(
            "--version", "-v", action="version", version="0.13")

        return cls.parser
908522
def parse_args():
    
    parser = argparse.ArgumentParser(description="Converts, and downloads a vm by name from vCenter to OVF in specified"
                                                 " directory, then uploads the image as an AMI. AMI will be uploaded "
                                                 "using specified AWS profile, to specified regions. ")
    parser.add_argument('-i', '--vcenter_host', type=str, required=True, help='Hostname or Ip of vCenter API of VM')
    parser.add_argument('-u', '--vcenter_user', type=str, required=True, help='Username for vCenter authentication')
    parser.add_argument('-p', '--vcenter_pass', type=str, required=True, help='Password for authentication to vCenter API')
    parser.add_argument('-n', '--vm_name', type=str, required=True, help='Name of the VM in vCenter')
    parser.add_argument('-d', '--directory', type=str, default=tempfile.mkdtemp(),
                        help='Directory to save the vmdk temp file (defaults to temp location')
    parser.add_argument('-w', '--vcenter_port', type=str, default='443',
                        help='Port to use for communication to vcenter api. Default is 443')
    args = parser.parse_args()
    validate_args(args)
    return args
1355935
def parse_args(argv):
    """"""
    parser = make_parser()

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

    # Use APPENGINEPY_SDK_VERSION if set.
    if not args and (sdk_version_key in os.environ):
        args = (os.environ[sdk_version_key],)

    return opts, args
895984
def parse(self, argv):
        
        rv = {}
        for pattern in self.patterns:
            pattern.apply(rv, argv)
        return rv
968567
def _parse_args():
    
    parser = optparse.OptionParser()
    parser.add_option(
        '--user', dest='user_install', action='store_true', default=False,
        help='install in user site package (requires Python 2.6 or later)')
    parser.add_option(
        '--download-base', dest='download_base', metavar="URL",
        default=DEFAULT_URL,
        help='alternative URL from where to download the setuptools package')
    parser.add_option(
        '--insecure', dest='downloader_factory', action='store_const',
        const=lambda: download_file_insecure, default=get_best_downloader,
        help='Use internal, non-validating downloader'
    )
    options, args = parser.parse_args()
    # positional arguments are ignored
    return options
332430
def get_args_pairs(arguments):
    

    return ' '.join(' '.join(['-' + k, tcl_str(str(v))]) for k, v in arguments.items())
17552
def get_args() -> argparse.Namespace:
    
    parser = argparse.ArgumentParser(prog='python3 linefit.py',
                                     description=('Parameterize and analyze '
                                                  'usability of conduit edge data'))
    parser.add_argument('files', metavar='F', type=str, nargs='*',
                        help=('File(s) for processing. '
                              'Each file has a specific format: '
                              'See README (or header) for specification.'))
    parser.add_argument('-p', '--plot', action='store_true', default=False,
                        help=('Create Plot of file(s)? Note, unless --time flag used, '
                              'will plot middle time.'))
    parser.add_argument('-pd', '--plotdata', action='store_true', default=False,
                        help='Create plot of current datastore.')
    parser.add_argument('-a', '--analyze', action='store_true', default=False,
                        help=('Analyze the file and determine Curvature/Noise parameters. '
                              'If --time not specified, will examine entire file. '
                              'This will add results to datastore with false flags '
                              'in accept field if not provided.'))
    parser.add_argument('-mt', '--machinetest', action='store_true', default=False,
                        help=('Determine if the times from the file are usable based on '
                              'supervised learning model. If --time not specified, '
                              'will examine entire file.'))
    parser.add_argument('-m', '--model', type=str, default='nn',
                        help=('Learning Model to use. Options are ["nn", "svm", "forest", "sgd"]'))
    parser.add_argument('-nnk', '--nnk', type=int, default=10,
                        help=('k-Parameter for k nearest neighbors. Google it.'))
    parser.add_argument('-t', '--time', type=int, default=None,
                        help=('Time (column) of data to use for analysis OR plotting. '
                              'Zero-Indexed'))
    parser.add_argument('-d', '--datastore', type=str, default=DATASTORE,
                        help=("Datastore filename override. "
                              "Don't do this unless you know what you're doing"))
    parser.add_argument('-pds', '--printdata', action='store_true', default=False,
                        help=("Print data"))
    parser.add_argument('-pdss', '--printdatashort', action='store_true', default=False,
                        help=("Print data short"))
    args = parser.parse_args()
    return args
1147547
def args_wrapper(*args):
    
    out = defaultdict(list)
    for callback in args:
        callback_args = callback.callback_args()
        for k, v in callback_args.items():
            out[k].append(v)
    return dict(out)
1338011
def get_parsed_args(self, comp_words):
        
        active_parsers = self._patch_argument_parser()

        parsed_args = argparse.Namespace()

        self.completing = True
        if USING_PYTHON2:
            # Python 2 argparse only properly works with byte strings.
            comp_words = [ensure_bytes(word) for word in comp_words]

        try:
            active_parsers[0].parse_known_args(comp_words, namespace=parsed_args)
        except BaseException:  # pylint: disable=broad-except
            pass

        self.completing = False
        return parsed_args
945141
def _get_args_to_parse(args, sys_argv):
    
    arguments = args if args is not None else sys_argv[1:]
    _LOG.debug("Parsing arguments: %s", arguments)
    return arguments
57373
def _get_dependencies_from_kwargs(self, args):
        
        if not isinstance(args, dict):
            raise TypeError('"kwargs" must be a dictionary')

        dependency_names = set()
        for arg in args.values():
            new_names = self._check_arg(arg)
            dependency_names.update(new_names)
        return dependency_names
1112618
def update_args(self, args):
        
        for cfg in args:
            keys, v = cfg.split('=', maxsplit=1)
            keylist = keys.split('.')

            dic = self
            for i, k in enumerate(keylist[:-1]):
                assert k in dir(dic), "Unknown config key: {}".format(keys)
                dic = getattr(dic, k)
            key = keylist[-1]

            oldv = getattr(dic, key)
            if not isinstance(oldv, str):
                v = eval(v)
            setattr(dic, key, v)
645443
def parse_args(args):
    
    parser = argparse.ArgumentParser(
        description="Imports GramVaani data for Deep Speech"
    )
    parser.add_argument(
        "--version",
        action="version",
        version="GramVaaniImporter {ver}".format(ver=__version__),
    )
    parser.add_argument(
        "-v",
        "--verbose",
        action="store_const",
        required=False,
        help="set loglevel to INFO",
        dest="loglevel",
        const=logging.INFO,
    )
    parser.add_argument(
        "-vv",
        "--very-verbose",
        action="store_const",
        required=False,
        help="set loglevel to DEBUG",
        dest="loglevel",
        const=logging.DEBUG,
    )
    parser.add_argument(
        "-c",
        "--csv_filename",
        required=True,
        help="Path to the GramVaani csv",
        dest="csv_filename",
    )
    parser.add_argument(
        "-t",
        "--target_dir",
        required=True,
        help="Directory in which to save the importer GramVaani data",
        dest="target_dir",
    )
    return parser.parse_args(args)
104514
def _get_args(args):
    
    parser = argparse.ArgumentParser(
        description='A tool to extract features into a simple format.',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    )
    parser.add_argument('--no-cache', action='store_true')
    parser.add_argument('--deploy', action='store_true')
    parser.add_argument('--cache-path', type=str, default='fex-cache.pckl',
                        help='Path for cache file')
    parser.add_argument('--path', type=str, default='features.csv',
                        help='Path to write the dataset to')
    args = parser.parse_args(args)
    if args.no_cache:
        args.cache_path = None
    return args
454660
def convert_the_args(raw_args):
    
    if not raw_args:
        return ""
    if isinstance(raw_args,dict):
        out_args = ", ".join([ "{}={}".format(k,v) for k,v in raw_args.iteritems() ])
        
    elif isinstance(raw_args,(list,tuple)):
        new_list = []
        for x in raw_args:
            if isinstance(x,basestring):
                new_list.append(x)
            elif isinstance(x,dict):
                new_list.append( ", ".join([ "{}={}".format(k,v) for k,v in x.iteritems() ]) )
            else:
                raise ValueError("Error preparing the getters")
        out_args = ", ".join(new_list)
    else:
        raise ValueError("Couldn't recognize list of getters")
    return out_args