Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature: throw_on_missing keyword argument for OmegaConf.to_container #501

Closed
Jasha10 opened this issue Jan 30, 2021 · 2 comments · Fixed by #730
Closed

Feature: throw_on_missing keyword argument for OmegaConf.to_container #501

Jasha10 opened this issue Jan 30, 2021 · 2 comments · Fixed by #730
Assignees
Labels
enhancement New feature or request

Comments

@Jasha10
Copy link
Collaborator

Jasha10 commented Jan 30, 2021

Feature:

Currently, calling OmegaConf.to_container(cfg) can result in a python object that contains some "???" MISSING strings.

I propose to add a throw_on_missing keyword argument to OmegaConf.to_container, so that the structure returned by OmegaConf.to_container(cfg, throw_on_missing=True) will raise omegaconf.MissingMandatoryValue if any missing values are encountered.

This way, if no MissingMandatorValue is raised, clients can be assured that the result of to_container does not contain any "???" strings.

To maintain backward compatibility, the default would be throw_on_missing=False.

@Jasha10
Copy link
Collaborator Author

Jasha10 commented Jan 30, 2021

I am working on a PR to implement this.

@omry
Copy link
Owner

omry commented Jan 31, 2021

Wouldn't resolve=True actually do what you want?

EDIT: nope, it does not.
Will take a look at your PR later, thanks.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants