Ensure a valid (but empty) config dict
This commit is contained in:
parent
f7018e892d
commit
87da9b9673
1 changed files with 6 additions and 1 deletions
|
@ -50,6 +50,11 @@ _SCHEMA = Schema(
|
|||
}
|
||||
)
|
||||
|
||||
_EMPTY_DICT = {
|
||||
_Key.TOKEN: "",
|
||||
_Key.VERSION: _VERSION
|
||||
}
|
||||
|
||||
|
||||
def _migrate_to_v1(d: dict):
|
||||
# Owners moved to History in v1
|
||||
|
@ -116,7 +121,7 @@ def _load_from_file(file: str = _FILE) -> _Config:
|
|||
Load the state from a file
|
||||
Apply any required migrations
|
||||
"""
|
||||
loaded = {}
|
||||
loaded = _EMPTY_DICT
|
||||
if os.path.isfile(file):
|
||||
loaded = files.load(file)
|
||||
_migrate(loaded)
|
||||
|
|
Loading…
Add table
Reference in a new issue