We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5a15d1b commit 8499dccCopy full SHA for 8499dcc
telegram/utils/deprecate.py
@@ -21,8 +21,18 @@
21
import warnings
22
23
24
-def warn_deprecate_obj(old, new):
25
- warnings.warn('{0} is being deprecated, please use {1} from now on'.format(old, new))
+# We use our own DeprecationWarning since they are muted by default and "UserWarning" makes it
+# seem like it's the user that issued the warning
26
+# We name it something else so that you don't get confused when you attempt to suppress it
27
+class TelegramDeprecationWarning(Warning):
28
+ pass
29
+
30
31
+def warn_deprecate_obj(old, new, stacklevel=3):
32
+ warnings.warn(
33
+ '{0} is being deprecated, please use {1} from now on.'.format(old, new),
34
+ category=TelegramDeprecationWarning,
35
+ stacklevel=stacklevel)
36
37
38
def deprecate(func, old, new):
0 commit comments