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

Skip to content

Commit 65b8f8e

Browse files
committed
Wrap a few overly long lines.
For some files which are "nearly" correct and can thus have an pep8ignore entry removed after the fix.
1 parent 0211860 commit 65b8f8e

22 files changed

+140
-118
lines changed

lib/matplotlib/_mathtext_data.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2373,10 +2373,10 @@
23732373
(0x0066, 0x0068, 'it', 0xe169), # f-h
23742374
(0x0069, 0x006a, 'it', 0x2148), # i-j
23752375
(0x006b, 0x007a, 'it', 0xe16c), # k-z
2376-
(0x0393, 0x0393, 'it', 0x213e), # \Gamma (missing in beta STIX fonts)
2376+
(0x0393, 0x0393, 'it', 0x213e), # \Gamma (not in beta STIX fonts)
23772377
(0x03a0, 0x03a0, 'it', 0x213f), # \Pi
2378-
(0x03a3, 0x03a3, 'it', 0x2140), # \Sigma (missing in beta STIX fonts)
2379-
(0x03b3, 0x03b3, 'it', 0x213d), # \gamma (missing in beta STIX fonts)
2378+
(0x03a3, 0x03a3, 'it', 0x2140), # \Sigma (not in beta STIX fonts)
2379+
(0x03b3, 0x03b3, 'it', 0x213d), # \gamma (not in beta STIX fonts)
23802380
(0x03c0, 0x03c0, 'it', 0x213c), # \pi
23812381
],
23822382
'bf':

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,8 @@ def set_dashes(self, dash_offset, dash_list):
10701070
if dash_list is not None:
10711071
dl = np.asarray(dash_list)
10721072
if np.any(dl < 0.0):
1073-
raise ValueError("All values in the dash list must be positive")
1073+
raise ValueError(
1074+
"All values in the dash list must be positive")
10741075
self._dashes = dash_offset, dash_list
10751076

10761077
def set_foreground(self, fg, isRGBA=False):
@@ -2308,7 +2309,8 @@ def get_default_filename(self):
23082309
i = 1
23092310
while os.path.isfile(os.path.join(save_dir, default_filename)):
23102311
# attach numerical count to basename
2311-
default_filename = '{0}-{1}.{2}'.format(default_basename, i, default_filetype)
2312+
default_filename = (
2313+
'{}-{}.{}'.format(default_basename, i, default_filetype))
23122314
i += 1
23132315

23142316
return default_filename

lib/matplotlib/backends/backend_cairo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ def draw_path(self, gc, path, transform, rgbFace=None):
168168
self._fill_and_stroke(
169169
ctx, rgbFace, gc.get_alpha(), gc.get_forced_alpha())
170170

171-
def draw_markers(
172-
self, gc, marker_path, marker_trans, path, transform, rgbFace=None):
171+
def draw_markers(self, gc, marker_path, marker_trans, path, transform,
172+
rgbFace=None):
173173
ctx = gc.ctx
174174

175175
ctx.new_path()

lib/matplotlib/backends/backend_macosx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def resize(self, width, height):
106106

