-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config Update #841
Closed
Closed
Config Update #841
Conversation
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
there is no more need to manually toggle the changed state of the config make .loads private removed the return value from .save, it was False in every case deprecate .force_taint(), keep it for backwards compatibility
ignore the state of the variable delay to cancel the delayed task in every case. performing an undelayed dump might have lead to duplicate dumps.
no doing so might break dumping the config permanent
performace: - do not check the the backup twice, ._loads will fail if it is also corrupt - skip reading the config twice (on copy and on load) do not use .format in logging
otherwise raise the exception save the config after creating it
.set_by_path and .pop_by_path will not work on the defaults dict data add a flag to .set_by_path to create the given path automatically
the recent version of .get_by_path returned None if the path did exist to position -1 in the keys_list. But this is not a valid check for a not existing path, as None is an allowed value for entrys in the config.
(or just stay below 81 char a line :D)
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Config Class can now store defaults in background that do not need to be stored bulk in the users
config.json
..get_by_path
,.get_option
,.get_suboption
and direct accessing will query defaults onKeyError
/ValueErrors
..set_by_path
and.pop_by_path
will still access the realconfig.json
data.With the arg
fallback
in.get_by_path
and also in.exists
, one can toggle the fallback to defaults.Other changes:
the check for a change in the config is now on live data,
.force_taint()
is no more needed. f1a5ae5create the path the user wants to store a value in, this can be toggled in
.set_by_path
with the argumentcreate_path
.use the configured default, in some cases just
None
was returned and overall the default was hardcoded toNone
, even though an argument on init existed. d2715fcpropper check for an existing path,
None
as value resulted in an non existing pathpropper Exception handling, especially
IOError
killing the config bbb006a(plugins can) validate their config parts with
.validate
30eaa9euse
asyncio
to schedule a delayed dump 81eacc3