mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 15:48:22 +00:00
Force parentheses for power operations in unary expressions (#7955)
## Summary E.g., given `-10**100`, reformat as `-(10**100)`. Black special cases this (https://github.com/psf/black/pull/909) and it's currently a deviation. Closes https://github.com/astral-sh/ruff/issues/7951.
This commit is contained in:
parent
b6e75e58c9
commit
3d03e75a9d
2 changed files with 10 additions and 12 deletions
|
@ -266,15 +266,6 @@ last_call()
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -31,7 +31,7 @@
|
||||
-1
|
||||
~int and not v1 ^ 123 + v2 | True
|
||||
(~int) and (not ((v1 ^ (123 + v2)) | True))
|
||||
-+(really ** -(confusing ** ~(operator**-precedence)))
|
||||
++really ** -confusing ** ~operator**-precedence
|
||||
flags & ~select.EPOLLIN and waiters.write_task is not None
|
||||
lambda arg: None
|
||||
lambda a=True: a
|
||||
@@ -115,7 +115,7 @@
|
||||
arg,
|
||||
another,
|
||||
|
@ -322,7 +313,7 @@ not great
|
|||
-1
|
||||
~int and not v1 ^ 123 + v2 | True
|
||||
(~int) and (not ((v1 ^ (123 + v2)) | True))
|
||||
+really ** -confusing ** ~operator**-precedence
|
||||
+(really ** -(confusing ** ~(operator**-precedence)))
|
||||
flags & ~select.EPOLLIN and waiters.write_task is not None
|
||||
lambda arg: None
|
||||
lambda a=True: a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue