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
Deprecate OmegaConf.is_optional #700
Deprecate OmegaConf.is_optional #700
Changes from 4 commits
3290348
3c8279b
42ddb2d
3f2fe49
0b43f8d
beca3b7
7bef172
a9b1555
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.
I am not sure there is a good reason behind defaulting to True.
If there isn't any, I think you can maintain the old deprecated implementation here for now and make a more strict internal _is_optional.
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.
I think that the defaulting to True is for the case where
_is_optional(obj, key)
is called andkey
cannot be found.Currently, no code in the
omegaconf/
directory is using this "defaulting to True" branch, as all the calls use the one-argument signature_is_optional(obj)
(though some code in thetests/
directory does use the two-argument signature).Instead of returning
True
in the case wherekey
cannot be found, what do you think about raisingConfigKeyError
?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.
Since it's an internal function and the branch is not used now, I suggest using assertion to ensure that it's not tripping anyone.
If we ever need to do something if the key does not exist we can easily change this.
Make a pass on the usage to convince yourself it's not current;y possible for a user to hit this branch though.
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.
Yup, it's not possible for a user to hit.