-
Notifications
You must be signed in to change notification settings - Fork 107
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
541 oc.select #687
541 oc.select #687
Conversation
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.
Behavior looks good, just a few small things
omegaconf/resolvers/oc/__init__.py
Outdated
def select( | ||
key: str, | ||
default: Any = _DEFAULT_SELECT_MARKER_, | ||
*, | ||
_parent_: Container, | ||
) -> Any: | ||
from omegaconf._impl import select_value | ||
|
||
if default is _DEFAULT_SELECT_MARKER_: | ||
return select_value(cfg=_parent_, key=key, absolute_key=True) | ||
else: | ||
return select_value(cfg=_parent_, key=key, absolute_key=True, default=default) |
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.
Why use a different marker?
def select( | |
key: str, | |
default: Any = _DEFAULT_SELECT_MARKER_, | |
*, | |
_parent_: Container, | |
) -> Any: | |
from omegaconf._impl import select_value | |
if default is _DEFAULT_SELECT_MARKER_: | |
return select_value(cfg=_parent_, key=key, absolute_key=True) | |
else: | |
return select_value(cfg=_parent_, key=key, absolute_key=True, default=default) | |
def select( | |
key: str, | |
default: Any = _DEFAULT_MARKER_, | |
*, | |
_parent_: Container, | |
) -> Any: | |
from omegaconf._impl import select_value | |
return select_value(cfg=_parent_, key=key, absolute_key=True, default=default) |
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.
good point. Initially I was passing it into select_value.
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 it can be simplified further (see my suggestion: no more if
)
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.
yeah, for some reason I thought using the same marker object select_value is using would cause issues.
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.
Looks good :)
Just one grammar nit-pick beyond Olivier's suggestions:
Closes #541