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

Skip to content

Remove most instances of pep8 E502 (redundant backslashes). #10196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/matplotlib/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,8 @@ def test_get_window_extent_for_AxisImage():
# object at a given location and check that get_window_extent()
# returns the correct bounding box values (in pixels).

im = np.array([[0.25, 0.75, 1.0, 0.75], [0.1, 0.65, 0.5, 0.4], \
[0.6, 0.3, 0.0, 0.2], [0.7, 0.9, 0.4, 0.6]])
im = np.array([[0.25, 0.75, 1.0, 0.75], [0.1, 0.65, 0.5, 0.4],
[0.6, 0.3, 0.0, 0.2], [0.7, 0.9, 0.4, 0.6]])
fig = plt.figure(figsize=(10, 10), dpi=100)
ax = plt.subplot()
ax.set_position([0, 0, 1, 1])
Expand Down
8 changes: 4 additions & 4 deletions lib/mpl_toolkits/axes_grid1/mpl_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ def __init__(self, axis, axisnum, spine):

def _get_major_ticks(self):
tickline = "tick%dline" % self._axisnum
return SimpleChainedObjects([getattr(tick, tickline) for tick \
in self._axis.get_major_ticks()])
return SimpleChainedObjects([getattr(tick, tickline)
for tick in self._axis.get_major_ticks()])

def _get_major_ticklabels(self):
label = "label%d" % self._axisnum
return SimpleChainedObjects([getattr(tick, label) for tick \
in self._axis.get_major_ticks()])
return SimpleChainedObjects([getattr(tick, label)
for tick in self._axis.get_major_ticks()])

def _get_label(self):
return self._axis.label
Expand Down
2 changes: 1 addition & 1 deletion lib/mpl_toolkits/axes_grid1/parasite_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def _remove_method(h):

def get_tightbbox(self, renderer, call_axes_locator=True):

