personality_questionnaire.core.recent_databases¶
Remembering which databases an operator has recently used.
A lab operator plausibly switches between a few SQLite files across sessions – per-study databases, or a shared-drive copy versus a local scratch copy – so the Setup tab’s database picker offers a short most-recently-used list alongside browsing. The list is a convenience, not a correctness requirement: a write failure here is logged and swallowed rather than blocking a database switch.
Attributes¶
How many recent database URLs to keep. |
Functions¶
|
Return where the most-recently-used database list is stored. |
|
Return remembered database URLs, most-recently-used first. |
|
Move |
Module Contents¶
- personality_questionnaire.core.recent_databases.MAX_ENTRIES = 8¶
How many recent database URLs to keep.
- personality_questionnaire.core.recent_databases.recent_databases_path() pathlib.Path[source]¶
Return where the most-recently-used database list is stored.
Sits beside the default database file, under the same
$PQ_HOME(or~/.personality_questionnaire) directory used elsewhere in this package.- Returns:
The path to the MRU JSON file.
- personality_questionnaire.core.recent_databases.load_recent(path: pathlib.Path | None = None) list[str][source]¶
Return remembered database URLs, most-recently-used first.
- Parameters:
path – The MRU file to read. Defaults to
recent_databases_path().- Returns:
The remembered URLs, or an empty list if the file is missing, unreadable, or not valid JSON – a corrupt MRU file is a non-event, not an error.
- personality_questionnaire.core.recent_databases.remember_database(url: str, path: pathlib.Path | None = None) list[str][source]¶
Move
urlto the front of the recent list, capped and de-duplicated.- Parameters:
url – The database URL just switched to.
path – The MRU file to update. Defaults to
recent_databases_path().
- Returns:
The updated list, most-recently-used first.