107107
def new_timer(self, *args, **kwargs):
108108
"""
109-
Creates a new backend-specific subclass of :class:`backend_bases.Timer`.
109+
Creates a new backend-specific subclass of `backend_bases.Timer`.
110110
This is useful for getting periodic events through the backend's native
111111
event loop. Implemented only for backends with GUIs.
112112

lib/matplotlib/backends/backend_template.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,16 @@ def draw_path(self, gc, path, transform, rgbFace=None):
9090
# draw_markers is optional, and we get more correct relative
9191
# timings by leaving it out. backend implementers concerned with
9292
# performance will probably want to implement it
93-
# def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None):
93+
# def draw_markers(self, gc, marker_path, marker_trans, path, trans,
94+
# rgbFace=None):
9495
# pass
9596

9697
# draw_path_collection is optional, and we get more correct
9798
# relative timings by leaving it out. backend implementers concerned with
9899
# performance will probably want to implement it
99100
# def draw_path_collection(self, gc, master_transform, paths,
100-
# all_transforms, offsets, offsetTrans, facecolors,
101-
# edgecolors, linewidths, linestyles,
101+
# all_transforms, offsets, offsetTrans,
102+
# facecolors, edgecolors, linewidths, linestyles,
102103
# antialiaseds):
103104
# pass
104105

lib/matplotlib/projections/geo.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,23 @@ def _set_lim_and_transforms(self):
8282
# This is the transform for longitude ticks.
8383
self._xaxis_pretransform = \
8484
Affine2D() \
85-
.scale(1.0, self._longitude_cap * 2.0) \
86-
.translate(0.0, -self._longitude_cap)
85+
.scale(1, self._longitude_cap * 2) \
86+
.translate(0, -self._longitude_cap)
8787
self._xaxis_transform = \
8888
self._xaxis_pretransform + \
8989
self.transData
9090
self._xaxis_text1_transform = \
91-
Affine2D().scale(1.0, 0.0) + \
91+
Affine2D().scale(1, 0) + \
9292
self.transData + \
93-
Affine2D().translate(0.0, 4.0)
93+
Affine2D().translate(0, 4)
9494
self._xaxis_text2_transform = \
95-
Affine2D().scale(1.0, 0.0) + \
95+
Affine2D().scale(1, 0) + \
9696
self.transData + \
97-
Affine2D().translate(0.0, -4.0)
97+
Affine2D().translate(0, -4)
9898

9999
# This is the transform for latitude ticks.
100-
yaxis_stretch = Affine2D().scale(np.pi * 2.0, 1.0).translate(-np.pi, 0.0)
101-
yaxis_space = Affine2D().scale(1.0, 1.1)
100+
yaxis_stretch = Affine2D().scale(np.pi * 2, 1).translate(-np.pi, 0)
101+
yaxis_space = Affine2D().scale(1, 1.1)
102102
self._yaxis_transform = \
103103
yaxis_stretch + \
104104
self.transData
@@ -110,15 +110,15 @@ def _set_lim_and_transforms(self):
110110
self.transAxes)
111111
self._yaxis_text1_transform = \
112112
yaxis_text_base + \
113-
Affine2D().translate(-8.0, 0.0)
113+
Affine2D().translate(-8, 0)
114114
self._yaxis_text2_transform = \
115115
yaxis_text_base + \
116-
Affine2D().translate(8.0, 0.0)
116+
Affine2D().translate(8, 0)
117117

118118
def _get_affine_transform(self):
119119
transform = self._get_core_transform(1)
120120
xscale, _ = transform.transform_point((np.pi, 0))
121-
_, yscale = transform.transform_point((0, np.pi / 2.0))
121+
_, yscale = transform.transform_point((0, np.pi / 2))
122122
return Affine2D() \
123123
.scale(0.5 / xscale, 0.5 / yscale) \
124124
.translate(0.5, 0.5)
@@ -266,7 +266,8 @@ def transform_path_non_affine(self, path):
266266
vertices = path.vertices
267267
ipath = path.interpolated(self._resolution)
268268
return Path(self.transform(ipath.vertices), ipath.codes)
269-
transform_path_non_affine.__doc__ = Transform.transform_path_non_affine.__doc__
269+
transform_path_non_affine.__doc__ = \
270+
Transform.transform_path_non_affine.__doc__
270271

271272

272273
class AitoffAxes(GeoAxes):
@@ -377,7 +378,8 @@ class MollweideTransform(_GeoTransform):
377378

378379
def transform_non_affine(self, ll):
379380
def d(theta):
380-
delta = -(theta + np.sin(theta) - pi_sin_l) / (1 + np.cos(theta))
381+
delta = (-(theta + np.sin(theta) - pi_sin_l)
382+
/ (1 + np.cos(theta)))
381383
return delta, np.abs(delta) > 0.001
382384

383385
longitude = ll[:, 0]

lib/matplotlib/sphinxext/plot_directive.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,8 @@ def render_figures(code, code_path, output_dir, output_base, context,
598598
images = []
599599
for j in xrange(1000):
600600
if len(code_pieces) > 1:
601-
img = ImageFile('%s_%02d_%02d' % (output_base, i, j), output_dir)
601+
img = ImageFile('%s_%02d_%02d' % (output_base, i, j),
602+
output_dir)
602603
else:
603604
img = ImageFile('%s_%02d' % (output_base, j), output_dir)
604605
for format, dpi in formats:
@@ -780,8 +781,8 @@ def run(arguments, content, options, state_machine, state, lineno):
780781
except PlotError as err:
781782
reporter = state.memo.reporter
782783
sm = reporter.system_message(
783-
2, "Exception occurred in plotting %s\n from %s:\n%s" % (output_base,
784-
source_file_name, err),
784+
2, "Exception occurred in plotting {}\n from {}:\n{}".format(
785+
output_base, source_file_name, err),
785786
line=lineno)
786787
results = [(code, [])]
787788
errors = [sm]
@@ -808,8 +809,9 @@ def run(arguments, content, options, state_machine, state, lineno):
808809
if nofigs:
809810
images = []
810811

811-
opts = [':%s: %s' % (key, val) for key, val in six.iteritems(options)
812-
if key in ('alt', 'height', 'width', 'scale', 'align', 'class')]
812+
opts = [
813+
':%s: %s' % (key, val) for key, val in six.iteritems(options)
814+
if key in ('alt', 'height', 'width', 'scale', 'align', 'class')]
813815

814816
only_html = ".. only:: html"
815817
only_latex = ".. only:: latex"

lib/matplotlib/testing/decorators.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,10 @@ def copy_baseline(self, baseline, extension):
259259
orig_expected_fname = baseline_path + '.' + extension
260260
if extension == 'eps' and not os.path.exists(orig_expected_fname):
261261
orig_expected_fname = baseline_path + '.pdf'
262-
expected_fname = make_test_filename(os.path.join(
263-
self.result_dir, os.path.basename(orig_expected_fname)), 'expected')
262+
expected_fname = make_test_filename(
263+
os.path.join(self.result_dir,
264+
os.path.basename(orig_expected_fname)),
265+
'expected')
264266
if os.path.exists(orig_expected_fname):
265267
shutil.copyfile(orig_expected_fname, expected_fname)
266268
else:
@@ -278,7 +280,8 @@ def compare(self, idx, baseline, extension):
278280
if self.remove_text:
279281
remove_ticks_and_titles(fig)
280282

281-
actual_fname = os.path.join(self.result_dir, baseline) + '.' + extension
283+
actual_fname = (
284+
os.path.join(self.result_dir, baseline) + '.' + extension)
282285
kwargs = self.savefig_kwargs.copy()
283286
if extension == 'pdf':
284287
kwargs.setdefault('metadata',
@@ -482,7 +485,8 @@ def _image_directories(func):
482485
module_name = func.__module__
483486
if module_name == '__main__':
484487
# FIXME: this won't work for nested packages in matplotlib.tests
485-
warnings.warn('test module run as script. guessing baseline image locations')
488+
warnings.warn(
489+
'Test module run as script. Guessing baseline image locations.')
486490
script_name = sys.argv[0]
487491
basedir = os.path.abspath(os.path.dirname(script_name))
488492
subdir = os.path.splitext(os.path.split(script_name)[1])[0]
@@ -496,12 +500,13 @@ def _image_directories(func):
496500
# multiprocess plugin or as a specific test this may be
497501
# missing. See https://github.com/matplotlib/matplotlib/issues/3314
498502
if mods.pop(0) != 'tests':
499-
warnings.warn(("Module '%s' does not live in a parent module "
500-
"named 'tests'. This is probably ok, but we may not be able "
501-
"to guess the correct subdirectory containing the baseline "
502-
"images. If things go wrong please make sure that there is "
503-
"a parent directory named 'tests' and that it contains a "
504-
"__init__.py file (can be empty).") % module_name)
503+
warnings.warn(
504+
"Module {!r} does not live in a parent module named 'tests'. "
505+
"This is probably ok, but we may not be able to guess the "
506+
"correct subdirectory containing the baseline images. If "
507+
"things go wrong please make sure that there is a parent "
508+
"directory named 'tests' and that it contains a __init__.py "
509+
"file (can be empty).".format(module_name))
505510
subdir = os.path.join(*mods)
506511

507512
import imp

lib/matplotlib/testing/jpl_units/UnitDblConverter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def convert( value, unit, axis ):
132132
unit = UnitDblConverter.default_units( value, axis )
133133

134134
# Convert the incoming UnitDbl value/values to float/floats
135-
if isinstance( axis.axes, polar.PolarAxes ) and (value.type() == "angle"):
135+
if isinstance( axis.axes, polar.PolarAxes ) and value.type() == "angle":
136136
# Guarantee that units are radians for polar plots.
137137
return value.convert( "rad" )
138138

lib/matplotlib/testing/jpl_units/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
measured where an Epoch is a specific moment in time. Epochs are typically
2121
referenced as an offset from some predetermined epoch.
2222
23-
A difference of two epochs is a Duration. The distinction between a
24-
Duration and a UnitDbl of time is made because an Epoch can have different
25-
frames (or units). In the case of our test Epoch class the two allowed
26-
frames are 'UTC' and 'ET' (Note that these are rough estimates provided for
27-
testing purposes and should not be used in production code where accuracy
28-
of time frames is desired). As such a Duration also has a frame of
29-
reference and therefore needs to be called out as different that a simple
30-
measurement of time since a delta-t in one frame may not be the same in another.
23+
A difference of two epochs is a Duration. The distinction between a Duration
24+
and a UnitDbl of time is made because an Epoch can have different frames (or
25+
units). In the case of our test Epoch class the two allowed frames are 'UTC'
26+
and 'ET' (Note that these are rough estimates provided for testing purposes
27+
and should not be used in production code where accuracy of time frames is
28+
desired). As such a Duration also has a frame of reference and therefore needs
29+
to be called out as different that a simple measurement of time since a delta-t
30+
in one frame may not be the same in another.
3131
"""
3232

3333
#=======================================================================

lib/matplotlib/tests/test_rcparams.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ def test_rcparams_reset_after_fail():
417417
assert mpl.rcParams['text.usetex'] is False
418418

419419
with pytest.raises(KeyError):
420-
with mpl.rc_context(rc=OrderedDict([('text.usetex', True),('test.blah', True)])):
420+
with mpl.rc_context(rc=OrderedDict([('text.usetex', True),
421+
('test.blah', True)])):
421422
pass
422423

423424
assert mpl.rcParams['text.usetex'] is False

lib/matplotlib/type1font.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ def _parse(self):
243243
if 'FullName' not in prop:
244244
prop['FullName'] = prop['FontName']
245245
if 'FamilyName' not in prop:
246-
extras = r'(?i)([ -](regular|plain|italic|oblique|(semi)?bold|(ultra)?light|extra|condensed))+$'
246+
extras = ('(?i)([ -](regular|plain|italic|oblique|(semi)?bold|'
247+
'(ultra)?light|extra|condensed))+$')
247248
prop['FamilyName'] = re.sub(extras, '', prop['FullName'])
248249

249250
self.prop = prop
@@ -253,13 +254,14 @@ def _transformer(cls, tokens, slant, extend):
253254
def fontname(name):
254255
result = name
255256
if slant:
256-
result += b'_Slant_' + str(int(1000 * slant)).encode('latin-1')
257+
result += b'_Slant_' + str(int(1000 * slant)).encode('ascii')
257258
if extend != 1.0:
258-
result += b'_Extend_' + str(int(1000 * extend)).encode('latin-1')
259+
result += b'_Extend_' + str(int(1000 * extend)).encode('ascii')
259260
return result
260261

