Parse command line arguments
764504
def get_args():
    
    desc = 'Perform queries against the NCBI Taxa database'
    epi = """DESCRIPTION:
    This script lets you find out what TaxIDs to pass to ngd, and will write 
    a simple one-item-per-line file to pass in to it. It utilises the ete3 
    toolkit, so refer to their site to install the dependency if it's not 
    already satisfied.

    You can query the database using a particular TaxID, or a scientific name. 
    The primary function of the script is to return all the child taxa of the
    specified parent taxa. If specified with -v verbose flags however, the
    script will also print out some information about the lineages etc.
 
    WARNING: This script is still somewhat experimental
    """
    parser = argparse.ArgumentParser(description=desc, epilog=epi,
                                     formatter_class=argparse.RawTextHelpFormatter)
    parser.add_argument('taxid', metavar='taxid', type=str,
			help='A comma-separated list of TaxIDs and/or taxon names. (e.g. 561,2172)')   
    parser.add_argument('-v', '--verbose', action='count', default=0,
			help='Verbose behaviour. Supports 3 levels at present: Off = 0, Info = 1, Verbose = 2. (default: %(default)s)')
    parser.add_argument('-d', '--database', type=str, default=None,
			help='NCBI taxonomy database file path. If "None", it will be downloaded (default: %(default)s)')
    parser.add_argument('-u', '--update', action='store_true', default=False,
                        help='Update the local taxon database before querying. Recommended if not used for a while. (default: %(default)s)')
    parser.add_argument('-j', '--just-taxids', action='store_true', default=False,
                        help='Just write out a list of taxids an no other information (default: %(default)s)')
    parser.add_argument('-i', '--taxon-info', action='store_true', default=False,
                        help='Just write out rank & lineage info on the provided taxids (default: %(default)s)')
    parser.add_argument('-o', '--outfile', action='store',
			help='Output file to store the descendent TaxIDs for the query.')
    return parser.parse_args()
514563
def parse_args():
    
    parser = argparse.ArgumentParser()
    parser.add_argument('-M', action='store_true')
    parser.add_argument('-m', action='store_true')
    parser.add_argument('-f', action='store_true')
    args = parser.parse_args()
    major, minor, fix = args.M, args.m, args.f
    if major + minor + fix != 1:
        fail('Please select one and only one action.')
    return major, minor, fix
934582
def _parse_arguments():
    
    parser = argparse.ArgumentParser(
        description='eg provides examples of common command usage.'
    )

    parser.add_argument(
        '-v',
        '--version',
        action='store_true',
        help='Display version information about eg'
    )

    parser.add_argument(
        '-f',
        '--config-file',
        help='Path to the .egrc file, if it is not in the default location.'
    )

    parser.add_argument(
        '-e',
        '--edit',
        action='store_true',
        help="""Edit the custom examples for the given command. If editor-cmd
        is not set in your .egrc and $VISUAL and $EDITOR are not set, prints a
        message and does nothing."""
    )

    parser.add_argument(
        '--examples-dir',
        help='The location to the examples/ dir that ships with eg'
    )

    parser.add_argument(
        '-c',
        '--custom-dir',
        help='Path to a directory containing user-defined examples.'
    )

    parser.add_argument(
        '-p',
        '--pager-cmd',
        help='String literal that will be invoked to page output.'
    )

    parser.add_argument(
        '-l',
        '--list',
        action='store_true',
        help='Show all the programs with eg entries.'
    )

    parser.add_argument(
        '--color',
        action='store_true',
        dest='use_color',
        default=None,
        help='Colorize output.'
    )

    parser.add_argument(
        '-s',
        '--squeeze',
        action='store_true',
        default=None,
        help='Show fewer blank lines in output.'
    )

    parser.add_argument(
        '--no-color',
        action='store_false',
        dest='use_color',
        help='Do not colorize output.'
    )

    parser.add_argument(
        'program',
        nargs='?',
        help='The program for which to display examples.'
    )

    args = parser.parse_args()

    if len(sys.argv) < 2:
        # Too few arguments. We can't specify this using argparse alone, so we
        # have to manually check.
        parser.print_help()
        parser.exit()
    elif not args.version and not args.list and not args.program:
        parser.error(_MSG_BAD_ARGS)
    else:
        return args
197205
def parse_config_args(args)
      result = {}
      args.scan(/--?([a-z\-\_]+)\s([\d]+)\s?/).each do |arg|
        result[arg.first] = arg.last
      end
      {'raw' => args, 'parsed' => result}
    end
