Forward flags when loading to creation #1051
Draft
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.
What?
This is a minimal PR providing the possibibility to pass the same flags to
OmegaConf.load()
that can be used when callingOmegaConf.create()
.Why?
I created a custom resolver that allows setting tuples as config values.
It worked perfectly when testing it like this
OmegaConf.create("tup: ${as_tuple:1,2,3}")
.However, it failed when loading the config file
since I am calling
OmegaConf.resolve()
afterOmegaConf.load()
(for a good reason that is out of scope here).The error was
I could resolve that error by altering the
allow_objects
flagDespite the disclaimers in the comments about the flags API, I think it would be nice to be able to directly set them when creating a config from a file the same way we can do it when creating it programmatically.
What do you think? Did I miss anything?
How?
Please see the code. The change is straightforward.