From 741d6fda95e7c1c94f7ff06a7428603805c971d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Wed, 2 Oct 2013 17:44:05 +0200 Subject: [PATCH] PEP8: comparison --- skimage/io/video.py | 2 +- skimage/morphology/greyreconstruct.py | 2 +- skimage/morphology/watershed.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/skimage/io/video.py b/skimage/io/video.py index 6cb1a8e9..003a1f53 100644 --- a/skimage/io/video.py +++ b/skimage/io/video.py @@ -256,7 +256,7 @@ class Video(object): Backend to use. """ def __init__(self, source=None, size=None, sync=False, backend=None): - if backend == None: + if backend is None: # select backend that is available if gstreamer_available: self.video = GstVideo(source, size, sync) diff --git a/skimage/morphology/greyreconstruct.py b/skimage/morphology/greyreconstruct.py index 17455b55..3fffd28e 100644 --- a/skimage/morphology/greyreconstruct.py +++ b/skimage/morphology/greyreconstruct.py @@ -133,7 +133,7 @@ def reconstruction(seed, mask, method='dilation', selem=None, offset=None): else: selem = selem.copy() - if offset == None: + if offset is None: if not all([d % 2 == 1 for d in selem.shape]): ValueError("Footprint dimensions must all be odd") offset = np.array([d // 2 for d in selem.shape]) diff --git a/skimage/morphology/watershed.py b/skimage/morphology/watershed.py index fbd63281..097e3129 100644 --- a/skimage/morphology/watershed.py +++ b/skimage/morphology/watershed.py @@ -124,13 +124,13 @@ def watershed(image, markers, connectivity=None, offset=None, mask=None): separate overlapping spheres. """ - if connectivity == None: + if connectivity is None: c_connectivity = scipy.ndimage.generate_binary_structure(image.ndim, 1) else: c_connectivity = np.array(connectivity, bool) if c_connectivity.ndim != image.ndim: raise ValueError("Connectivity dimension must be same as image") - if offset == None: + if offset is None: if any([x % 2 == 0 for x in c_connectivity.shape]): raise ValueError("Connectivity array must have an unambiguous " "center") @@ -162,7 +162,7 @@ def watershed(image, markers, connectivity=None, offset=None, mask=None): "as image (ndim=%d)" % (c_markers.ndim, c_image.ndim)) if c_markers.shape != c_image.shape: raise ValueError("image and markers must have the same shape") - if mask != None: + if mask is not None: c_mask = np.ascontiguousarray(mask, dtype=bool) if c_mask.ndim != c_markers.ndim: raise ValueError("mask must have same # of dimensions as image") @@ -398,7 +398,7 @@ def _slow_watershed(image, markers, connectivity=8, mask=None): continue if labels[x, y]: continue - if mask != None and not mask[x, y]: + if mask is not None and not mask[x, y]: continue # label the pixel labels[x, y] = pix_label