diff --git a/news/547.api_change b/news/547.api_change new file mode 100644 index 000000000..00ded5ee8 --- /dev/null +++ b/news/547.api_change @@ -0,0 +1 @@ +Removed support for `OmegaConf.is_none(cfg, "key")`. Please use `cfg.key is None` instead. diff --git a/omegaconf/omegaconf.py b/omegaconf/omegaconf.py index d23b2b15b..126108931 100644 --- a/omegaconf/omegaconf.py +++ b/omegaconf/omegaconf.py @@ -627,20 +627,6 @@ def is_optional(obj: Any, key: Optional[Union[int, str]] = None) -> bool: else: return True - # DEPRECATED: remove in 2.2 - @staticmethod - def is_none(obj: Any, key: Optional[Union[int, DictKeyType]] = None) -> bool: - warnings.warn( - "`OmegaConf.is_none()` is deprecated, see https://github.com/omry/omegaconf/issues/547", - stacklevel=2, - ) - - if key is not None: - assert isinstance(obj, Container) - obj = obj._get_node(key) - - return _is_none(obj, resolve=True, throw_on_resolution_failure=False) - @staticmethod def is_interpolation(node: Any, key: Optional[Union[int, str]] = None) -> bool: if key is not None: diff --git a/tests/test_matrix.py b/tests/test_matrix.py index 5a2600bc0..c003950c2 100644 --- a/tests/test_matrix.py +++ b/tests/test_matrix.py @@ -49,8 +49,6 @@ def verify( assert cfg.get(key) == exp assert OmegaConf.is_missing(cfg, key) == missing - with warns(UserWarning): - assert OmegaConf.is_none(cfg, key) == none_public assert _is_optional(cfg, key) == opt assert OmegaConf.is_interpolation(cfg, key) == inter diff --git a/tests/test_omegaconf.py b/tests/test_omegaconf.py index 4a3517eea..2e37edc81 100644 --- a/tests/test_omegaconf.py +++ b/tests/test_omegaconf.py @@ -301,20 +301,12 @@ def test_is_none(fac: Any, is_none: bool) -> None: ) def test_is_none_interpolation(cfg: Any, key: str, is_none: bool) -> None: cfg = OmegaConf.create(cfg) - with warns(UserWarning): - assert OmegaConf.is_none(cfg, key) == is_none check = _is_none( cfg._get_node(key), resolve=True, throw_on_resolution_failure=False ) assert check == is_none -def test_is_none_invalid_node() -> None: - cfg = OmegaConf.create({}) - with warns(UserWarning): - assert OmegaConf.is_none(cfg, "invalid") - - @mark.parametrize( "fac", [