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 730eb38 commit a503041
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, **kwargs):
def warn_once(msg, stacklevel, frame, **kwargs):
"""Raise a warning only if a similar one has not been raised before."""
warnings.warn(msg, type, stacklevel=stacklevel, **kwargs)
warnings.warn(msg, stacklevel=stacklevel, **kwargs)


def warn_once_at_level(msg, type=None, stacklevel=0, **kwargs):
def warn_once_at_level(msg, 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, **kwargs)
warn_once(msg, stacklevel + 1, frame, **kwargs)

0 comments on commit a503041

Please sign in to comment.