Utils Module

cli_command_parser.conversion.utils.get_name_repr(node: AST | expr) str[source]
cli_command_parser.conversion.utils.iter_module_parents(module: str) Iterator[str][source]

Given a nested module name, yields parent package names in ascending order.

I.e., given foo.bar.baz, this function will yield foo.bar and then foo.

cli_command_parser.conversion.utils.collection_contents(node: AST) list[str][source]

Returns a list of individually unparsed (original source code strings) elements that would be processed when iterating over the specified node.

Silently ignores any dictionaries that were expanded within a dict literal.

Parameters:

node – An AST node representing a dict/list/set/tuple literal.

Returns:

List of elements as strings of source code.