Skip to content

Commit 615ca22

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

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

lib/matplotlib/colors.py

Lines changed: 15 additions & 11 deletions
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

0 commit comments

Comments
 (0)