diff --git a/omegaconf/omegaconf.py b/omegaconf/omegaconf.py index 4f204e86d..0edbbe986 100644 --- a/omegaconf/omegaconf.py +++ b/omegaconf/omegaconf.py @@ -797,16 +797,17 @@ def missing_keys(cfg: Union[Container, Any]) -> Set[str]: """ if not isinstance(cfg, Container): try: - cfg = OmegaConf.create(cfg) # type: ignore + cfg = OmegaConf.create(cfg) except ValidationError: - raise ValueError(f'Could not create a config out of {cfg}') + raise ValueError(f"Could not create a config out of {cfg}") + cfg: Container missings = set() def gather(_cfg: Container, prefix: str = "") -> None: if isinstance(_cfg, ListConfig): - itr = range(len(_cfg)) + itr = range(len(_cfg)) # type: ignore else: - itr = _cfg + itr = _cfg # type: ignore for key in itr: if OmegaConf.is_missing(_cfg, key): diff --git a/tests/test_omegaconf.py b/tests/test_omegaconf.py index 1b2159e93..11effb244 100644 --- a/tests/test_omegaconf.py +++ b/tests/test_omegaconf.py @@ -640,6 +640,6 @@ def test_missing_keys(cfg: Any, expected: Any) -> None: "cfg", [float, int] ) -def test_missing_keys_invalid_input(cfg): - with raises(ValueError) as exc: - OmegaConf.missing_keys(cfg) # type: ignore +def test_missing_keys_invalid_input(cfg: Any) -> None: + with raises(ValueError): + OmegaConf.missing_keys(cfg)