Open MatteoVoges opened 10 months ago
@odelalleau with this I get:
from omegaconf import OmegaConf
config = OmegaConf.create({"a": {"b": 1}})
OmegaConf.set_readonly(config.a, True)
OmegaConf.set_readonly_recursively(config, False)
print(OmegaConf.is_readonly(config.a))
# >>> False
Thanks! I would suggest to do it a bit differently to have a more generic implementation:
recursive
boolean argument to _set_flag()
set_struct()
and set_readonly()
(instead of adding a different function specific to readonly)Thanks for the update -- overall looks good to me, but I won't have time to look at it in details until next week. We'll need to add a news fragment as well and update the documentation.
@omry @odelalleau this is a blocker for #1102, would be great to get it in
Motivation
I want a function that sets a value for a flag (atm
readonly
, but can be extended for all / generic flags) recursively.Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
Tests will be added if the basic structure is confirmed.
Fixes
Fixes #1123