This commit is contained in:
Steven Silvester
2016-01-30 15:56:19 -06:00
parent 4f54b9ed5a
commit 4b2692b7c0
4 changed files with 12 additions and 8 deletions
+3 -1
View File
@@ -158,7 +158,9 @@ else:
if sys.version.startswith('2.6'):
warnings.warn("Python 2.6 is deprecated and will not be supported in scikit-image 0.13+", stacklevel=2)
msg = ("Python 2.6 is deprecated and will not be supported in"
"scikit-image 0.13+")
warnings.warn(msg, stacklevel=2)
del warnings, functools, osp, imp, sys
+5 -3
View File
@@ -7,11 +7,13 @@ import re
__all__ = ['all_warnings', 'expected_warnings', 'warn']
def warn(message, **kwargs):
def warn(message, category=None, stacklevel=2):
"""A version of `warnings.warn` with a default stacklevel of 2.
"""
kwargs.setdefault('stacklevel', 2)
warnings.warn(message, **kwargs)
if category is not None:
warnings.warn(message, category=category, stacklevel=stacklevel)
else:
warnings.warn(message, stacklevel=stacklevel)
@contextmanager
+3 -3
View File
@@ -4,7 +4,7 @@
#cython: wraparound=False
import numpy as np
import warnings
from .._shared.utils import warn
cimport numpy as cnp
@@ -47,9 +47,9 @@ ctypedef struct bginfo:
cdef void get_bginfo(background_val, bginfo *ret) except *:
if background_val is None:
warnings.warn(DeprecationWarning(
warn(DeprecationWarning(
'The default value for `background` will change to 0 in v0.12'
), stacklevel=2)
))
ret.background_val = -1
else:
ret.background_val = background_val
+1 -1
View File
@@ -8,7 +8,7 @@ from matplotlib.colors import LinearSegmentedColormap
if has_qt and 'agg' not in mpl.get_backend().lower():
warn("Recommended matplotlib backend is `Agg` for full "
"skimage.viewer functionality.")
"skimage.viewer functionality.")
__all__ = ['init_qtapp', 'start_qtapp', 'RequiredAttr', 'figimage',