Remove is_str and replace by isinstance(..., six.string_types).

This commit is contained in:
Stefan van der Walt
2013-06-29 10:16:42 -05:00
parent 70d21f23a2
commit 9a38a59a25
2 changed files with 3 additions and 14 deletions
+1 -12
View File
@@ -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):
+2 -2
View File
@@ -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)