module documentation
Classes and functions for working with command-line arguments alongside the argparse module.
| Class | |
Formatter for command-line arguments found from a dataclass. |
| Class | |
When instantiated with a type, returns a callable that converts a passed string to that type. |
| Function | construct |
Given a key-value dictionary, construct something we can pass to an argparse parser. Entries with None as their value will NOT be constructed into the list. |
| Function | parse |
Use the argparse package to read the fields of a DataClass. Fields that are "init" fields will be used as command-line arguments. A "description" entry will be looked for in a field's metadata dict, and used if it is found... |
| Variable | re |
Undocumented |
| Variable | _lgr |
Undocumented |
Given a key-value dictionary, construct something we can pass to an argparse parser.
Entries with None as their value will NOT be constructed into the list.
def parse_args_of_dataclass(dataclass:
type, argv: list[ str] | tuple[ str], show_help: bool = False, prog: str = None, description: str = None, arg_prefix: str = '', metadata_keys: list[ str] = None) -> dict[ str, Any]:
¶
Use the argparse package to read the fields of a DataClass. Fields that are "init" fields will be
used as command-line arguments. A "description" entry will be looked for in a field's metadata dict,
and used if it is found. Type conversion is handled by converting command-line argument string to the
field's type as specified in the field.type attribute. The type conversion uses TypeConverterFactory.