Skip to content

Commit

Permalink
use stacklevel=2 for deprecation warnings, so the source/line number …
Browse files Browse the repository at this point in the history
…of the user code is indicated
  • Loading branch information
wimglenn committed Sep 30, 2021
1 parent 8b9bbc4 commit d2297fe
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/cachetools/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
from . import Cache

warnings.warn(
"cachetools.cache is deprecated, please use cachetools.Cache", DeprecationWarning
"cachetools.cache is deprecated, please use cachetools.Cache",
DeprecationWarning,
stacklevel=2,
)
4 changes: 3 additions & 1 deletion src/cachetools/fifo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
from . import FIFOCache

warnings.warn(
"cachetools.fifo is deprecated, please use cachetools.FIFOCache", DeprecationWarning
"cachetools.fifo is deprecated, please use cachetools.FIFOCache",
DeprecationWarning,
stacklevel=2,
)
4 changes: 3 additions & 1 deletion src/cachetools/lfu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
from . import LFUCache

warnings.warn(
"cachetools.lfu is deprecated, please use cachetools.LFUCache", DeprecationWarning
"cachetools.lfu is deprecated, please use cachetools.LFUCache",
DeprecationWarning,
stacklevel=2,
)
4 changes: 3 additions & 1 deletion src/cachetools/lru.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
from . import LRUCache

warnings.warn(
"cachetools.lru is deprecated, please use cachetools.LRUCache", DeprecationWarning
"cachetools.lru is deprecated, please use cachetools.LRUCache",
DeprecationWarning,
stacklevel=2,
)
4 changes: 3 additions & 1 deletion src/cachetools/mru.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
from . import MRUCache

warnings.warn(
"cachetools.mru is deprecated, please use cachetools.MRUCache", DeprecationWarning
"cachetools.mru is deprecated, please use cachetools.MRUCache",
DeprecationWarning,
stacklevel=2,
)
4 changes: 3 additions & 1 deletion src/cachetools/rr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
from . import RRCache

warnings.warn(
"cachetools.rr is deprecated, please use cachetools.RRCache", DeprecationWarning
"cachetools.rr is deprecated, please use cachetools.RRCache",
DeprecationWarning,
stacklevel=2,
)
4 changes: 3 additions & 1 deletion src/cachetools/ttl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
from . import TTLCache

warnings.warn(
"cachetools.ttl is deprecated, please use cachetools.TTLCache", DeprecationWarning
"cachetools.ttl is deprecated, please use cachetools.TTLCache",
DeprecationWarning,
stacklevel=2,
)

0 comments on commit d2297fe

Please sign in to comment.