File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 8
8
warnings .warn (
9
9
'The `TEMController` module is deprecated since version 2.0.6. Use the `controller`-module instead' ,
10
10
VisibleDeprecationWarning ,
11
+ stacklevel = 2 ,
11
12
)
12
13
13
14
Original file line number Diff line number Diff line change 2
2
3
3
from __future__ import annotations
4
4
5
+
5
6
class VisibleDeprecationWarning (UserWarning ):
6
- """
7
- Numpy-inspired deprecation warning which will be shown by default.
7
+ """Numpy-inspired deprecation warning which will be shown by default.
8
+
8
9
The default `DeprecationWarning` does not show by default.
9
10
"""
10
11
12
+
11
13
def deprecated (since : str , alternative : str , removed : str = None ):
12
14
"""Mark a function as deprecated, printing a warning whenever it is used.
13
15
@@ -34,7 +36,7 @@ def wrapped(*args, **kwargs):
34
36
msg = f'Function { func .__name__ } is deprecated since { since } , use { alternative } instead.'
35
37
if removed is not None :
36
38
msg += f' Will be removed in version { removed } .'
37
- warnings .warn (msg , VisibleDeprecationWarning )
39
+ warnings .warn (msg , VisibleDeprecationWarning , stacklevel = 2 )
38
40
return func (* args , ** kwargs )
39
41
40
42
return wrapped
You can’t perform that action at this time.
0 commit comments