Argparse_Ast Module

class cli_command_parser.conversion.argparse_ast.Script(src_text: str, smart_loop_handling: bool = True, path: PathLike = None)[source]

Bases: object

path: Path | None
property mod_cls_to_ast_cls_map: dict[str, dict[str, Type[AstArgumentParser]]][source]
classmethod register_parser(ast_cls: Type[AstArgumentParser])[source]
add_parser(ast_cls: ParserCls, node: InitNode, call: OptCall, tracked_refs: TrackedRefMap) ParserObj[source]
property parsers: list[ParserObj][source]
class cli_command_parser.conversion.argparse_ast.visit_func(func)[source]

Bases: object

A method that can be called by an AST visitor.

func
class cli_command_parser.conversion.argparse_ast.AddVisitedChild(child_cls: Type[AC], attr: str)[source]

Bases: Generic[AC]

Simplifies the definition of an add_child method that can be called by an AST visitor, where possible.

child_cls
list_attr
class cli_command_parser.conversion.argparse_ast.AstCallable(node: InitNode, parent: AstCallable | Script, tracked_refs: TrackedRefMap, call: Call = None)[source]

Bases: object

represents: RepresentedCallable
visit_funcs = {}
classmethod __init_subclass__(represents: RepresentedCallable = None, **kwargs)[source]
get_tracked_refs(module: str, name: str, default: ~cli_command_parser.conversion.argparse_ast.D = <object object>) set[str] | D[source]
property signature: Signature[source]
property init_func_name: str[source]

The name or alias of the function/callable that was used to initialize this object

property init_func_args: list[str][source]
property init_func_raw_kwargs: dict[str, AST][source]
property init_func_kwargs: dict[str, str][source]
init_call_repr() str[source]
pprint(indent: int = 0)[source]
class cli_command_parser.conversion.argparse_ast.ParserArg(node: InitNode, parent: AstCallable | Script, tracked_refs: TrackedRefMap, call: Call = None)[source]

Bases: AstCallable

parent: ArgCollection
represents(*args, **kwargs)

add_argument(dest, …, name=value, …) add_argument(option_string, option_string, …, name=value, …)

class cli_command_parser.conversion.argparse_ast.ArgCollection(node: InitNode, parent: AstCallable | Script, tracked_refs: TrackedRefMap, call: Call = None)[source]

Bases: AstCallable

parent: ArgCollection | Script
add_argument

Simplifies the definition of an add_child method that can be called by an AST visitor, where possible.

classmethod __init_subclass__(children: Collection[str] = (), **kwargs)[source]
args: list[ParserArg]
groups: list[ArgGroup]
add_mutually_exclusive_group(node: InitNode, call: Call, tracked_refs: TrackedRefMap)[source]
add_argument_group(node: InitNode, call: Call, tracked_refs: TrackedRefMap)[source]
grouped_children() Iterator[tuple[Type[AC], list[AC]]][source]
pprint(indent: int = 0)[source]
visit_funcs = {'add_argument', 'add_argument_group', 'add_mutually_exclusive_group'}
class cli_command_parser.conversion.argparse_ast.ArgGroup(node: InitNode, parent: AstCallable | Script, tracked_refs: TrackedRefMap, call: Call = None)[source]

Bases: ArgCollection

represents(title=None, description=None, *, prefix_chars=None, argument_default=None, conflict_handler=None)
class cli_command_parser.conversion.argparse_ast.MutuallyExclusiveGroup(node: InitNode, parent: AstCallable | Script, tracked_refs: TrackedRefMap, call: Call = None)[source]

Bases: ArgGroup

represents(*, required=False)
class cli_command_parser.conversion.argparse_ast.SubparsersAction(node: InitNode, parent: AstCallable | Script, tracked_refs: TrackedRefMap, call: Call = None)[source]

Bases: AstCallable

parent: ParserObj
add_parser(node: InitNode, call: Call, tracked_refs: TrackedRefMap)[source]
represents(*, title=None, description=None, prog=None, dest=None, help=None, action=None, option_string=None, required=None, metavar=None)
visit_funcs = {'add_parser'}
class cli_command_parser.conversion.argparse_ast.AstArgumentParser(node: InitNode, parent: AstCallable | Script, tracked_refs: TrackedRefMap, call: Call = None)[source]

Bases: ArgCollection

add_subparsers

Simplifies the definition of an add_child method that can be called by an AST visitor, where possible.

sub_parsers: list[SubParser]
represents

alias of ArgumentParser

visit_funcs = {'add_argument', 'add_argument_group', 'add_mutually_exclusive_group', 'add_subparsers'}
class cli_command_parser.conversion.argparse_ast.SubParser(node: InitNode, parent: AstCallable | Script, tracked_refs: TrackedRefMap, call: Call = None)[source]

Bases: AstArgumentParser

represents(name, *, aliases=(), description=None, prog=None, help=None)
sp_parent: SubparsersAction
property init_func_kwargs: dict[str, str][source]