From a1b7d17b8712dda1dc4b6d8a465ae5aac0796cd7 Mon Sep 17 00:00:00 2001 From: Kai Fricke Date: Mon, 13 Feb 2023 11:09:27 -0800 Subject: [PATCH] [tune] Structure refactor: Raise on import of old modules Signed-off-by: Kai Fricke --- python/ray/tune/_structure_refactor.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/python/ray/tune/_structure_refactor.py b/python/ray/tune/_structure_refactor.py index 451d2003f5ac..60a9fd331bc5 100644 --- a/python/ray/tune/_structure_refactor.py +++ b/python/ray/tune/_structure_refactor.py @@ -1,5 +1,3 @@ -import warnings - from ray.util import log_once @@ -8,7 +6,7 @@ def warn_structure_refactor(old_module: str, new_module: str, direct: bool = Tru if log_once(f"tune:structure:refactor:{old_module}"): warning = ( f"The module `{old_module}` has been moved to `{new_module}` and the old " - f"location will be deprecated soon. Please adjust your imports to point " + f"location has been deprecated. Please adjust your imports to point " f"to the new location." ) @@ -24,6 +22,4 @@ def warn_structure_refactor(old_module: str, new_module: str, direct: bool = Tru f"check the contents of `{new_module}` before making changes." ) - with warnings.catch_warnings(): - warnings.simplefilter("always") - warnings.warn(warning, DeprecationWarning, stacklevel=3) + raise DeprecationWarning(warning)