Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent warning repeats #5506

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
limit cache size, fix tests
  • Loading branch information
stephenworsley committed Feb 12, 2024
commit f501454281b6a4c9f0fd01af4bde2b44d6c4ddd4
2 changes: 1 addition & 1 deletion lib/iris/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ class IrisSaverFillValueWarning(IrisMaskValueMatchWarning, IrisSaveWarning):
pass


@lru_cache(None)
@lru_cache(128)
def warn_once(msg, stacklevel, frame, **kwargs):
"""Raise a warning only if a similar one has not been raised before."""
warnings.warn(msg, stacklevel=stacklevel, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/fileformats/_nc_load_rules/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ def _get_ellipsoid(cf_grid_var):
"applied. To apply the datum when loading, use the "
"iris.FUTURE.datum_support flag."
)
iris.exceptions.warn_once_at_level(wmsg, FutureWarning, category=FutureWarning, stacklevel=14)
iris.exceptions.warn_once_at_level(wmsg, category=FutureWarning, stacklevel=14)
datum = None

if datum is not None:
Expand Down
Loading