Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f61459

Browse files
committed
Small cleanups.
1 parent 1652ed1 commit 0f61459

4 files changed

Lines changed: 14 additions & 18 deletions

File tree

lib/matplotlib/colorbar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,8 +855,7 @@ def _get_extension_lengths(self, frac, automin, automax, default=0.05):
855855
if isinstance(frac, str):
856856
if frac.lower() == 'auto':
857857
# Use the provided values when 'auto' is required.
858-
extendlength[0] = automin
859-
extendlength[1] = automax
858+
extendlength[:] = [automin, automax]
860859
else:
861860
# Any other string is invalid.
862861
raise ValueError('invalid value for extendfrac')

lib/matplotlib/lines.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,8 @@ def __init__(self, xdata, ydata,
354354
if isinstance(linestyle, six.string_types):
355355
ds, ls = self._split_drawstyle_linestyle(linestyle)
356356
if ds is not None and drawstyle is not None and ds != drawstyle:
357-
raise ValueError("Inconsistent drawstyle ({0!r}) and "
358-
"linestyle ({1!r})".format(drawstyle,
359-
linestyle)
360-
)
357+
raise ValueError("Inconsistent drawstyle ({!r}) and linestyle "
358+
"({!r})".format(drawstyle, linestyle))
361359
linestyle = ls
362360

363361
if ds is not None:
@@ -1088,10 +1086,9 @@ def set_linestyle(self, ls):
10881086
try:
10891087
ls = ls_mapper_r[ls]
10901088
except KeyError:
1091-
raise ValueError(("You passed in an invalid linestyle, "
1092-
"`{0}`. See "
1093-
"docs of Line2D.set_linestyle for "
1094-
"valid values.").format(ls))
1089+
raise ValueError("Invalid linestyle {!r}; see docs of "
1090+
"Line2D.set_linestyle for valid values"
1091+
.format(ls))
10951092
self._linestyle = ls
10961093
else:
10971094
self._linestyle = '--'

lib/matplotlib/markers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ def set_marker(self, marker):
249249
Path(marker)
250250
self._marker_function = self._set_vertices
251251
except ValueError:
252-
raise ValueError('Unrecognized marker style'
253-
' {0}'.format(marker))
252+
raise ValueError('Unrecognized marker style {!r}'
253+
.format(marker))
254254

255255
self._marker = marker
256256
self._recache()

lib/matplotlib/table.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,13 @@ def __init__(self, ax, loc=None, bbox=None, **kwargs):
241241

242242
Artist.__init__(self)
243243

244-
if isinstance(loc, str) and loc not in self.codes:
245-
warnings.warn('Unrecognized location %s. Falling back on '
246-
'bottom; valid locations are\n%s\t' %
247-
(loc, '\n\t'.join(self.codes)))
248-
loc = 'bottom'
249244
if isinstance(loc, str):
250-
loc = self.codes.get(loc, 1)
245+
if loc not in self.codes:
246+
warnings.warn('Unrecognized location %s. Falling back on '
247+
'bottom; valid locations are\n%s\t' %
248+
(loc, '\n\t'.join(self.codes)))
249+
loc = 'bottom'
250+
loc = self.codes[loc]
251251
self.set_figure(ax.figure)
252252
self._axes = ax
253253
self._loc = loc

0 commit comments

Comments
 (0)