Skip to content
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

Add writer style option to SettingsWriter pt1 #924

Merged
merged 17 commits into from
Oct 5, 2022

Conversation

opotowsky
Copy link
Member

@opotowsky opotowsky commented Oct 5, 2022

NOTE: the updates to the original PR on this topic requested by @keckler will be in a follow-up PR, namely making this argument available to clone / writeInputs.

Description

As described in Issue #897, we would like a third option that preserves the original settings file even if a setting defined in it is a default value. Currently, short removes all settings that have the default value, and full prints out every possible setting to the file.

To accomplish that, I added a medium style option to SettingsWriter (which involved editing the handling of the strings of "acceptable" styles to constant strings as well as a helper function in the caseSettings module called getSettingSetByUser so the full list of user defined settings can be tracked.).

I made the settingsWriteStyle flag available to the modify EntryPoint, so one can alter the writing style from the command line.

The testing was a little difficult. writeToYamlFile method and SettingsWriter class aren't explicitly tested. I have the 3 writing style options tested, the new method (getSettingsSetByUser) in caseSettings.py is tested, and a sad attempt at adding this to the modify CLI testing.


Checklist

  • This PR has only one purpose or idea.
  • Tests have been added/updated to verify that the new/changed code works.
  • The release notes (location doc/release/0.X.rst) are up-to-date with any bug fixes or new features.
  • The documentation is still up-to-date in the doc folder.
  • The dependencies are still up-to-date in setup.py.

@opotowsky opotowsky linked an issue Oct 5, 2022 that may be closed by this pull request
@opotowsky opotowsky added the enhancement New feature or request label Oct 5, 2022
Copy link
Member

@keckler keckler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful. I love it. Only a few very piddly comments.

armi/settings/caseSettings.py Outdated Show resolved Hide resolved
armi/settings/caseSettings.py Outdated Show resolved Hide resolved
armi/settings/caseSettings.py Outdated Show resolved Hide resolved
armi/settings/caseSettings.py Show resolved Hide resolved
armi/settings/caseSettings.py Outdated Show resolved Hide resolved
armi/settings/settingsIO.py Outdated Show resolved Hide resolved
Copy link
Member

@john-science john-science left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love the test coverage!

@john-science john-science merged commit 8ea8beb into terrapower:main Oct 5, 2022
@john-science john-science deleted the add_writer_style_pt1 branch October 5, 2022 20:23
scottyak pushed a commit to scottyak/armi that referenced this pull request Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add third style option to SettingsWriter
4 participants