Utils Module

Utilities for working with terminals, strings, and Enums.

author:

Doug Skrypa

cli_command_parser.utils.camel_to_snake_case(text: str, delim: str = '_') str[source]
cli_command_parser.utils.short_repr(obj: ~typing.Any, max_len: int = 100, sep: str = '...', func: ~typing.Callable[[~typing.Any], str] = <built-in function repr>) str[source]
class cli_command_parser.utils.MissingMixin[source]

Bases: object

class cli_command_parser.utils.FixedFlagMeta(*args, **kwargs)[source]

Bases: EnumType

This metaclass is only used to maintain the same behavior for Flag pseudo-members between 3.7-3.10 and 3.11 when the behavior was parameterized via the boundary parameter.

class cli_command_parser.utils.FixedFlag(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Flag

Extends Flag to work around breaking changes in 3.11 for repr, missing, and pseudo-members.

class cli_command_parser.utils.Terminal(cache_time: float = 1)[source]

Bases: object

property width: int[source]
cli_command_parser.utils.str_to_bool(value: str) bool[source]
cli_command_parser.utils.positive_int(value: Any, expected: str = 'a positive integer', min_val: int = 0) int[source]
async cli_command_parser.utils.maybe_await(obj: T | Awaitable[T]) T[source]