Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenworsley committed Feb 11, 2024
1 parent 8e45ceb commit 730eb38
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/iris/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,16 +350,16 @@ class IrisSaverFillValueWarning(IrisMaskValueMatchWarning, IrisSaveWarning):


@lru_cache(None)
def warn_once(msg, type, stacklevel, frame):
def warn_once(msg, type, stacklevel, frame, **kwargs):
"""Raise a warning only if a similar one has not been raised before."""
warnings.warn(msg, type, stacklevel=stacklevel)
warnings.warn(msg, type, stacklevel=stacklevel, **kwargs)


def warn_once_at_level(msg, type=None, stacklevel=0):
def warn_once_at_level(msg, type=None, stacklevel=0, **kwargs):
"""
Raise a warning only if a similar one hasn't been raised from the same line
for a given stack level.
"""
stacklevel += 1
frame = traceback.format_stack()[-stacklevel]
warn_once(msg, type, stacklevel + 1, frame)
warn_once(msg, type, stacklevel + 1, frame, **kwargs)

0 comments on commit 730eb38

Please sign in to comment.