mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-20 12:40:31 +08:00
Work around limitation in warnings.warn
This commit is contained in:
@@ -7,10 +7,11 @@ import re
|
||||
__all__ = ['all_warnings', 'expected_warnings', 'warn']
|
||||
|
||||
|
||||
def warn(message, category=None, stacklevel=2):
|
||||
def warn(message, **kwargs):
|
||||
"""A version of `warnings.warn` with a default stacklevel of 2.
|
||||
"""
|
||||
warnings.warn(message, category=category, stacklevel=stacklevel)
|
||||
kwargs.setdefault('stacklevel', 2)
|
||||
warnings.warn(message, **kwargs)
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
||||
Reference in New Issue
Block a user