From 779ff38ca6b585acb05bb59f8c2a74fac710358f Mon Sep 17 00:00:00 2001 From: Fabio Muratore Date: Thu, 5 Jan 2023 11:01:03 +0100 Subject: [PATCH 1/2] Forward flags when loading to creation --- omegaconf/omegaconf.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/omegaconf/omegaconf.py b/omegaconf/omegaconf.py index efde14a4e..768b61e4c 100644 --- a/omegaconf/omegaconf.py +++ b/omegaconf/omegaconf.py @@ -182,7 +182,10 @@ def create( # noqa F811 ) @staticmethod - def load(file_: Union[str, pathlib.Path, IO[Any]]) -> Union[DictConfig, ListConfig]: + def load( + file_: Union[str, pathlib.Path, IO[Any]], + flags: Optional[Dict[str, bool]] = None + ) -> Union[DictConfig, ListConfig]: from ._utils import get_yaml_loader if isinstance(file_, (str, pathlib.Path)): @@ -200,9 +203,9 @@ def load(file_: Union[str, pathlib.Path, IO[Any]]) -> Union[DictConfig, ListConf ret: Union[DictConfig, ListConfig] if obj is None: - ret = OmegaConf.create() + ret = OmegaConf.create(flags=flags) else: - ret = OmegaConf.create(obj) + ret = OmegaConf.create(obj, flags=flags) return ret @staticmethod From d2cf29538c7eff56db9e2f265e53e3c2123c211e Mon Sep 17 00:00:00 2001 From: Fabio Muratore Date: Thu, 5 Jan 2023 14:25:13 +0100 Subject: [PATCH 2/2] Fixed format --- omegaconf/omegaconf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omegaconf/omegaconf.py b/omegaconf/omegaconf.py index 768b61e4c..9a674c023 100644 --- a/omegaconf/omegaconf.py +++ b/omegaconf/omegaconf.py @@ -184,7 +184,7 @@ def create( # noqa F811 @staticmethod def load( file_: Union[str, pathlib.Path, IO[Any]], - flags: Optional[Dict[str, bool]] = None + flags: Optional[Dict[str, bool]] = None, ) -> Union[DictConfig, ListConfig]: from ._utils import get_yaml_loader