mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-29 19:17:14 +08:00
Replace old raise form
This commit is contained in:
@@ -95,9 +95,9 @@ def convert_colorspace(arr, fromspace, tospace):
|
||||
fromspace = fromspace.upper()
|
||||
tospace = tospace.upper()
|
||||
if not fromspace in fromdict.keys():
|
||||
raise ValueError, 'fromspace needs to be one of %s'%fromdict.keys()
|
||||
raise ValueError('fromspace needs to be one of %s'%fromdict.keys())
|
||||
if not tospace in todict.keys():
|
||||
raise ValueError, 'tospace needs to be one of %s'%todict.keys()
|
||||
raise ValueError('tospace needs to be one of %s'%todict.keys())
|
||||
|
||||
return todict[tospace](fromdict[fromspace](arr))
|
||||
|
||||
@@ -108,7 +108,7 @@ def _prepare_colorarray(arr, dtype=np.float32):
|
||||
|
||||
if arr.ndim != 3 or arr.shape[2] != 3:
|
||||
msg = "the input array must be have a shape == (.,.,3))"
|
||||
raise ValueError, msg
|
||||
raise ValueError(msg)
|
||||
|
||||
return arr.astype(dtype)
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ class MultiImage(object):
|
||||
if -numframes <= n < numframes:
|
||||
n = n % numframes
|
||||
else:
|
||||
raise IndexError, "There are only %s frames in the image"%numframes
|
||||
raise IndexError("There are only %s frames in the image"%numframes)
|
||||
|
||||
if self.conserve_memory:
|
||||
if not self._cached == n:
|
||||
@@ -289,7 +289,7 @@ class ImageCollection(object):
|
||||
if -num <= n < num:
|
||||
n = n % num
|
||||
else:
|
||||
raise IndexError, "There are only %s images in the collection"%num
|
||||
raise IndexError("There are only %s images in the collection"%num)
|
||||
return n
|
||||
|
||||
def __iter__(self):
|
||||
|
||||
Reference in New Issue
Block a user