Skip to content

Commit

Permalink
Merge pull request #10 from cdce8p/main
Browse files Browse the repository at this point in the history
Set stacklevel=2 for DeprecationWarning
  • Loading branch information
lextm authored Nov 6, 2024
2 parents 8b0cbc9 + cf2a94c commit 1431e90
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pysmi/reader/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def __getattr__(attr: str):
"""Handle deprecated attributes."""
if newAttr := deprecated_attributes.get(attr):
warnings.warn(
f"{attr} is deprecated. Please use {newAttr} instead.", DeprecationWarning
f"{attr} is deprecated. Please use {newAttr} instead.",
DeprecationWarning,
stacklevel=2,
)
return globals()[newAttr]
raise AttributeError(f"module {__name__} has no attribute {attr}")

0 comments on commit 1431e90

Please sign in to comment.