84063
def _parse_arguments():
    """"""
    parser = argparse.ArgumentParser(description="CMake AST Dumper")
    parser.add_argument("filename", nargs=1, metavar=("FILE"),
                        help="read FILE")
    return parser.parse_args()
411531
def parse_args():
    """"""
    parser = argparse.ArgumentParser(
        description=HELPTEXT,
        epilog="This application is powered by elks with superpowers!")
    parser.add_argument('--version', action='store_true',
                        help="Display elkme version and exit")
    parser.add_argument('-v', '--verbose', action='count',
                        help="Debug output", default=0)
    parser.add_argument('message', metavar='message', type=str, nargs='*',
                        help="The message to be sent (<160 characters)")
    parser.add_argument('-f', '--file', metavar='file', action='store',
                        help="""File to read message from (only the
                        first 160 characters are sent)""")
    parser.add_argument('-t', '--to', dest='to', action='store',
                        help="Phone number to receive the text message")
    parser.add_argument('-s', '--sender', '--from', dest='sender',
                        action='store', help="""
                        Sender of the message. See 46elks' API documentation
                        for valid formats""")
    parser.add_argument('-u', '--username', dest='username', action='store',
                        help="Your API username from https://www.46elks.com/")
    parser.add_argument('-p', '--password', dest='password', action='store',
                        help="Your API password from https://www.46elks.com/")
    parser.add_argument('--flash', action='store_true',
                        help="Send SMS as a flash-SMS")
    parser.add_argument('-l', '--length', metavar='length',
            action='store', type=int, default=160,
            help='Maximum length of the message')
    parser.add_argument('-c', '--config', dest='configfile',
                        help="""Location of the custom configuration file""")
    parser.add_argument('--saveconf', dest='saveconf',
                        action='count', help="""
                        Generates a configuration file from the commandline
                        options and exits.""")
    parser.add_argument('--editconf', action='store_true', help="""
                        Opens the configuration file in your $EDITOR""")
    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
444581
def parse_command_line_args():
    """"""
    parser = argparse.ArgumentParser(description='PipApp. {}'.format(DESCRIPTION))
    parser.add_argument(
        '-d', '--dir',
        metavar='DIR',
        help='Root directory where to create new project files and dirs. Default is current directory.'
    )
    parser.add_argument(
        '-v,', '--version',
        action='version',
        version='{} v{}'.format(PROGRAMNAME, VERSION)
    )
    parser.add_argument(
        "project_name",
        metavar='PROJECTNAME',
        help="Name of the generated Project. Has to be a valid Python identifier."
    )
    return parser.parse_args()
1309159
private function parseArgs() {
        // Use the global $argv variable to retrieve command-line arguments
        global $argv;

        // Reset values
        $this->_flags       = [];
        $this->_options     = [];
        $this->_parameters  = [];

        // index[0] is the script name and index[1] is the command name
        // so count starts from 2 from now on
        for ($i = 2; $i < count($argv); $i++) {
            if (strpos($argv[$i], '-') === 0) {
                // In gnuopt flags are determined by parameters that starts with `-`
                $flag = ltrim($argv[$i], '-');
                // Make sure that every things splittable
                $flag = strlen($flag) > 1 ? str_split($flag) : [$flag];
                // Then register flags
                $this->_flags = array_merge($this->_flags, $flag);
            } else if (strpos($argv[$i], $this->_delimeter) > 0) {
                // In our history options are the parameters that lets the user
                // to set the value of a key 
                $tokens = explode($this->_delimeter, $argv[$i]);
                // Make sure to remove the option key
                $param_name = strtolower($tokens[0]);
                array_shift($tokens);
                // Then let the others to be the value
                $param_value = implode($this->_delimeter, $tokens);
                // Register options
                // NOTE: Options are allowed to be overwritten
                $this->_options[$param_name] = $param_value;
            } else {
                // Else, it a parameter
                $this->_parameters[] = $argv[$i];
            }
        }
    }
617983
def parse_args(self, arguments=None):
        
        self._args = self.parser.parse_args(arguments)
        return self.args
914265
def arg_strings(parsed_args, name=None):
    """"""
    name = name or 'arg_strings'
    value = getattr(parsed_args, name, [])
    if isinstance(value, str):
        return [value]
    try:
        return [v for v in value if isinstance(v, str)]
    except TypeError:
        return []
