mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-28 11:25:42 +08:00
Cleanup
This commit is contained in:
+3
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user