10000 Some pep8 fixes. · matplotlib/matplotlib@e15203a · GitHub
[go: up one dir, main page]

Skip to content

Commit e15203a

Browse files
committed
Some pep8 fixes.
1 parent ea42661 commit e15203a

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
@@ -232,8 +232,8 @@ def to_rgba_array(c, alpha=None):
232232
# Special-case inputs that are already arrays, for performance. (If the
233233
# array has the wrong kind or shape, raise the error during one-at-a-time
234234
# conversion.)
235-
if (isinstance(c, np.ndarray) and c.dtype.kind in "if"
236-
and c.ndim == 2 and c.shape[1] in [3, 4]):
235+
if (isinstance(c, np.ndarray) and c.dtype.kind in "if" and
236+
c.ndim == 2 and c.shape[1] in [3, 4]):
237237
if c.shape[1] == 3:
238238
result = np.column_stack([c, np.zeros(len(c))])
239239
result[:, -1] = alpha if alpha is not None else 1.
@@ -799,7 +799,7 @@ def join(self, other, name=None, frac_self=None, N=None):
799799
if name is None:
800800
name = '{}+{}'.format(self.name, other.name)
801801
assert 0 < frac_self and frac_self < 1, (
802-
"The parameter ``frac_self`` must be in the interval ``(0.0, 1.0)``."
802+
"The parameter frac_self must be in the interval (0.0, 1.0)."
803803
)
804804
map0 = self(np.linspace(0, 1, int(N * frac_self)))
805805
map1 = other(np.linspace(0, 1, int(N * (1 - frac_self))))
@@ -840,11 +840,11 @@ def truncate(self, minval=0.0, maxval=1.0, N=None):
840840
cmap_trunc = cmap.truncate(0.2, 0.7)
841841
842842
"""
843-
assert minval < maxval, "``minval`` must be less than ``maxval``"
843+
assert minval < maxval, "minval must be less than maxval"
844844
assert 0 <= minval and minval < 1, (
845-
"The parameter ``minval`` must be in the interval ``(0.0, 1.0)``.")
845+
"The parameter minval must be in the interval (0.0, 1.0).")
846846
assert 0 < maxval and maxval <= 1, (
847-
"The parameter ``maxval`` must be in the interval ``(0.0, 1.0)``.")
847+
"The parameter maxval must be in the interval (0.0, 1.0).")
848848
assert minval != 0 or maxval != 1, (
849849
"This is not a truncation.")
850850
# This was taken largely from
@@ -854,7 +854,11 @@ def truncate(self, minval=0.0, maxval=1.0, N=None):
854854
if N is None:
855855
N = np.ceil(self.N * (maxval - minval))
856856
name = "trunc({},{:.2f},{:.2f})".format(self.name, minval, maxval)
857-
return LinearSegmentedColormap.from_list(name, self(np.linspace(minval, maxval, N)), N)
857+
return LinearSegmentedColormap.from_list(name,
858+
self(np.linspace(minval,
859+
maxval,
860+
N)),
861+
N)
858862

859863

860864
class ListedColormap(Colormap):
@@ -982,7 +986,7 @@ def join(self, other, name=None, frac_self=None, N=None):
982986
if name is None:
983987
name = '{}+{}'.format(self.name, other.name)
984988
assert 0 < frac_self and frac_self < 1, (
985-
"The parameter ``frac_self`` must be in the interval ``(0.0, 1.0)``."
989+
"The parameter frac_self must be in the interval (0.0, 1.0)."
986990
)
987991
map0 = self(np.linspace(0, 1, int(N * frac_self)))
988992
map1 = other(np.linspace(0, 1, int(N * (1 - frac_self))))
@@ -1023,11 +1027,11 @@ def truncate(self, minval=0.0, maxval=1.0, N=None):
10231027
cmap_trunc = cmap.truncate(0.2, 0.7)
10241028
10251029
"""
1026-
assert minval < maxval, "``minval`` must be less than ``maxval``"
1030+
assert minval < maxval, "minval must be less than maxval"
10271031
assert 0 <= minval and minval < 1, (
1028-
"The parameter ``minval`` must be in the interval ``(0.0, 1.0)``.")
1032+
"The parameter minval must be in the interval (0.0, 1.0).")
10291033
assert 0 < maxval and maxval <= 1, (
1030-
"The parameter ``maxval`` must be in the interval ``(0.0, 1.0)``.")
1034+
"The parameter maxval must be in the interval (0.0, 1.0).")
10311035
assert minval != 0 or maxval != 1, (
10321036
"This is not a truncation.")
10331037
# This was taken largely from

0 commit comments

Comments
 (0)
0