261262
def italicangle(angle):
262-
return str(float(angle) - np.arctan(slant) / np.pi * 180).encode('latin-1')
263+
return (str(float(angle) - np.arctan(slant) / np.pi * 180)
264+
.encode('ascii'))
263265

264266
def fontmatrix(array):
265267
array = array.lstrip(b'[').rstrip(b']').strip().split()

lib/mpl_toolkits/axes_grid/parasite_axes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4-
from mpl_toolkits.axes_grid1.parasite_axes import \
5-
subplot_class_factory, \
6-
parasite_axes_class_factory, parasite_axes_auxtrans_class_factory, \
7-
host_axes_class_factory
4+
from mpl_toolkits.axes_grid1.parasite_axes import (
5+
host_axes_class_factory, parasite_axes_class_factory,
6+
parasite_axes_auxtrans_class_factory, subplot_class_factory)
87

98
from .axislines import Axes
109

1110

1211
ParasiteAxes = parasite_axes_class_factory(Axes)
1312

14-
ParasiteAxesAuxTrans = parasite_axes_auxtrans_class_factory(axes_class=ParasiteAxes)
13+
ParasiteAxesAuxTrans = \
14+
parasite_axes_auxtrans_class_factory(axes_class=ParasiteAxes)
1515

1616
HostAxes = host_axes_class_factory(axes_class=Axes)
1717

