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.
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
Parse jediyaml only once #2387
Parse jediyaml only once #2387
Changes from 5 commits
c740e56
a2a9a2c
d371fca
24146ff
430cc08
ae81057
f7a1303
9617d65
8be840a
03fc903
b54b525
ef89d91
7b4d7e7
3387dd2
e9f78e8
e2c9a51
fb53150
d303281
1161b77
40847bf
f473ee9
154e792
06b69bd
4120f51
c22686e
55fc774
c0c8573
8218ee7
320730c
f1e0149
c163a4f
250b5e9
816944e
78aafef
2d81620
3420ed3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
this is nice!
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.
As written, this is going to have strange (possible inconsistent) behavior for keys that appear multiple times. If the top-most dict contains the target key, that will be the value returned. Otherwise, it will iterate through keys looking for the target key, but dicts should not be considered naturally ordered (even though the current implementation of python preserves ordering), so if the target key is contained in multiple nested dicts (but not the top one), the value retrieved could change from execution to execution.
Even without the undetermined ordering issue, the retrieved value won't necessarily be the shallowest (unless it is in the top-level dict) or the deepest matching key.
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.
This is true, and thus, I don't think we can move it to a generic module.
Think of giving someone just a house number to find and leaving them at the edge of town.
Which specific house they find will depend on the choices they make; left, or right.
Same is with this search. This will return the first key the search encounters.
Perhaps we should remove this method and instead look for
observations
undercost function
. If it finds it, then thats it. If not, it should look forobservations
at the top-level.Those are the use cases for now.
If we run into problems, we can revisit this and implement a
find_observations
method targeted for this rather than a genericfind_key_in_nested_dict
.