Open
Conversation
dwr-zroy
requested changes
Jul 31, 2025
Contributor
dwr-zroy
left a comment
There was a problem hiding this comment.
Looks close.
Another small note, this is a pretty unhelpful commit message. Without additional context, it doesn't describe what changes were made.
utils/query_data.py
Outdated
Comment on lines
14
to
24
| # Load variable definitions from yaml file once and keep in memory | ||
| @lru_cache(maxsize=1) | ||
| def load_var_dict(): | ||
| with open("constants/dvars.yaml", "r") as file: | ||
| return yaml.safe_load(file) | ||
|
|
||
| # Load state variable definitions from yaml file once and keep in memory | ||
| @lru_cache(maxsize=1) | ||
| def load_svar_dict(): | ||
| with open("constants/svars.yaml", "r") as file: | ||
| return yaml.safe_load(file) |
Contributor
There was a problem hiding this comment.
These are still separate functions.
Contributor
Author
|
Regarding the two functions, load_var_dict() and load_svar_dict(), I've made some changes. You pointed out that they practically do the same thing, which is just loading YAML files and caching them, so I created a single, reusable function: load_yaml(). |
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.
I went through the comments of the previous pull request and cleaned up the code/comments. There is a single function for load_date_map and load_df_dv_orig called cache_read_csv. This serves as a general purpose cached csv reader. Went through the other functions and made sure they were utilizing this new function instead of the older methods. Hopefully everything looks good!