diff options
author | Daniel Hahler <git@thequod.de> | 2018-11-13 08:17:16 +0100 |
---|---|---|
committer | Waylan Limberg <waylan.limberg@icloud.com> | 2018-11-14 13:25:20 -0500 |
commit | 0c7924e38e96278b25eacbecc30c2ab3a2478138 (patch) | |
tree | 7dd20ae0681f3df897be70f6930d8891de5b9863 | |
parent | daf9e6dddf73a629c540b0beb4cb09209780e86e (diff) | |
download | python-markdown-0c7924e38e96278b25eacbecc30c2ab3a2478138.tar.gz |
add: use stacklevel=2 with warning
-rw-r--r-- | markdown/util.py | 12 |
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, ) |