-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #607 from bghira/feature/config-file-versioning
config file versioning to allow updating defaults without breaking backwards compat
- Loading branch information
Showing
4 changed files
with
58 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
CURRENT_VERSION = 2 | ||
|
||
LATEST_DEFAULTS = {1: {"hash_filenames": False}, 2: {"hash_filenames": True}} | ||
|
||
|
||
def default(setting: str, current_version: int = None, default_value=None): | ||
if current_version <= 0 or current_version is None: | ||
current_version = CURRENT_VERSION | ||
if current_version in LATEST_DEFAULTS: | ||
return LATEST_DEFAULTS[current_version].get(setting, default_value) | ||
return default_value | ||
|
||
|
||
def latest_config_version(): | ||
return CURRENT_VERSION |