Command_Builder Module

cli_command_parser.conversion.command_builder.convert_script(script: Script, add_methods: bool = False) str[source]
class cli_command_parser.conversion.command_builder.Converter(ast_obj: AC | Script, parent: Converter | None = None)[source]

Bases: Generic[AC], ABC

converts: Type[AC] = None
newline_between_members: bool = False
classmethod __init_subclass__(converts: Type[AC] = None, newline_between_members: bool = None, **kwargs)[source]
classmethod for_ast_callable(ast_obj: AC | Type[AC]) Type[Converter[AC]][source]
classmethod init_for_ast_callable(ast_obj: AC, *args, **kwargs) Converter[AC][source]
classmethod init_group(parent: CollectionConverter, ast_objs: list[AC]) ConverterGroup[C][source]
convert(indent: int = 0) str[source]
abstract format_lines(indent: int = 0) Iterator[str][source]
class cli_command_parser.conversion.command_builder.ConverterGroup(parent: CollectionConverter, member_type: Type[C], members: list[C])[source]

Bases: Generic[C]

parent
member_type
members
format_all(indent: int = 0) Iterator[str][source]
class cli_command_parser.conversion.command_builder.ScriptConverter(*args, add_methods: bool = False, **kwargs)[source]

Bases: Converter

format_lines(indent: int = 0) Iterator[str][source]
converts

alias of Script

class cli_command_parser.conversion.command_builder.CollectionConverter(ast_obj: AC | Script, parent: Converter | None = None)[source]

Bases: Converter[AC], ABC

ast_obj: ArgCollection
parent: CollectionConverter | None
property name_mode: str | None[source]
property grouped_children: list[ConverterGroup[ParamConverter | GroupConverter | Converter]][source]
descendant_args() Iterator[ParamConverter][source]
format_members(prefix: str, indent: int = 4) Iterator[str][source]
finalize(had_members: bool, prefix: str, indent: int = 4)[source]
class cli_command_parser.conversion.command_builder.ParserConverter(parser: AstArgumentParser, parent: ParserConverter = None, counter: count = None, *, add_methods: bool = False)[source]

Bases: CollectionConverter[AstArgumentParser]

ast_obj: AstArgumentParser
parent: ParserConverter | None
property sub_parser_converters: list[ParserConverter][source]
descendant_args() Iterator[ParamConverter][source]
format_lines(indent: int = 0) Iterator[str][source]
finalize(had_members: bool, prefix: str, indent: int = 4)[source]
property is_sub_parser: bool[source]
property name: str[source]
property name_mode: str | None[source]
converts

alias of AstArgumentParser

class cli_command_parser.conversion.command_builder.GroupConverter(ast_obj: AC | Script, parent: Converter | None = None)[source]

Bases: CollectionConverter[ArgGroup]

ast_obj: ArgGroup
format_lines(indent: int = 4) Iterator[str][source]
converts

alias of ArgGroup

newline_between_members: bool = True
class cli_command_parser.conversion.command_builder.ParamConverter(arg: ParserArg, parent: CollectionConverter, num: int)[source]

Bases: Converter[ParserArg]

ast_obj: ParserArg
parent: CollectionConverter | None
classmethod init_group(parent: CollectionConverter, args: list[ParserArg]) ParamConverterGroup[source]
format_lines(indent: int = 4) Iterator[str][source]
format(indent: int = 4) str[source]
property attr_name: str[source]
property name_mode: str | None[source]
property cmd_option_strs: list[str][source]
property use_auto_long_opt_str: bool[source]
get_pos_args() Iterable[str][source]
get_cls_and_kwargs() tuple[str, BaseArgs][source]
property is_pass_thru: bool[source]
property is_positional: bool[source]
property is_option: bool[source]
converts

alias of ParserArg

class cli_command_parser.conversion.command_builder.ParamConverterGroup(parent: CollectionConverter, member_type: Type[C], members: list[C])[source]

Bases: ConverterGroup[ParamConverter]

