From 1444737514c3e8c6acbe3fc01f9420c8e078d3a0 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Tue, 17 Aug 2021 08:33:51 -0700 Subject: [PATCH] Set stacklevel on warning to point to the right place. (#572) Without stacklevel=2, the warnings are a bit useless as we don't know where the deprecated function is used. --- jupyter_server/transutils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyter_server/transutils.py b/jupyter_server/transutils.py index 3812a30351..8363693abf 100644 --- a/jupyter_server/transutils.py +++ b/jupyter_server/transutils.py @@ -10,7 +10,7 @@ def _trans_gettext_deprecation_helper(*args, **kwargs): warn_msg = "The alias `_()` will be deprecated. Use `_i18n()` instead." - warnings.warn(warn_msg, FutureWarning) + warnings.warn(warn_msg, FutureWarning, stacklevel=2) return trans.gettext(*args, **kwargs)