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
- classmethod register_parser(ast_cls: Type[AstArgumentParser])[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 = {}
- get_tracked_refs(module: str, name: str, default: ~cli_command_parser.conversion.argparse_ast.D = <object object>) set[str] | D [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]
- 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
- 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.
- 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