summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2018-11-13 08:17:16 +0100
committerWaylan Limberg <waylan.limberg@icloud.com>2018-11-14 13:25:20 -0500
commit0c7924e38e96278b25eacbecc30c2ab3a2478138 (patch)
tree7dd20ae0681f3df897be70f6930d8891de5b9863
parentdaf9e6dddf73a629c540b0beb4cb09209780e86e (diff)
downloadpython-markdown-0c7924e38e96278b25eacbecc30c2ab3a2478138.tar.gz
add: use stacklevel=2 with warning
-rw-r--r--markdown/util.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/markdown/util.py b/markdown/util.py
index fc56ba2..371c4e0 100644
--- a/markdown/util.py
+++ b/markdown/util.py
@@ -423,7 +423,9 @@ class Registry(object):
if isinstance(key, string_type):
warnings.warn(
'Using setitem to register a processor or pattern is deprecated. '
- 'Use the `register` method instead.', DeprecationWarning
+ 'Use the `register` method instead.',
+ DeprecationWarning,
+ stacklevel=2,
)
if key in self:
# Key already exists, replace without altering priority
@@ -445,7 +447,9 @@ class Registry(object):
self.deregister(key)
warnings.warn(
'Using del to remove a processor or pattern is deprecated. '
- 'Use the `deregister` method instead.', DeprecationWarning
+ 'Use the `deregister` method instead.',
+ DeprecationWarning,
+ stacklevel=2,
)
else:
raise TypeError
@@ -488,5 +492,7 @@ class Registry(object):
self.register(value, key, priority)
warnings.warn(
'Using the add method to register a processor or pattern is deprecated. '
- 'Use the `register` method instead.', DeprecationWarning
+ 'Use the `register` method instead.',
+ DeprecationWarning,
+ stacklevel=2,
)