-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
whitespace(-mostly) style cleanup. #12026
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
Conversation
I intentionally left in nearly all commented out dead code.
@@ -295,7 +297,7 @@ def __call__(self, direction, factor, values): | |||
l_hm = self.fmt_d_m_partial % (s, d1, m1) | |||
if l_hm != l_hm_old: | |||
l_hm_old = l_hm | |||
l = l_hm + s1 #l_s |
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.
l_s doesn't appear anywhere else in the codebase so I just killed the comment.
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.
i think the commented out code in general should be removed, but i understand why we'd want to keep it around.
#dd += np.pi | ||
#dd = np.arctan2(xx2-xx1, angle_tangent-yy1) | ||
# dd += np.pi | ||
# dd = np.arctan2(xx2-xx1, angle_tangent-yy1) |
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.
should these just go away?
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 whole block came in commented out with the surrounding code in 4fa9271 so yes.
@@ -245,30 +235,21 @@ def __init__(self, aux_trans, extremes, | |||
tick_formatter1=tick_formatter1, | |||
tick_formatter2=tick_formatter2) | |||
|
|||
|
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.
should these go away as well?
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's an update_grid_finder in grid_helper_curvelinear so I'll leave this one in
lon_lines, lat_lines = grid_finder._get_raw_grid_lines(extremes[:2], | ||
extremes[2:], | ||
*extremes) | ||
#lon_min, lon_max, | ||
# lon_min, lon_max, | ||
# lat_min, lat_max) |
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.
perhaps this should be bumped up to previous line
@@ -140,7 +138,7 @@ def update_lim(self, axes): | |||
|
|||
grid_finder = self.grid_helper.grid_finder | |||
|
|||
#e1, e2 = self._extremes # ranges of other coordinates | |||
# e1, e2 = self._extremes # ranges of other coordinates |
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.
goes away?
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.
duplicated just a bit before in the same function so yes
# dd = np.arctan2(yy2-yy1, xx2-xx1) # angle normal | ||
# dd2 = np.arctan2(yy3-yy1, xx3-xx1) # angle tangent | ||
# mm = ((yy2-yy1)==0.) & ((xx2-xx1)==0.) # mask where dd1 is not defined | ||
# dd[mm] = dd2[mm] + np.pi / 2 |
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.
goes away?
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.
came in commented in 3b48ebb, and there's no yy2 and friends as local variables anymore, so I guess sure.
I agree with removing dead code in general, but I think someone should first figure out what a given line was intended to do before killing it. |
I really don't like it when auto-linters add that space for blocks of
commented out code. It doesn't make it any easier for me to read, and it
actually makes it harder to distinguish an expression that lives in a
comment, versus some actual, previously used but now commented out code.
…On Wed, Sep 5, 2018 at 1:36 PM Antony Lee ***@***.***> wrote:
I agree with removing dead code in general, but I think someone should
first figure out what a given line was intended to do before killing it.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#12026 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-BWN91QcCeVLg-XGYwgk2FzaZFl7ks5uYAuhgaJpZM4WbBbG>
.
|
I hadn't heard of the "if there's no space after the hash it's commented out code" convention; I guess it could be a valuable one but we're already far from doing that in the rest of the codebase (yes, this PR makes things "worse" in that respect). |
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.
Marked some obviously stale commented code segments. There are probably more, but I didn't want to check all right now. Even without these, this is an improvement.
Technically it's better to check them now and remove them instead of reformatting them. Reformatting makes it harder to go back in history and find out why the code was commented in the first place.
@@ -600,11 +583,10 @@ def _select_locator(self, formatter): | |||
locator = ticker.MaxNLocator(nbins=5) | |||
else: | |||
b = self._boundaries[self._inside] | |||
locator = ticker.FixedLocator(b) #, nbins=10) | |||
locator = ticker.FixedLocator(b) # nbins=10) |
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.
This comment can be removed completely as it was just commented out code.
#self.transform_xy = transform_xy | ||
#self.inv_transform_xy = inv_transform_xy | ||
# self.transform_xy = transform_xy | ||
# self.inv_transform_xy = inv_transform_xy |
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.
Stale commented code. Should be removed.
c[self.nth_coord] = x | ||
|
||
# check if the tick point is inside axes | ||
c2 = tr2ax.transform_point(c) | ||
#delta=0.00001 | ||
# delta=0.00001 |
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.
Stale code comment?
super().__init__(grid_helper, nth_coord, value, axis_direction=side) | ||
#self.grid_helper = grid_helper | ||
# self.grid_helper = grid_helper |
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.
Stale code comment. Remove.
@@ -123,7 +116,7 @@ def transform_xy(x, y): | |||
xx0 = np.empty_like(yy0) | |||
xx0.fill(self.value) | |||
|
|||
#yy0_ = yy0.copy() | |||
# yy0_ = yy0.copy() |
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.
Stale code comment. Remove.
@@ -144,10 +137,9 @@ def transform_xy(x, y): | |||
yy0 = np.empty_like(xx0) | |||
yy0.fill(self.value) | |||
|
|||
#xx0_ = xx0.copy() | |||
# xx0_ = xx0.copy() |
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.
Stale code comment. Remove.
def adjust_axes_lim(self): | ||
|
||
#t = self.get_boundary() | ||
# t = self.get_boundary() |
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.
Stale code comment. Remove.
All cases you pointed out look reasonable (except perhaps FixedLocator(nbins=10) because who knows whether there was a real need to set nbins=10, OTOH that just seems unlikely), removed them all. |
I intentionally left in nearly all commented out dead code.
PR Summary
PR Checklist