PEP8 fixes on widgets.py #1374

Merged
merged 1 commit into from Nov 11, 2012

Projects

None yet

3 participants

@NelleV

PEP8 changes on the widgets module.

Thanks,
N

@dmcdougall dmcdougall commented on the diff Oct 13, 2012
lib/matplotlib/widgets.py
if self.eventpress is None or self.ignore(event):
return
- x,y = event.xdata, event.ydata # actual position (with
- # (button still pressed)
+ x, y = event.xdata, event.ydata # actual position (with
+ # (button still pressed)
@dmcdougall
dmcdougall Oct 13, 2012

I think it would look slightly neater if these two inline comments lined up vertically.

@WeatherGod WeatherGod commented on the diff Oct 13, 2012
lib/matplotlib/widgets.py
for p in self.circles:
- if p==inp: color = self.activecolor
- else: color = self.ax.get_axis_bgcolor()
+ if p == inp:
+ color = self.activecolor
+ else:
+ color = self.ax.get_axis_bgcolor()
@WeatherGod
WeatherGod Oct 13, 2012

Since we now support python 2.6 and above, we can use ternary expressions. This might be a good candidate for that.

@NelleV
NelleV Oct 13, 2012

Indeed, but I'm afraid, if the test suite is not extensive enough, to add bugs to matplotlib. I'd rather avoid any none trivial change.

@WeatherGod WeatherGod and 1 other commented on an outdated diff Oct 13, 2012
lib/matplotlib/widgets.py
# TODO: Why is there triple-quoted items, and two separate checks.
- if (self.drawtype=='box') and (xproblems or yproblems):
+ if (self.drawtype == 'box') and (xproblems or yproblems):
"""Box to small""" # check if drawn distance (if it exists) is
@WeatherGod
WeatherGod Oct 13, 2012

Can we fix the english here and below from "to" --> "too"?

@WeatherGod
WeatherGod Oct 13, 2012

Heck, why not just simply remove the strings and use the comments instead?

@WeatherGod WeatherGod commented on an outdated diff Oct 13, 2012
lib/matplotlib/widgets.py
return False
def update(self):
- 'draw using newfangled blit or oldfangled draw depending on useblit'
+ """draw using newfangled blit or oldfangled draw depending on
+ useblit"""
@WeatherGod
WeatherGod Oct 13, 2012

multi-line docstrings should have triple-quotes on their own lines.

@dmcdougall dmcdougall merged commit 4f902fa into matplotlib:master Nov 11, 2012

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment