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
PEP8 fixes on backend_bases.py #1345
Conversation
return width, height, descent | ||
|
||
flags = self._text2path._get_hinting_flag() | ||
font = self._text2path._get_font(prop) | ||
size = prop.get_size_in_points() | ||
font.set_size(size, dpi) | ||
font.set_text(s, 0.0, flags=flags) # the width and height of unrotated string | ||
font.set_text( | ||
s, 0.0, flags=flags) # the width and height of unrotated string |
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 don't think it aids readability for a comment to cause an otherwise short statement to be split like this.
Alternatives: put the comment on a separate line (below, indented), or shorten the comment, e.g., "width, height of unrotated string".
Updated with a new patch. |
@@ -364,7 +369,8 @@ def _iter_collection(self, gc, master_transform, all_transforms, | |||
xo, yo = toffsets[i % Noffsets] | |||
if offset_position == 'data': | |||
if Ntransforms: | |||
transform = all_transforms[i % Ntransforms] + master_transform | |||
transform = all_transforms[ | |||
i % Ntransforms] + master_transform |
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 you should break this line at the +
.
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.
@NelleV I agree with @dmcdougall that this is a bad break; with parentheses you could follow his suggestion.
I'll have a think about those list comprehensions, but other than that I'm giving this my +1. |
Excellent! Thanks @NelleV. |
Affine2D().scale(1./self.figure.dpi)) | ||
bbox_inches1 = TransformedBbox( | ||
_bbox, | ||
Affine2D().scale(1. / self.figure.dpi)) | ||
|
||
bbox_inches = Bbox.union([bbox_inches, bbox_inches1]) |
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.
Suggestion:
trans = Affine2D().scale(1.0 / self.figure.dpi)
bbox_inches1 = TransformedBbox(_bbox, trans)
@efiring Thanks for your input on this. When you're happy, make it known. |
It's done |
@NelleV Cheers. The Hawaiians are sleeping at the moment, so we'll wait a little bit to get Eric's approval. |
path, transform = path_id | ||
transform = transforms.Affine2D(transform.get_matrix()).translate(xo, yo) | ||
transform = transforms.Affine2D( | ||
transform.get_matrix()).translate(xo, yo) |
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.
In all the examples like this, I would favor using more indentation for the second line, perhaps aligning it with the start of the RHS of the line above. This would make it more visually obvious that it is a continuation of the line above, not an independent line in a block.
'raw': 'Raw RGBA bitmap', | ||
'rgba': 'Raw RGBA bitmap', | ||
'svg': 'Scalable Vector Graphics', | ||
'svgz': 'Scalable Vector Graphics' | ||
} | ||
'svgz': 'Scalable Vector Graphics'} |
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.
Actually, I have found it to be better to end lists and dictionaries like this with the last element having a comma and putting the closing brace or bracket on its own line. This makes for fewer merge conflicts as it is easier for patch to handle any edits to such a list of things. Of course, that is merely my own opinion.
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.
That's sensible.
PEP8 fixes on backend_bases.py
Pep8 fixes on the module backend_bases