From 59e22fe83acddaae318b4044c1dab9e79033882e Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Tue, 13 Aug 2024 12:55:52 -0700 Subject: [PATCH] add stacklevel to soft deprecation warnings --- src/nwbinspector/inspector_tools/__init__.py | 2 +- src/nwbinspector/nwbinspector/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nwbinspector/inspector_tools/__init__.py b/src/nwbinspector/inspector_tools/__init__.py index 6fa9d0933..f4df3ee28 100644 --- a/src/nwbinspector/inspector_tools/__init__.py +++ b/src/nwbinspector/inspector_tools/__init__.py @@ -5,7 +5,7 @@ "Please import the helper functions from the top-level package." ) -warnings.warn(message=message, category=DeprecationWarning) +warnings.warn(message=message, category=DeprecationWarning, stacklevel=2) # Still keep imports functional with warning for soft deprecation cycle # TODO: remove after 9/15/2024 diff --git a/src/nwbinspector/nwbinspector/__init__.py b/src/nwbinspector/nwbinspector/__init__.py index db27f589c..5a5552154 100644 --- a/src/nwbinspector/nwbinspector/__init__.py +++ b/src/nwbinspector/nwbinspector/__init__.py @@ -2,7 +2,7 @@ message = "The 'inspector_tools' submodule has been deprecated. Please import the helper functions from the top-level package." -warnings.warn(message=message, category=DeprecationWarning) +warnings.warn(message=message, category=DeprecationWarning, stacklevel=2) # Still keep imports functional with warning for soft deprecation cycle # TODO: remove after 9/15/2024