rtm_wrapper.util#
Misc utilities.
Module Contents#
Functions#
|
Configure the root logger with a basic debugging configuration. |
|
Partition the given dictionary based on the provided predicate. |
|
Return the version of this distribution with local build number, if available. |
|
Return a platform summary string. |
|
Return the first element of the iterable, or the given default if the iterable |
|
Return a trap callable that raises when called. |
- exception TrapCalledError(message: str, args: tuple[Any, Ellipsis], kwargs: dict[str, Any])[source]#
Bases:
RuntimeErrorRaised when a trap callable is invoked.
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
message (str) –
args (tuple[Any, Ellipsis]) –
kwargs (dict[str, Any]) –
- setup_debug_root_logging(level: int = logging.NOTSET) None[source]#
Configure the root logger with a basic debugging configuration.
All records at the given level or above will be written to stdout.
This function should be called once near the start of an application entry point, BEFORE any calls to
logging.getLoggerare made.Disables any existing loggers.
- Parameters:
level (int) –
- Return type:
None
- partition_dict(dictionary: dict[_H, _T], predicate: Callable[[_H], bool]) tuple[dict[_H, _T], dict[_H, _T]][source]#
Partition the given dictionary based on the provided predicate.
>>> d = {i: i**2 for i in range(6)} >>> partition_dict(d, lambda x: x % 2 == 0) ({0: 0, 2: 4, 4: 16}, {1: 1, 3: 9, 5: 25})
- Parameters:
dictionary (dict[_H, _T]) –
predicate (Callable[[_H], bool]) –
- Return type:
tuple[dict[_H, _T], dict[_H, _T]]
- build_version() str[source]#
Return the version of this distribution with local build number, if available.
- Return type:
str