Skip to content

Commit

Permalink
fix(model): Fix display of warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuestengecko committed Nov 18, 2022
1 parent 7f9746a commit 7b7dad9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion capellambse/model/common/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,9 @@ def __init__(
"""
if not tag:
warnings.warn(
"Unspecified XML tag is deprecated", DeprecationWarning
"Unspecified XML tag is deprecated",
DeprecationWarning,
stacklevel=2,
)
elif not isinstance(tag, str):
raise TypeError(f"tag must be a str, not {type(tag).__name__}")
Expand Down
6 changes: 4 additions & 2 deletions capellambse/model/common/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ def new_hash(self) -> int:

# <https://github.com/DSD-DBS/py-capellambse/issues/52>
warnings.warn(
"Hashing of this type is broken and will likely be removed in the future."
f" Consider using the `.uuid` or `.{attr}` directly instead.",
"Hashing of this type is broken and will likely be removed in"
f" the future. Please use the `.uuid` or `.{attr}` directly"
" instead.",
category=FutureWarning,
stacklevel=2,
)

return orig_hash(self)
Expand Down

0 comments on commit 7b7dad9

Please sign in to comment.