Skip to content

Commit c70c1b5

Browse files
committed
Some pep8 fixes.
1 parent 079a0d9 commit c70c1b5

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

lib/matplotlib/colors.py

+17-13
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ def to_rgba_array(c, alpha=None):
211211
# Special-case inputs that are already arrays, for performance. (If the
212212
# array has the wrong kind or shape, raise the error during one-at-a-time
213213
# conversion.)
214-
if (isinstance(c, np.ndarray) and c.dtype.kind in "if"
215-
and c.ndim == 2 and c.shape[1] in [3, 4]):
214+
if (isinstance(c, np.ndarray) and c.dtype.kind in "if" and
215+
c.ndim == 2 and c.shape[1] in [3, 4]):
216216
if c.shape[1] == 3:
217217
result = np.column_stack([c, np.zeros(len(c))])
218218
result[:, -1] = alpha if alpha is not None else 1.
@@ -778,7 +778,7 @@ def join(self, other, name=None, frac_self=None, N=None):
778778
if name is None:
779779
name = '{}+{}'.format(self.name, other.name)
780780
assert 0 < frac_self and frac_self < 1, (
781-
"The parameter ``frac_self`` must be in the interval ``(0.0, 1.0)``."
781+
"The parameter frac_self must be in the interval (0.0, 1.0)."
782782
)
783783
map0 = self(np.linspace(0, 1, int(N * frac_self)))
784784
map1 = other(np.linspace(0, 1, int(N * (1 - frac_self))))
@@ -819,11 +819,11 @@ def truncate(self, minval=0.0, maxval=1.0, N=None):
819819
cmap_trunc = cmap.truncate(0.2, 0.7)
820820
821821
"""
822-
assert minval < maxval, "``minval`` must be less than ``maxval``"
822+
assert minval < maxval, "minval must be less than maxval"
823823
assert 0 <= minval and minval < 1, (
824-
"The parameter ``minval`` must be in the interval ``(0.0, 1.0)``.")
824+
"The parameter minval must be in the interval (0.0, 1.0).")
825825
assert 0 < maxval and maxval <= 1, (
826-
"The parameter ``maxval`` must be in the interval ``(0.0, 1.0)``.")
826+
"The parameter maxval must be in the interval (0.0, 1.0).")
827827
assert minval != 0 or maxval != 1, (
828828
"This is not a truncation.")
829829
# This was taken largely from
@@ -833,7 +833,11 @@ def truncate(self, minval=0.0, maxval=1.0, N=None):
833833
if N is None:
834834
N = np.ceil(self.N * (maxval - minval))
835835
name = "trunc({},{:.2f},{:.2f})".format(self.name, minval, maxval)
836-
return LinearSegmentedColormap.from_list(name, self(np.linspace(minval, maxval, N)), N)
836+
return LinearSegmentedColormap.from_list(name,
837+
self(np.linspace(minval,
838+
maxval,
839+
N)),
840+
N)
837841

838842

839843
class ListedColormap(Colormap):
@@ -964,7 +968,7 @@ def join(self, other, name=None, frac_self=None, N=None):
964968
if name is None:
965969
name = '{}+{}'.format(self.name, other.name)
966970
assert 0 < frac_self and frac_self < 1, (
967-
"The parameter ``frac_self`` must be in the interval ``(0.0, 1.0)``."
971+
"The parameter frac_self must be in the interval (0.0, 1.0)."
968972
)
969973
map0 = self(np.linspace(0, 1, int(N * frac_self)))
970974
map1 = other(np.linspace(0, 1, int(N * (1 - frac_self))))
@@ -1005,11 +1009,11 @@ def truncate(self, minval=0.0, maxval=1.0, N=None):
10051009
cmap_trunc = cmap.truncate(0.2, 0.7)
10061010
10071011
"""
1008-
assert minval < maxval, "``minval`` must be less than ``maxval``"
1012+
assert minval < maxval, "minval must be less than maxval"
10091013
assert 0 <= minval and minval < 1, (
1010-
"The parameter ``minval`` must be in the interval ``(0.0, 1.0)``.")
1014+
"The parameter minval must be in the interval (0.0, 1.0).")
10111015
assert 0 < maxval and maxval <= 1, (
1012-
"The parameter ``maxval`` must be in the interval ``(0.0, 1.0)``.")
1016+
"The parameter maxval must be in the interval (0.0, 1.0).")
10131017
assert minval != 0 or maxval != 1, (
10141018
"This is not a truncation.")
10151019
# This was taken largely from
@@ -1244,7 +1248,7 @@ def __init__(self, linthresh, linscale=1.0,
12441248
"""
12451249
Normalize.__init__(self, vmin, vmax, clip)
12461250
self.linthresh = float(linthresh)
1247-
self._linscale_adj = (linscale / (1.0 - np.e ** -1))
1251+
self._linscale_adj= (linscale / (1.0 - np.e ** -1))
12481252
if vmin is not None and vmax is not None:
12491253
self._transform_vmin_vmax()
12501254

@@ -1280,7 +1284,7 @@ def _transform(self, a):
12801284
"""
12811285
masked = np.abs(a) > self.linthresh
12821286
sign = np.sign(a[masked])
1283-
log = (self._linscale_adj + np.log(np.abs(a[masked]) / self.linthresh))
1287+
log = (self._linscale_adj+ np.log(np.abs(a[masked]) / self.linthresh))
12841288
log *= sign * self.linthresh
12851289
a[masked] = log
12861290
a[~masked] *= self._linscale_adj

0 commit comments

Comments
 (0)