Skip to content

Commit

Permalink
Fix pylint and py27 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aleju committed Nov 1, 2019
1 parent d965fe2 commit 016d8b5
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions imgaug/augmenters/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -1553,11 +1553,11 @@ def __init__(self, mul=(0.0, 3.0), from_colorspace="RGB", name=None,

class RemoveSaturation(MultiplySaturation):
"""Decrease the saturation of images by varying degrees.
This creates images looking similar to :class:`Grayscale`.
This augmenter is the same as ``MultiplySaturation((0.0, 1.0))``.
Parameters
----------
mul : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional
Expand All @@ -1573,7 +1573,7 @@ class RemoveSaturation(MultiplySaturation):
per image.
* If a StochasticParameter, then a value will be sampled from that
parameter per image.
from_colorspace : str, optional
See :func:`imgaug.augmenters.color.change_colorspace_`.
Expand All @@ -1593,7 +1593,7 @@ class RemoveSaturation(MultiplySaturation):
>>> image = ia.quokka() # uint8 (H, W, 3) RGB array
>>> aug = iaa.RemoveSaturation()
>>> image_grayish = aug(image=image)
Create and apply an augmenter that decreases saturation by varying degrees.
>>> aug = iaa.RemoveSaturation(1.0)
Expand Down Expand Up @@ -2403,7 +2403,7 @@ class GrayscaleColorwise(meta.Augmenter):
1. Split the hue in ``HSV`` into ``nb_bins`` bins.
2. Shift the bins by ``offset`` degrees. (This way, the ``0th`` bin does
not always start at exactly ```` of hue.)
not always start at exactly ``0deg`` of hue.)
3. Sample ``alpha`` values for each bin.
4. Smoothen the alpha values of neighbouring bins using a gaussian
kernel. The kernel's ``sigma`` is derived from ``smoothness``.
Expand Down Expand Up @@ -2465,7 +2465,7 @@ class GrayscaleColorwise(meta.Augmenter):
Rotiational shift of each bin as a fraction of ``360`` degrees.
E.g. ``0.0`` will not shift any bins, while a value of ``0.5`` will
shift by around ``180`` degrees. This shift is mainly used so that
the ``0th`` bin does not always start at ````. Expected value
the ``0th`` bin does not always start at ``0deg``. Expected value
range is ``[0.0, 1.0]``. This parameter can usually kept at the default
value.
Expand Down Expand Up @@ -2527,6 +2527,7 @@ def __init__(self, nb_bins=(5, 15), smoothness=(0.1, 0.3),
alpha=[0.0, 1.0], offset=(0.0, 1.0),
from_colorspace=CSPACE_RGB,
name=None, deterministic=False, random_state=None):
# pylint: disable=dangerous-default-value
super(GrayscaleColorwise, self).__init__(
name=name, deterministic=deterministic, random_state=random_state)

Expand Down Expand Up @@ -2728,6 +2729,7 @@ def __init__(self, nb_bins=(5, 15), smoothness=(0.1, 0.3),
alpha=[0.0, 1.0], offset=(0.0, 1.0),
from_colorspace=CSPACE_RGB,
name=None, deterministic=False, random_state=None):
# pylint: disable=dangerous-default-value
super(RemoveSaturationColorwise, self).__init__(
nb_bins=nb_bins, smoothness=smoothness,
alpha=alpha, offset=offset,
Expand All @@ -2748,8 +2750,8 @@ def _apply_grayscale_some_colors_batch_(cls, images, nb_bins, smoothness,
from_colorspaces=from_colorspace)

nth_bin = 0
gen = enumerate(zip(images_hsv, nb_bins, smoothness, offset))
for i, (img_hsv, nb_bins_i, smoothness_i, offset_i) in gen:
gen = zip(images_hsv, nb_bins, smoothness, offset)
for img_hsv, nb_bins_i, smoothness_i, offset_i in gen:
# skip images with zero-sized axes as these cause issues
# in the used cv2 functions
if 0 in img_hsv.shape[0:2]:
Expand Down

0 comments on commit 016d8b5

Please sign in to comment.