Refactor the management of the configuration file#2349
Merged
sphuber merged 1 commit intoDec 14, 2018
Merged
Conversation
The configuration file is now abstracted by the `Config` class. Loading the configuration through `aiida.manage.load_config` will now return a `Config` instance which internally keep the contents of the configuration file of the AiiDA instace. Altering the config will go through this object. All configuration related code, such as settings and methods to setup the configuration folder for a new AiiDA instance, are organized in the `aiida.manage.configuration` module.
8083674 to
ecdf231
Compare
1 similar comment
muhrin
approved these changes
Dec 14, 2018
| try: | ||
| return simplejson.load(fhandle, encoding='utf8', **kwargs) | ||
| except simplejson.errors.JSONDecodeError: | ||
| raise IOError |
| self.validate_profile(name) | ||
| return Profile(name, self.dictionary[self.KEY_PROFILES][name]) | ||
|
|
||
| def add_profile(self, name, profile, store=True): |
Contributor
There was a problem hiding this comment.
Style preference: I would rather these functions didn't have a store parameter and instead just returned self and then the user could do config.add_profile(...).store()
This file contains hidden or 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
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.
Fixes #2348
The configuration file is now abstracted by the
Configclass.Loading the configuration through
aiida.manage.load_configwillnow return a
Configinstance which internally keep the contentsof the configuration file of the AiiDA instace. Altering the config
will go through this object.
All configuration related code, such as settings and methods to setup
the configuration folder for a new AiiDA instance, are organized
in the
aiida.manage.configurationmodule.