-
Notifications
You must be signed in to change notification settings - Fork 98
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
handle SCMode.INSTANTIATE with throw_on_missing=False #1104
base: master
Are you sure you want to change the base?
Conversation
@@ -378,7 +378,8 @@ | |||
def get_dataclass_data( | |||
obj: Any, allow_objects: Optional[bool] = None | |||
) -> Dict[str, Any]: | |||
from omegaconf.omegaconf import MISSING, OmegaConf, _maybe_wrap | |||
from omegaconf import MISSING, OmegaConf | |||
from omegaconf.omegaconf import _maybe_wrap |
Check notice
Code scanning / CodeQL
Cyclic import Note
omegaconf.omegaconf
@@ -38,7 +38,7 @@ | |||
is_structured_config_frozen, | |||
type_str, | |||
) | |||
from .base import Box, Container, ContainerMetadata, DictKeyType, Node | |||
from .base import MISSING, Box, Container, ContainerMetadata, DictKeyType, Node |
Check notice
Code scanning / CodeQL
Cyclic import Note
omegaconf.base
), | ||
) | ||
else: | ||
v = MISSING |
Check warning
Code scanning / CodeQL
Variable defined multiple times Warning
redefined
This assignment to 'v' is unnecessary as it is
redefined
Looks good overall and I agree that it's a better behavior. |
This PR enables
OmegaConf.to_container(..., throw_on_missing=False)
to work for structured configs whenstructured_config_mode=SCMode.INSTANTIATE
. Closes #1103.In addition, this PR moves
MISSING
fromomegaconf.py
intobase.py
to avoid a circular import issue.Here is an example of the behavior enabled by this PR:
BEFORE:
AFTER: