bpod_core.misc.SettingsDict
- class bpod_core.misc.SettingsDict
Bases:
MutableMappingA dictionary-like persistent settings storage backed by a JSON file.
This class implements the MutableMapping interface, storing key-value pairs that are automatically persisted to a JSON file on every write. It supports standard dictionary operations (get, set, delete, iterate) as well as nested key access.
File access is protected by a file lock for safe concurrent access from multiple processes.
- __init__(json_path) None
Initialize the SettingsDict instance.
- Parameters:
json_path (
PathLikeorstr) – Path to the JSON configuration file.- Return type:
None
- get_nested(keys, default=None) Any
Retrieve a nested value using a sequence of keys.
- Parameters:
keys (
Sequence) – A sequence of keys representing the nested path.default (
Any, optional) – The value to return if the path does not exist. Defaults to None.
- Returns:
The value at the nested path, or default if any key in the path is missing.
- Return type:
Any