bbs = [ax.get_tightbbox(renderer, call_axes_locator) \
bbs = [ax.get_tightbbox(renderer, call_axes_locator)
for ax in self.parasites]
get_tightbbox = self._get_base_axes_attr("get_tightbbox")
bbs.append(get_tightbbox(self, renderer, call_axes_locator))
Expand Down
8 changes: 4 additions & 4 deletions lib/mpl_toolkits/axisartist/angle_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,15 @@ def __call__(self, direction, factor, values):
if number_fraction is None:
return [self.fmt_d % (s*int(v),) for (s, v) in zip(ss, values)]
else:
return [self.fmt_ds % (s*int(v), f1) for (s, v, f1) in \
zip(ss, values, frac_str)]
return [self.fmt_ds % (s*int(v), f1)
for (s, v, f1) in zip(ss, values, frac_str)]
elif factor == 60:
deg_part, min_part = divmod(values, 60)
if number_fraction is None:
return [self.fmt_d_m % (s1, d1, m1) \
return [self.fmt_d_m % (s1, d1, m1)
for s1, d1, m1 in zip(signs, deg_part, min_part)]
else:
return [self.fmt_d_ms % (s, d1, m1, f1) \
return [self.fmt_d_ms % (s, d1, m1, f1)
for s, d1, m1, f1 in zip(signs, deg_part, min_part, frac_str)]

elif factor == 3600:
Expand Down
22 changes: 7 additions & 15 deletions lib/mpl_toolkits/axisartist/axislines.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,15 @@ class AxisArtistHelperRectlinear(object):

class Fixed(AxisArtistHelper.Fixed):

def __init__(self,
axes, loc, nth_coord=None,
):
def __init__(self, axes, loc, nth_coord=None):
"""
nth_coord = along which coordinate value varies
in 2d, nth_coord = 0 -> x axis, nth_coord = 1 -> y axis
"""

super(AxisArtistHelperRectlinear.Fixed, self).__init__( \
loc, nth_coord)

super(AxisArtistHelperRectlinear.Fixed, self).__init__(
loc, nth_coord)
self.axis = [axes.xaxis, axes.yaxis][self.nth_coord]



# TICK

def get_tick_iterators(self, axes):
Expand Down Expand Up @@ -293,14 +287,11 @@ def _f(locs, labels):
class Floating(AxisArtistHelper.Floating):
def __init__(self, axes, nth_coord,
passingthrough_point, axis_direction="bottom"):

super(AxisArtistHelperRectlinear.Floating, self).__init__( \
super(AxisArtistHelperRectlinear.Floating, self).__init__(
nth_coord, passingthrough_point)
self._axis_direction = axis_direction

self.axis = [axes.xaxis, axes.yaxis][self.nth_coord]


def get_line(self, axes):
_verts = np.array([[0., 0.],
[1., 1.]])
Expand Down Expand Up @@ -498,13 +489,14 @@ def new_floating_axis(self, nth_coord, value,
):

if axes is None:
warnings.warn("'new_floating_axis' explicitly requires the axes keyword.")
warnings.warn(
"'new_floating_axis' explicitly requires the axes keyword.")
axes = self.axes

passthrough_point = (value, value)
transform = axes.transData

_helper = AxisArtistHelperRectlinear.Floating( \
_helper = AxisArtistHelperRectlinear.Floating(
axes, nth_coord, value, axis_direction)

axisline = AxisArtist(axes, _helper)
Expand Down
21 changes: 8 additions & 13 deletions lib/mpl_toolkits/axisartist/grid_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ def _get_raw_grid_lines(self,
lons_i = np.linspace(lon_min, lon_max, 100) # for interpolation
lats_i = np.linspace(lat_min, lat_max, 100)

lon_lines = [self.transform_xy(np.zeros_like(lats_i)+lon, lats_i) \
lon_lines = [self.transform_xy(np.zeros_like(lats_i) + lon, lats_i)
for lon in lon_values]
lat_lines = [self.transform_xy(lons_i, np.zeros_like(lons_i)+lat) \
lat_lines = [self.transform_xy(lons_i, np.zeros_like(lons_i) + lat)
for lat in lat_values]

return lon_lines, lat_lines
Expand Down Expand Up @@ -212,8 +212,6 @@ def update(self, **kw):
raise ValueError("unknown update property '%s'" % k)




class GridFinder(GridFinderBase):

def __init__(self,
Expand All @@ -231,7 +229,6 @@ def __init__(self,

locator1, locator2 : grid locator for 1st and 2nd axis.
"""

if extreme_finder is None:
extreme_finder = ExtremeFinderSimple(20, 20)
if grid_locator1 is None:
Expand All @@ -242,14 +239,12 @@ def __init__(self,
tick_formatter1 = FormatterPrettyPrint()
if tick_formatter2 is None:
tick_formatter2 = FormatterPrettyPrint()

super(GridFinder, self).__init__( \
extreme_finder,
grid_locator1,
grid_locator2,
tick_formatter1,
tick_formatter2)

super(GridFinder, self).__init__(
extreme_finder,
grid_locator1,
grid_locator2,
tick_formatter1,
tick_formatter2)
self.update_transform(transform)


Expand Down
6 changes: 2 additions & 4 deletions lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ def __init__(self, grid_helper, side, nth_coord_ticks=None):
nth_coord = 0 -> x axis, nth_coord = 1 -> y axis
"""

super(FixedAxisArtistHelper, self).__init__( \
loc=side,
)
super(FixedAxisArtistHelper, self).__init__(loc=side)

self.grid_helper = grid_helper
if nth_coord_ticks is None:
Expand Down Expand Up @@ -412,7 +410,7 @@ def new_floating_axis(self, nth_coord,
if axes is None:
axes = self.axes

_helper = FloatingAxisArtistHelper( \
_helper = FloatingAxisArtistHelper(
self, nth_coord, value, axis_direction)

axisline = AxisArtist(axes, _helper)
Expand Down
4 changes: 2 additions & 2 deletions lib/mpl_toolkits/mplot3d/art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def set_3d_properties(self, z=0, zdir='z'):
self.stale = True

def draw(self, renderer):
proj = proj3d.proj_trans_points([self._position3d, \
self._position3d + self._dir_vec], renderer.M)
proj = proj3d.proj_trans_points(
[self._position3d, self._position3d + self._dir_vec], renderer.M)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should break before the second arg though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the bracketed parts doesn't fit on the same line as "proj_trans_points(" and I think we have plenty of cases where the function is on one line and all the arguments on the next line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mostly say to break here because the first arg is a list using commas for "other" things than separating function arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll follow the vote of the next reviewer.

dx = proj[0][1] - proj[0][0]
dy = proj[1][1] - proj[1][0]
if dx==0. and dy==0.:
Expand Down
16 changes: 8 additions & 8 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pep8ignore =
matplotlib/testing/jpl_units/UnitDbl.py E201 E202 E203
matplotlib/testing/jpl_units/UnitDblConverter.py E201 E202 E203 E251 E302 E501 E711
matplotlib/testing/jpl_units/UnitDblFormatter.py E201 E202 E251 E302
matplotlib/tests/test_image.py E225 E231 E251 E302 E303 E501 E502
matplotlib/tests/test_image.py E225 E231 E251 E302 E303 E501
matplotlib/tests/test_lines.py E231 E261
matplotlib/tests/test_mathtext.py E261 E302 E501
matplotlib/tests/test_rcparams.py E231 E501
Expand Down Expand Up @@ -84,22 +84,22 @@ pep8ignore =
mpl_toolkits/axes_grid1/axes_size.py E225 E261 E302 E303 E501
mpl_toolkits/axes_grid1/colorbar.py E225 E231 E261 E262 E302 E303 E501 E701
mpl_toolkits/axes_grid1/inset_locator.py E501
mpl_toolkits/axes_grid1/mpl_axes.py E302 E303 E501 E502
mpl_toolkits/axes_grid1/parasite_axes.py E225 E231 E302 E303 E402 E501 E502
mpl_toolkits/axes_grid1/mpl_axes.py E302 E303 E501
mpl_toolkits/axes_grid1/parasite_axes.py E225 E231 E302 E303 E402 E501
mpl_toolkits/axisartist/__init__.py E501
mpl_toolkits/axisartist/angle_helper.py E201 E203 E221 E222 E225 E231 E251 E261 E262 E302 E303 E402 E501 E502
mpl_toolkits/axisartist/angle_helper.py E201 E203 E221 E222 E225 E231 E251 E261 E262 E302 E303 E402 E501
mpl_toolkits/axisartist/axes_divider.py E501
mpl_toolkits/axisartist/axes_grid.py E225 E302
mpl_toolkits/axisartist/axes_rgb.py E302 E501
mpl_toolkits/axisartist/axis_artist.py E201 E202 E221 E225 E228 E231 E251 E261 E262 E302 E303 E402 E501 E701 E702 E711
mpl_toolkits/axisartist/axisline_style.py E231 E261 E262 E302 E303
mpl_toolkits/axisartist/axislines.py E225 E231 E261 E262 E302 E303 E501 E502 E711
mpl_toolkits/axisartist/axislines.py E225 E231 E261 E262 E302 E303 E501 E711
mpl_toolkits/axisartist/clip_path.py E225 E228 E302 E303 E501 E502
mpl_toolkits/axisartist/floating_axes.py E201 E225 E231 E261 E262 E271 E302 E303 E402 E501
mpl_toolkits/axisartist/grid_finder.py E231 E261 E302 E303 E402 E501 E502
mpl_toolkits/axisartist/grid_helper_curvelinear.py E221 E225 E231 E251 E261 E262 E271 E302 E303 E501 E502
mpl_toolkits/axisartist/grid_finder.py E231 E261 E302 E303 E402 E501
mpl_toolkits/axisartist/grid_helper_curvelinear.py E221 E225 E231 E251 E261 E262 E271 E302 E303 E501
mpl_toolkits/axisartist/parasite_axes.py E501
mpl_toolkits/mplot3d/art3d.py E203 E222 E225 E231 E501 E502
mpl_toolkits/mplot3d/art3d.py E203 E222 E225 E231 E501
mpl_toolkits/mplot3d/axes3d.py E203 E225 E231 E271 E303 E402 E501 E502 E701
mpl_toolkits/mplot3d/axis3d.py E201 E202 E203 E222 E231 E302 E303 E501 E502
mpl_toolkits/mplot3d/proj3d.py E231 E302 E303
Expand Down