bpod_core.misc.SettingsDict
- class bpod_core.misc.SettingsDict
Bases:
MutableMapping
Represents a dictionary-like persistent settings storage.
This class is a mutable mapping implementation that stores and retrieves key-value pairs, persisting them to a JSON configuration file. The settings are associated with a specific application name and, optionally, an application author to organize the file path appropriately. You can use this class to manage configuration data that needs to be saved and reused across sessions. Changes to the dictionary are automatically saved to the file.
This class supports standard dictionary operations such as getting, setting, deleting items, checking for the existence of keys, and iterating over keys. Additionally, it provides functionality for accessing nested values using a sequence of keys.
- __init__(app_name, app_author=None, filename='settings.json') None
Initialize the SettingsDict instance.
- get_nested(keys, default=None) Any
Retrieve a nested value using a sequence of keys.
- Parameters:
keys (
Sequence
) – An 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