Skip to content

Commit

Permalink
missing annotations, syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Ohad committed Jun 4, 2021
1 parent 7f8cd74 commit 49b9d46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions omegaconf/omegaconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_omegaconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 49b9d46

Please sign in to comment.