mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-19 11:27:45 +08:00
Remove is_str and replace by isinstance(..., six.string_types).
This commit is contained in:
@@ -2,18 +2,7 @@ import warnings
|
||||
import functools
|
||||
|
||||
|
||||
__all__ = ['deprecated', 'is_str']
|
||||
|
||||
|
||||
try:
|
||||
isinstance("", basestring)
|
||||
def is_str(s):
|
||||
"""Return True if `s` is a string. Safe for Python 2 and 3."""
|
||||
return isinstance(s, basestring)
|
||||
except NameError:
|
||||
def is_str(s):
|
||||
"""Return True if `s` is a string. Safe for Python 2 and 3."""
|
||||
return isinstance(s, str)
|
||||
__all__ = ['deprecated']
|
||||
|
||||
|
||||
class deprecated(object):
|
||||
|
||||
@@ -4,7 +4,7 @@ import itertools
|
||||
import numpy as np
|
||||
|
||||
from skimage import img_as_float
|
||||
from skimage._shared.utils import is_str
|
||||
from skimage._shared import six
|
||||
from .colorconv import rgb2gray, gray2rgb
|
||||
from . import rgb_colors
|
||||
|
||||
@@ -30,7 +30,7 @@ def _rgb_vector(color):
|
||||
color : str or array
|
||||
Color name in `color_dict` or RGB float values between [0, 1].
|
||||
"""
|
||||
if is_str(color):
|
||||
if isinstance(color, six.string_types):
|
||||
color = color_dict[color]
|
||||
# slice to handle RGBA colors
|
||||
return np.array(color[:3]).reshape(1, 3)
|
||||
|
||||
Reference in New Issue
Block a user