197957
function Args() {
    if (argv._.length >= 1) {
        try {
            // Attempt to parse 1st argument as JSON string
            _.extend(this, JSON.parse(argv._[0]));
        } catch (err) {
            // Pass, we must be in the console so don't worry about it
        }
    }
}
212452
def __parse_args(cam_c):
    """"""
    user = None
    pswd = None
    name = None
    address = "{address}:{port}".format(**cam_c)
    if "user" in cam_c:
        user = cam_c["user"]
        if "pswd" in cam_c:
            pswd = cam_c["pswd"]
    if "name" in cam_c:
        name = cam_c["name"]
    return {"user": user, "pswd": pswd, "name": name, "address": address}
551356
def parse_args():
    
    parser = ArgumentParser(description="PyTorch distributed training launch "
                                        "helper utilty that will spawn up "
                                        "multiple distributed processes")

    # Optional arguments for the launch helper
    parser.add_argument("--nnodes", type=int, default=1,
                        help="The number of nodes to use for distributed "
                             "training")
    parser.add_argument("--node_rank", type=int, default=0,
                        help="The rank of the node for multi-node distributed "
                             "training")
    parser.add_argument("--nproc_per_node", type=int, default=1,
                        help="The number of processes to launch on each node, "
                             "for GPU training, this is recommended to be set "
                             "to the number of GPUs in your system so that "
                             "each process can be bound to a single GPU.")
    parser.add_argument("--master_addr", default="127.0.0.1", type=str,
                        help="Master node (rank 0)'s address, should be either "
                             "the IP address or the hostname of node 0, for "
                             "single node multi-proc training, the "
                             "--master_addr can simply be 127.0.0.1")
    parser.add_argument("--master_port", default=29500, type=int,
                        help="Master node (rank 0)'s free port that needs to "
                             "be used for communciation during distributed "
                             "training")
    parser.add_argument('--no_hyperthreads', action='store_true',
                        help='Flag to disable binding to hyperthreads')
    parser.add_argument('--no_membind', action='store_true',
                        help='Flag to disable memory binding')

    # non-optional arguments for binding
    parser.add_argument("--nsockets_per_node", type=int, required=True,
                        help="Number of CPU sockets on a node")
    parser.add_argument("--ncores_per_socket", type=int, required=True,
                        help="Number of CPU cores per socket")

    # positional
    parser.add_argument("training_script", type=str,
                        help="The full path to the single GPU training "
                             "program/script to be launched in parallel, "
                             "followed by all the arguments for the "
                             "training script")

    # rest from the training program
    parser.add_argument('training_script_args', nargs=REMAINDER)
    return parser.parse_args()
203543
def parse_args():
    """"""
    parser = argparse.ArgumentParser(
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        description='Diagnose script for checking the current system.')
    choices = ['python', 'pip', 'mxnet', 'os', 'hardware', 'network']
    for choice in choices:
        parser.add_argument('--' + choice, default=1, type=int,
                            help='Diagnose {}.'.format(choice))
    parser.add_argument('--region', default='', type=str,
                        help="Additional sites in which region(s) to test. \
                        Specify 'cn' for example to test mirror sites in China.")
    parser.add_argument('--timeout', default=10, type=int,
                        help="Connection test timeout threshold, 0 to disable.")
    args = parser.parse_args()
    return args
396720
def parse_args():
    """"""

    parser = get_parser()

    if len(sys.argv) < 2:
        parser.print_help()
        warnings.warn('Too few arguments!', UserWarning)
        parser.exit(1)

    # parsing
    try:
        params = parser.parse_args()
    except Exception as exc:
        print(exc)
        raise ValueError('Unable to parse command-line arguments.')

    in_features_path = os.path.abspath(params.in_features_path)
    if not os.path.exists(in_features_path):
        raise IOError("Given features file doesn't exist.")

    groups_path = os.path.abspath(params.groups_path)
    if not os.path.exists(groups_path):
        raise IOError("Given groups file doesn't exist.")

    return in_features_path, groups_path, params.weight_method, params.num_bins, params.edge_range, \
           params.trim_outliers, params.trim_percentile, params.return_networkx_graph, params.out_weights_path
545563
def parse_args(args) #:nodoc:
      remapping = {}
      for arg in args
        splited = arg.split(':=')
        if splited.length == 2
          key, value = splited
          if key == '__name'
            @node_name = resolve_name(value)
          elsif key == '__ip'
            @host = value
          elsif key == '__hostname'
            @host = value
          elsif key == '__master'
            @master_uri = value
          elsif key == '__ns'
            @ns = value
          elsif key[0] == '_'[0]
            # local name remaps
            key[0] = '~'
            remapping[resolve_name(key)] = convert_if_needed(value)
          else
            # remaps
            remapping[key] = convert_if_needed(value)
          end
        end
      end
      remapping
    end