bpod_core.misc

Miscellaneous tools that don’t fit the other categories.

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

ByteEnum

An IntEnum restricted to single-byte values (0–255).

SettingsDict

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

SuggestionDict

A dictionary that suggests similar keys on failed lookup.

ValidatedDict

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

Attributes

bpod_core.misc.K = ~K

Key type variable for generic mappings such as ValidatedDict.

bpod_core.misc.V = ~V

Value type variable for generic mappings such as ValidatedDict.