tyro._backends._tyro_help_formatting

Help formatting utils used for argparse backend.

Module Contents

tyro._backends._tyro_help_formatting.format_help(prog: str, parser_spec: tyro._parsers.ParserSpecification, args: list[tyro._parsers.ArgWithContext], subparser_frontier: dict[str, tyro._parsers.SubparsersSpecification]) list[str][source]
Parameters:
Return type:

list[str]

Recursively search for arguments in a ParserSpecification. Used for error message printing.

Returns a list of arguments, whether the parser has subcommands or not, and – if unrecognized_arguments is passed in — whether an unrecognized argument exists under a different subparser.

Parameters:
  • args (list[str]) – Arguments being parsed. Used for heuristics on subcommands.

  • parser_spec (tyro._parsers.ParserSpecification) – Argument parser specification.

  • subcommands – Prog corresponding to parser_spec.

  • unrecognized_arguments (set[str]) – Used for same_exists return value.

  • prog (str)

Return type:

tuple[list[_ArgumentInfo], bool, bool]

tyro._backends._tyro_help_formatting.unrecognized_args_error(prog: str, unrecognized_args_and_progs: list[tuple[str, str]], args: list[str], parser_spec: tyro._parsers.ParserSpecification, console_outputs: bool, add_help: bool) NoReturn[source]
Parameters:
Return type:

NoReturn

tyro._backends._tyro_help_formatting.required_args_error(prog: str, required_args: list[tyro._parsers.ArgWithContext], unrecognized_args_and_progs: list[tuple[str, str]], console_outputs: bool, add_help: bool) NoReturn[source]
Parameters:
Return type:

NoReturn

tyro._backends._tyro_help_formatting.error_and_exit(title: str, *contents: tyro._fmtlib.Element | str, prog: str | list[str], console_outputs: bool, add_help: bool) NoReturn[source]
Parameters:
Return type:

NoReturn