lib/mpl_toolkits/axisartist/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,23 @@
33

44
import six
55

6-
from .axislines import Axes, Subplot, AxesZero, SubplotZero, GridHelperRectlinear, \
7-
AxisArtistHelperRectlinear, AxisArtistHelper, GridHelperBase
6+
from .axislines import (
7+
Axes, AxesZero, AxisArtistHelper, AxisArtistHelperRectlinear,
8+
GridHelperBase, GridHelperRectlinear, Subplot, SubplotZero)
89
from .axis_artist import AxisArtist, GridlinesCollection
910

1011
from .grid_helper_curvelinear import GridHelperCurveLinear
1112

1213
from .floating_axes import FloatingAxes, FloatingSubplot
1314

14-
from mpl_toolkits.axes_grid1.parasite_axes import \
15-
subplot_class_factory, \
16-
parasite_axes_class_factory, parasite_axes_auxtrans_class_factory, \
17-
host_axes_class_factory
15+
from mpl_toolkits.axes_grid1.parasite_axes import (
16+
host_axes_class_factory, parasite_axes_class_factory,
17+
parasite_axes_auxtrans_class_factory, subplot_class_factory)
1818

1919
ParasiteAxes = parasite_axes_class_factory(Axes)
2020

21-
ParasiteAxesAuxTrans = parasite_axes_auxtrans_class_factory(axes_class=ParasiteAxes)
21+
ParasiteAxesAuxTrans = \
22+
parasite_axes_auxtrans_class_factory(axes_class=ParasiteAxes)
2223

2324
HostAxes = host_axes_class_factory(axes_class=Axes)
2425

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4-
from mpl_toolkits.axes_grid1.axes_divider import Divider, AxesLocator, SubplotDivider, \
5-
AxesDivider, locatable_axes_factory, make_axes_locatable
4+
from mpl_toolkits.axes_grid1.axes_divider import (
5+
Divider, AxesLocator, SubplotDivider, AxesDivider, locatable_axes_factory,
6+
make_axes_locatable)
67

78
from mpl_toolkits.axes_grid.axislines import Axes
89
LocatableAxes = locatable_axes_factory(Axes)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4-
#from mpl_toolkits.axes_grid1.axes_rgb import *
5-
from mpl_toolkits.axes_grid1.axes_rgb import make_rgb_axes, imshow_rgb, RGBAxesBase
4+
from mpl_toolkits.axes_grid1.axes_rgb import (
5+
make_rgb_axes, imshow_rgb, RGBAxesBase)
66

7-
#import mpl_toolkits.axes_grid1.axes_rgb as axes_rgb_orig
87
from .axislines import Axes
98

9+
1010
class RGBAxes(RGBAxesBase):
1111
_defaultAxesClass = Axes

0 commit comments

Comments
 (0)