format_all(indent: int = 4) Iterator[str][source]
class cli_command_parser.conversion.command_builder.BaseArgs(help: 'OptStr' = None)[source]

Bases: object

help: OptStr = None
to_str(*args: str) str[source]
classmethod from_kwargs(**kwargs)[source]
class cli_command_parser.conversion.command_builder.CommandArgs(help: 'OptStr' = None, choice: 'OptStr' = None, choices: 'OptStr' = None, prog: 'OptStr' = None, usage: 'OptStr' = None, description: 'OptStr' = None, epilog: 'OptStr' = None, option_name_mode: 'OptStr' = None, add_help: 'OptStr' = None, docs_url: 'OptStr' = None, email: 'OptStr' = None)[source]

Bases: BaseArgs

choice: OptStr = None
choices: OptStr = None
prog: OptStr = None
usage: OptStr = None
description: OptStr = None
epilog: OptStr = None
option_name_mode: OptStr = None
add_help: OptStr = None
docs_url: OptStr = None
email: OptStr = None
class cli_command_parser.conversion.command_builder.ParamBaseArgs(help: 'OptStr' = None, name: 'OptStr' = None, default: 'OptStr' = None, required: 'OptStr' = None, metavar: 'OptStr' = None, hide: 'OptStr' = None)[source]

Bases: BaseArgs

name: OptStr = None
default: OptStr = None
required: OptStr = None
metavar: OptStr = None
hide: OptStr = None
to_str(*args: str) str[source]
class cli_command_parser.conversion.command_builder.PassThruArgs(help: 'OptStr' = None, name: 'OptStr' = None, default: 'OptStr' = None, required: 'OptStr' = None, metavar: 'OptStr' = None, hide: 'OptStr' = None)[source]

Bases: ParamBaseArgs

class cli_command_parser.conversion.command_builder.ParamArgs(help: 'OptStr' = None, name: 'OptStr' = None, default: 'OptStr' = None, required: 'OptStr' = None, metavar: 'OptStr' = None, hide: 'OptStr' = None, action: 'OptStr' = None, type: 'OptStr' = None, nargs: 'OptStr' = None, choices: 'OptStr' = None)[source]

Bases: ParamBaseArgs

action: OptStr = None
type: OptStr = None
nargs: OptStr = None
choices: OptStr = None
classmethod init_positional(action: OptStr = None, nargs: OptStr = None, **kwargs)[source]
class cli_command_parser.conversion.command_builder.OptionArgs(help: 'OptStr' = None, name: 'OptStr' = None, default: 'OptStr' = None, required: 'OptStr' = None, metavar: 'OptStr' = None, hide: 'OptStr' = None, action: 'OptStr' = None, type: 'OptStr' = None, nargs: 'OptStr' = None, choices: 'OptStr' = None, name_mode: 'OptStr' = None)[source]

Bases: ParamArgs

name_mode: OptStr = None
classmethod init_option(arg: ParserArg, action: OptStr = None, nargs: OptStr = None, const: OptStr = None, **kwargs)[source]
class cli_command_parser.conversion.command_builder.FlagArgs(help: 'OptStr' = None, name: 'OptStr' = None, default: 'OptStr' = None, required: 'OptStr' = None, metavar: 'OptStr' = None, hide: 'OptStr' = None, action: 'OptStr' = None, type: 'OptStr' = None, nargs: 'OptStr' = None, choices: 'OptStr' = None, name_mode: 'OptStr' = None, const: 'OptStr' = None)[source]

Bases: OptionArgs

const: OptStr = None
classmethod init_flag(action: str, const: OptStr = None, default: OptStr = None, **kwargs)[source]
classmethod init_counter(const: OptStr = None, default: OptStr = None, **kwargs)[source]
cli_command_parser.conversion.command_builder.literal_eval_or_none(expr: str) str | None[source]
exception cli_command_parser.conversion.command_builder.ConversionError[source]

Bases: Exception