Move logic for reading JSON parameter revisions to Parameter class #2312
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.
This pull request simplifies the process of specifying and reading JSON reform files by moving the logic for reading JSON parameter revisions from the
Calculator
class to theParameter
class, which is a more sensible place for it. The simplification in specifying JSON policy reform files is that the top-level "policy" key is no longer mandatory. Also, when reading just a JSON policy reform file, the reading of it has been made easier by the addition of thePolicy.read_json_reform
method.So, before this pull request a JSON reform file had to be specified this way:
but now it can be simplified to this:
Assume that the above JSON (either version) is in a file whose name is contained in the
json
string variable.Before this pull request that JSON reform file had to be used this way:
but now it is easier:
Note that the old specification of JSON reform files still works and the old way of reading a JSON reform file is still available. It is just that now there are easier ways to do these things than by using the legacy code.