-
Notifications
You must be signed in to change notification settings - Fork 131
Closed
Milestone
Description
OmegaConf.update() behavior when the input value was a list or a dictionary was to assign the value instead of to merge it:
cfg = OmegaConf.create({"a": {"b": 10}})
OmegaConf.update(cfg, "a", {"c": 20}})
# cfg is now {"a": {"c": 20}}
The intended behavior for update lines up better with a merge:
OmegaConf.update(cfg, "a", {"c": 20}})
# cfg is now {"a": {"b": 10, "c": 20}}
To support both use cases, a new merge
flag is introduced to update:
def update(
cfg: Container, key: str, value: Any = None, merge: Optional[bool] = None
) -> None:
- None: issue a warning, default to False to maintain compatibility.
- True : Merge config
- False: Assign config
The default value for merge will become True in a future version.
To avoid unexpected behavior changes, please call update with merge=[True|False]
.
Metadata
Metadata
Assignees
Labels
No labels