-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fix create compsets heron function 2 #19
Merged
GabrielSoto-INL
merged 5 commits into
idaholab:main
from
caleb-sitton-inl:fix-create-compsets-heron-function-2
Jun 26, 2024
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ed4b282
Fixed cashflow updating bug
caleb-sitton-inl df2b97e
Regolded output file for integration test
caleb-sitton-inl 706f15f
Added checks for componentSet files in heron.py
caleb-sitton-inl 72cb3e2
Regolded FullTest integration test output
caleb-sitton-inl ce43d53
Addressing comments
caleb-sitton-inl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,9 +56,12 @@ def create_componentsets_in_HERON(comp_sets_folder, heron_input_xml): | |
|
||
# Goin through the FORCE componentSets to extract relevant info | ||
for textfile in comp_set_files_list: | ||
if textfile.startswith('componentSet'): | ||
if textfile.startswith('componentSet') and (textfile.endswith('.json') or textfile.endswith('.txt')): | ||
textfile_path = comp_sets_folder+"/"+textfile | ||
comp_set_dict = json.load(open(textfile_path)) | ||
try: | ||
comp_set_dict = json.load(open(textfile_path)) | ||
except json.JSONDecodeError as e: | ||
raise ValueError(f"The content of {textfile_path} is not in proper JSON format and cannot be read") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is good, you may want to add a |
||
comp_set_name = comp_set_dict.get('Component Set Name') | ||
|
||
ref_driver = comp_set_dict.get('Reference Driver') | ||
|
@@ -90,10 +93,13 @@ def create_componentsets_in_HERON(comp_sets_folder, heron_input_xml): | |
node.append(ET.Comment(f" Some of this component economic info are imported from: {textfile_path}")) | ||
print("The 'cashflow' subnode is found too and is updated") | ||
Cashflow_NODE_FOUND = "True" | ||
elements_to_update = [] | ||
for subsubnode in subnode: | ||
if subsubnode.tag in ['reference_driver', 'reference_price', 'scaling_factor_x']: | ||
subnode.remove(subsubnode) | ||
elements_to_update.append(subsubnode) | ||
print(f"WARNING: The value of the {subsubnode.tag} is updated.") | ||
for element in elements_to_update: | ||
subnode.remove(element) | ||
new_cash_node = subnode | ||
new_cash_node.append(ET.Comment(f" Some of this component cashFlow info are imported from: {textfile_path}")) | ||
|
||
|
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be better to open the file using a
with
statement as mentioned here: https://pylint.readthedocs.io/en/latest/user_guide/messages/refactor/consider-using-with.html