jacinle.cli.argument#
A customized argument parser.
Classes
A customized argument parser. |
|
Class AsEnumAction
- class AsEnumAction[source]#
Bases:
Action
- __init__(option_strings, dest, type, nargs=None, const=None, default=None, choices=None, required=False, help=None, metavar=None)[source]#
- __new__(**kwargs)#
- format_usage()#
Class JacArgumentParser
- class JacArgumentParser[source]#
Bases:
ArgumentParser
A customized argument parser. The main difference is that
JacArgumentParser
supports additional types, including:type='bool'
: a boolean value, internally converted toTrue
(true, t, yes, y, 1) orFalse
(no, n, false, f, 0).type='checked_file'
: a file path, checked to be an existing file.type='checked_dir'
: a directory path, checked to be an existing directory.type='ensured_dir'
: a directory path, checked to be an existing directory, and created if not.type='kv'
: a key-value pair, separated by=
and;
. For example,--configs "data.int_or_float=int_value; data.string='string_value'"
.action='set_device'
: set CUDA visible devices.action='as_enum'
: convert the argument to an enum value.
- __new__(**kwargs)#
- add_argument(dest, ..., name=value, ...)#
- add_argument(option_string, option_string, ..., name=value, ...) None
- add_argument_group(*args, **kwargs)#
- add_mutually_exclusive_group(**kwargs)#
- add_subparsers(**kwargs)#
- convert_arg_line_to_args(arg_line)#
- error(message: string)#
Prints a usage message incorporating the message to stderr and exits.
If you override this in a subclass, it should not return – it should either exit or raise an exception.
- exit(status=0, message=None)#
- format_help()#
- format_usage()#
- get_default(dest)#
- parse_args(args=None, namespace=None)#
- parse_intermixed_args(args=None, namespace=None)#
- parse_known_args(args=None, namespace=None)#
- parse_known_intermixed_args(args=None, namespace=None)#
- print_help(file=None)#
- print_usage(file=None)#
- register(registry_name, value, object)#
- set_defaults(**kwargs)#
Class SetDeviceAction