bpod_core.misc

Miscellaneous tools that don’t fit the other categories.

Module Attributes

RE_NON_ALPHANUMERIC

Match non-alphanumeric characters except underscores.

RE_ACRONYM

Match acronym boundaries.

RE_CASE_TRANSITION

Match case and digit transitions.

RE_MULTIPLE_UNDERSCORES

Match multiple consecutive underscores.

Functions

extend_packed

Extend a bytearray with packed binary values.

get_local_ipv4

Determine the primary local IPv4 address of the machine.

get_nested

Retrieve a value from a nested dict using a Sequence of keys.

prune_empty_parent_directories

Remove empty parent directories recursively up to root directory.

set_nested

Set a value in a nested dict, creating intermediate dicts as needed.

suggest_similar

Suggest a similar valid string based on the given invalid string.

to_snake_case

Convert a given string to snake_case.

Classes

DocstringInheritanceMixin

Mixin that automatically inherits docstrings from parent classes.

SettingsDict

A dictionary-like persistent settings storage backed by a JSON file.

ValidatedDict

A dict-like container with runtime validation for keys and values.