neuralib.argp.core.argument

neuralib.argp.core.argument(*options: str, action: Literal['store', 'store_const', 'store_true', 'store_false', 'append', 'append_const', 'extend', 'count', 'help', 'version', 'boolean'] = ..., nargs: int | Literal['*', '+', '?', '...'] = ..., const: T = ..., default: T = ..., type: Type | Callable[[str], T] = ..., validator: Callable[[T], bool] = ..., validate_on_set: bool = True, choices: Sequence[str] = ..., required: bool = False, hidden: bool = False, help: str = ..., group: str = None, ex_group: str = None, metavar: str = ...) T[source]

create an argument attribute.

Example:

>>> class Example:
...     # create a bool flag
...     bool_flag: bool = argument('-f')
...     # create a single value option
...     str_value: str = argument('-a', metavar='VALUE')
...     # create a single value option with type auto-casting
...     int_value: int = argument('-i', metavar='VALUE')
...     # create a position argument
...     pos_value: str = argument(metavar='VALUE')
...     # create a multiple value option
...     list_value: list[str] = argument('-l', metavar='VALUE', nargs=2, action='append')
Parameters:

kwargs – Please see argparse.ArgumentParser.add_argument for detailed.