-
Notifications
You must be signed in to change notification settings - Fork 44
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
Remove some unnecessary empty return statements #455
Conversation
Note that this commit does not remove all of the unnecessary empty return statements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like there should be a tool that can do this for us...
modified: enable/viewable.py
enable/viewable.py
Outdated
# This overrides the default Component request_redraw by asking | ||
# all of the views to redraw themselves. | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also just change the comment to a docstring so that the return
can still be removed.
Codecov Report
@@ Coverage Diff @@
## master #455 +/- ##
==========================================
- Coverage 30.26% 29.14% -1.12%
==========================================
Files 206 206
Lines 18143 17954 -189
Branches 2461 2466 +5
==========================================
- Hits 5491 5233 -258
- Misses 12309 12394 +85
+ Partials 343 327 -16
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I reviewed the code surrounding the removal and confirmed (the best I could) that they are all at the end of a function (not early termination, and not function whose API explicitly requires a None to be returned)
@@ -1028,7 +1006,6 @@ def _set_active_tool(self, tool): | |||
tool._activate() | |||
|
|||
self.invalidate_and_redraw() | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one more return
at the bottom of _old_dispatch
which can be removed.
@@ -55,7 +53,6 @@ def _mouse_move_changed(self, event): | |||
if (x != self._cur_x) or (y != self._cur_y): | |||
self._cur_x, self._cur_y = x, y | |||
self.redraw() | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return
at the bottom of _draw
(next function) can be removed too.
@@ -249,7 +249,6 @@ def __touch__(self, key): | |||
self.__order__ = self.__order__[1:] + [key] | |||
else: | |||
self.__order__.append(key) | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No action. Just an observation that this will conflict with #392
(There are probably plenty of opportunity for merge conflicts anyway.)
Since this PR was opened, a number of PRs have gone in, including one that updates the CI configuration to require tests to pass on wx. As a sanity check, it would be good to merge master in here to get another CI run before we merge. |
This PR removes a number of unnecessary empty return statements from the codebase - from
enable
, fromkiva
, from the test suite and from the examples.Apologies to the reviewer because this is quite an ugly PR to review. I checked each
return
statement to ensure that the empty statement is not part of conditional logic/earlyreturn
from a function/method. Only emptyreturn
s at the end of functions/methods are removed.