-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Regression: Unnecessary parens with unary minus operator #1041
Comments
Closed
Closed
JelleZijlstra
added a commit
to JelleZijlstra/black
that referenced
this issue
Oct 20, 2019
Merged
A few other examples, running master on a pre-Blackened codebase: - for y in range(-1, -im1.size[1] - 1, -1):
- for x in range(-1, -im1.size[0] - 1, -1):
+ for y in range(-1, -(im1.size[1]) - 1, -1):
+ for x in range(-1, -(im1.size[0]) - 1, -1): - angle = -math.radians(deg)
+ angle = -(math.radians(deg))
matrix = [
round(math.cos(angle), 15),
round(math.sin(angle), 15),
0.0,
- round(-math.sin(angle), 15),
+ round(-(math.sin(angle)), 15),
round(math.cos(angle), 15),
0.0,
0, - code, = struct.unpack_from("<I", block, 12)
+ (code,) = struct.unpack_from("<I", block, 12) - angle = -math.radians(angle)
+ angle = -(math.radians(angle))
matrix = [
round(math.cos(angle), 15),
round(math.sin(angle), 15),
0.0,
- round(-math.sin(angle), 15),
+ round(-(math.sin(angle)), 15), - dest[tag], = values
+ (dest[tag],) = values With some comment mangling: if self.magic == b"BLP1":
- # Only present for BLP1
- self._blp_encoding, = struct.unpack("<i", self.fp.read(4))
- self._blp_subtype, = struct.unpack("<i", self.fp.read(4))
+ (self._blp_encoding,) = struct.unpack( # Only present for BLP1
+ "<i", self.fp.read(4)
+ )
+ (self._blp_subtype,) = struct.unpack("<i", self.fp.read(4)) |
That last one looks like a separate regression. It doesn't make sense for Black to move that comment. |
Also, the tuple unpacking thing (your |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I noticed this change while testing Black master on our codebase:
Also (more justifiable):
I think the first example is a bug. A simpler repro:
The text was updated successfully, but these errors were encountered: