mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-01 12:25:10 +00:00
Ruff 2024.2 style (#9639)
This commit is contained in:
parent
0293908b71
commit
a6f32ddc5e
47 changed files with 835 additions and 2362 deletions
|
|
@ -0,0 +1,273 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/comments5.py
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
while True:
|
||||
if something.changed:
|
||||
do.stuff() # trailing comment
|
||||
# Comment belongs to the `if` block.
|
||||
# This one belongs to the `while` block.
|
||||
|
||||
# Should this one, too? I guess so.
|
||||
|
||||
# This one is properly standalone now.
|
||||
|
||||
for i in range(100):
|
||||
# first we do this
|
||||
if i % 33 == 0:
|
||||
break
|
||||
|
||||
# then we do this
|
||||
print(i)
|
||||
# and finally we loop around
|
||||
|
||||
with open(some_temp_file) as f:
|
||||
data = f.read()
|
||||
|
||||
try:
|
||||
with open(some_other_file) as w:
|
||||
w.write(data)
|
||||
|
||||
except OSError:
|
||||
print("problems")
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
# leading function comment
|
||||
def wat():
|
||||
...
|
||||
# trailing function comment
|
||||
|
||||
|
||||
# SECTION COMMENT
|
||||
|
||||
|
||||
# leading 1
|
||||
@deco1
|
||||
# leading 2
|
||||
@deco2(with_args=True)
|
||||
# leading 3
|
||||
@deco3
|
||||
def decorated1():
|
||||
...
|
||||
|
||||
|
||||
# leading 1
|
||||
@deco1
|
||||
# leading 2
|
||||
@deco2(with_args=True)
|
||||
# leading function comment
|
||||
def decorated1():
|
||||
...
|
||||
|
||||
|
||||
# Note: this is fixed in
|
||||
# Preview.empty_lines_before_class_or_def_with_leading_comments.
|
||||
# In the current style, the user will have to split those lines by hand.
|
||||
some_instruction
|
||||
|
||||
|
||||
# This comment should be split from `some_instruction` by two lines but isn't.
|
||||
def g():
|
||||
...
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -45,8 +45,7 @@
|
||||
@deco2(with_args=True)
|
||||
# leading 3
|
||||
@deco3
|
||||
-def decorated1():
|
||||
- ...
|
||||
+def decorated1(): ...
|
||||
|
||||
|
||||
# leading 1
|
||||
@@ -54,8 +53,7 @@
|
||||
# leading 2
|
||||
@deco2(with_args=True)
|
||||
# leading function comment
|
||||
-def decorated1():
|
||||
- ...
|
||||
+def decorated1(): ...
|
||||
|
||||
|
||||
# Note: this is fixed in
|
||||
@@ -65,8 +63,7 @@
|
||||
|
||||
|
||||
# This comment should be split from `some_instruction` by two lines but isn't.
|
||||
-def g():
|
||||
- ...
|
||||
+def g(): ...
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
while True:
|
||||
if something.changed:
|
||||
do.stuff() # trailing comment
|
||||
# Comment belongs to the `if` block.
|
||||
# This one belongs to the `while` block.
|
||||
|
||||
# Should this one, too? I guess so.
|
||||
|
||||
# This one is properly standalone now.
|
||||
|
||||
for i in range(100):
|
||||
# first we do this
|
||||
if i % 33 == 0:
|
||||
break
|
||||
|
||||
# then we do this
|
||||
print(i)
|
||||
# and finally we loop around
|
||||
|
||||
with open(some_temp_file) as f:
|
||||
data = f.read()
|
||||
|
||||
try:
|
||||
with open(some_other_file) as w:
|
||||
w.write(data)
|
||||
|
||||
except OSError:
|
||||
print("problems")
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
# leading function comment
|
||||
def wat():
|
||||
...
|
||||
# trailing function comment
|
||||
|
||||
|
||||
# SECTION COMMENT
|
||||
|
||||
|
||||
# leading 1
|
||||
@deco1
|
||||
# leading 2
|
||||
@deco2(with_args=True)
|
||||
# leading 3
|
||||
@deco3
|
||||
def decorated1(): ...
|
||||
|
||||
|
||||
# leading 1
|
||||
@deco1
|
||||
# leading 2
|
||||
@deco2(with_args=True)
|
||||
# leading function comment
|
||||
def decorated1(): ...
|
||||
|
||||
|
||||
# Note: this is fixed in
|
||||
# Preview.empty_lines_before_class_or_def_with_leading_comments.
|
||||
# In the current style, the user will have to split those lines by hand.
|
||||
some_instruction
|
||||
|
||||
|
||||
# This comment should be split from `some_instruction` by two lines but isn't.
|
||||
def g(): ...
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
while True:
|
||||
if something.changed:
|
||||
do.stuff() # trailing comment
|
||||
# Comment belongs to the `if` block.
|
||||
# This one belongs to the `while` block.
|
||||
|
||||
# Should this one, too? I guess so.
|
||||
|
||||
# This one is properly standalone now.
|
||||
|
||||
for i in range(100):
|
||||
# first we do this
|
||||
if i % 33 == 0:
|
||||
break
|
||||
|
||||
# then we do this
|
||||
print(i)
|
||||
# and finally we loop around
|
||||
|
||||
with open(some_temp_file) as f:
|
||||
data = f.read()
|
||||
|
||||
try:
|
||||
with open(some_other_file) as w:
|
||||
w.write(data)
|
||||
|
||||
except OSError:
|
||||
print("problems")
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
# leading function comment
|
||||
def wat():
|
||||
...
|
||||
# trailing function comment
|
||||
|
||||
|
||||
# SECTION COMMENT
|
||||
|
||||
|
||||
# leading 1
|
||||
@deco1
|
||||
# leading 2
|
||||
@deco2(with_args=True)
|
||||
# leading 3
|
||||
@deco3
|
||||
def decorated1():
|
||||
...
|
||||
|
||||
|
||||
# leading 1
|
||||
@deco1
|
||||
# leading 2
|
||||
@deco2(with_args=True)
|
||||
# leading function comment
|
||||
def decorated1():
|
||||
...
|
||||
|
||||
|
||||
# Note: this is fixed in
|
||||
# Preview.empty_lines_before_class_or_def_with_leading_comments.
|
||||
# In the current style, the user will have to split those lines by hand.
|
||||
some_instruction
|
||||
|
||||
|
||||
# This comment should be split from `some_instruction` by two lines but isn't.
|
||||
def g():
|
||||
...
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
```
|
||||
|
||||
|
||||
|
|
@ -206,7 +206,19 @@ d={'a':1,
|
|||
# fmt: off
|
||||
from third_party import (X,
|
||||
Y, Z)
|
||||
@@ -63,15 +64,15 @@
|
||||
@@ -53,25 +54,21 @@
|
||||
g: int = 1 if False else 2,
|
||||
h: str = "",
|
||||
i: str = r"",
|
||||
-):
|
||||
- ...
|
||||
-
|
||||
-
|
||||
-def spaces2(result=_core.Value(None)):
|
||||
- ...
|
||||
+): ...
|
||||
+def spaces2(result=_core.Value(None)): ...
|
||||
|
||||
|
||||
something = {
|
||||
# fmt: off
|
||||
|
|
@ -225,7 +237,7 @@ d={'a':1,
|
|||
# fmt: on
|
||||
goes + here,
|
||||
andhere,
|
||||
@@ -122,8 +123,10 @@
|
||||
@@ -122,8 +119,10 @@
|
||||
"""
|
||||
# fmt: off
|
||||
|
||||
|
|
@ -237,7 +249,7 @@ d={'a':1,
|
|||
# fmt: on
|
||||
pass
|
||||
|
||||
@@ -138,7 +141,7 @@
|
||||
@@ -138,7 +137,7 @@
|
||||
now . considers . multiple . fmt . directives . within . one . prefix
|
||||
# fmt: on
|
||||
# fmt: off
|
||||
|
|
@ -246,7 +258,7 @@ d={'a':1,
|
|||
# fmt: on
|
||||
|
||||
|
||||
@@ -178,14 +181,18 @@
|
||||
@@ -178,14 +177,18 @@
|
||||
$
|
||||
""",
|
||||
# fmt: off
|
||||
|
|
@ -328,12 +340,8 @@ def spaces_types(
|
|||
g: int = 1 if False else 2,
|
||||
h: str = "",
|
||||
i: str = r"",
|
||||
):
|
||||
...
|
||||
|
||||
|
||||
def spaces2(result=_core.Value(None)):
|
||||
...
|
||||
): ...
|
||||
def spaces2(result=_core.Value(None)): ...
|
||||
|
||||
|
||||
something = {
|
||||
|
|
|
|||
|
|
@ -110,7 +110,17 @@ elif unformatted:
|
|||
},
|
||||
)
|
||||
|
||||
@@ -82,6 +81,6 @@
|
||||
@@ -72,8 +71,7 @@
|
||||
|
||||
|
||||
class Factory(t.Protocol):
|
||||
- def this_will_be_formatted(self, **kwargs) -> Named:
|
||||
- ...
|
||||
+ def this_will_be_formatted(self, **kwargs) -> Named: ...
|
||||
|
||||
# fmt: on
|
||||
|
||||
@@ -82,6 +80,6 @@
|
||||
if x:
|
||||
return x
|
||||
# fmt: off
|
||||
|
|
@ -196,8 +206,7 @@ class Named(t.Protocol):
|
|||
|
||||
|
||||
class Factory(t.Protocol):
|
||||
def this_will_be_formatted(self, **kwargs) -> Named:
|
||||
...
|
||||
def this_will_be_formatted(self, **kwargs) -> Named: ...
|
||||
|
||||
# fmt: on
|
||||
|
||||
|
|
|
|||
|
|
@ -107,8 +107,15 @@ def __await__(): return (yield)
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -65,6 +65,7 @@
|
||||
|
||||
@@ -59,12 +59,10 @@
|
||||
g: int = 1 if False else 2,
|
||||
h: str = "",
|
||||
i: str = r"",
|
||||
-):
|
||||
- ...
|
||||
-
|
||||
-
|
||||
+): ...
|
||||
def spaces2(result=_core.Value(None)):
|
||||
assert fut is self._read_fut, (fut, self._read_fut)
|
||||
+ # EMPTY LINE WITH WHITESPACE (this comment will be removed)
|
||||
|
|
@ -181,10 +188,7 @@ def spaces_types(
|
|||
g: int = 1 if False else 2,
|
||||
h: str = "",
|
||||
i: str = r"",
|
||||
):
|
||||
...
|
||||
|
||||
|
||||
): ...
|
||||
def spaces2(result=_core.Value(None)):
|
||||
assert fut is self._read_fut, (fut, self._read_fut)
|
||||
# EMPTY LINE WITH WHITESPACE (this comment will be removed)
|
||||
|
|
|
|||
|
|
@ -320,6 +320,19 @@ long_unmergable_string_with_pragma = (
|
|||
"formatting"
|
||||
)
|
||||
|
||||
@@ -255,9 +251,9 @@
|
||||
+ "using the '+' operator."
|
||||
)
|
||||
annotated_variable: Final = "This is a large string that has a type annotation attached to it. A type annotation should NOT stop a long string from being wrapped."
|
||||
-annotated_variable: Literal[
|
||||
- "fakse_literal"
|
||||
-] = "This is a large string that has a type annotation attached to it. A type annotation should NOT stop a long string from being wrapped."
|
||||
+annotated_variable: Literal["fakse_literal"] = (
|
||||
+ "This is a large string that has a type annotation attached to it. A type annotation should NOT stop a long string from being wrapped."
|
||||
+)
|
||||
|
||||
backslashes = "This is a really long string with \"embedded\" double quotes and 'single' quotes that also handles checking for an even number of backslashes \\"
|
||||
backslashes = "This is a really long string with \"embedded\" double quotes and 'single' quotes that also handles checking for an even number of backslashes \\\\"
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
|
@ -578,9 +591,9 @@ annotated_variable: Final = (
|
|||
+ "using the '+' operator."
|
||||
)
|
||||
annotated_variable: Final = "This is a large string that has a type annotation attached to it. A type annotation should NOT stop a long string from being wrapped."
|
||||
annotated_variable: Literal[
|
||||
"fakse_literal"
|
||||
] = "This is a large string that has a type annotation attached to it. A type annotation should NOT stop a long string from being wrapped."
|
||||
annotated_variable: Literal["fakse_literal"] = (
|
||||
"This is a large string that has a type annotation attached to it. A type annotation should NOT stop a long string from being wrapped."
|
||||
)
|
||||
|
||||
backslashes = "This is a really long string with \"embedded\" double quotes and 'single' quotes that also handles checking for an even number of backslashes \\"
|
||||
backslashes = "This is a really long string with \"embedded\" double quotes and 'single' quotes that also handles checking for an even number of backslashes \\\\"
|
||||
|
|
|
|||
|
|
@ -81,7 +81,20 @@ async def await_the_walrus():
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -34,7 +34,7 @@
|
||||
@@ -23,18 +23,16 @@
|
||||
foo(x=(y := f(x)))
|
||||
|
||||
|
||||
-def foo(answer=(p := 42)):
|
||||
- ...
|
||||
+def foo(answer=(p := 42)): ...
|
||||
|
||||
|
||||
-def foo2(answer: (p := 42) = 5):
|
||||
- ...
|
||||
+def foo2(answer: (p := 42) = 5): ...
|
||||
|
||||
|
||||
lambda: (x := 1)
|
||||
|
||||
a[(x := 12)]
|
||||
|
|
@ -120,12 +133,10 @@ assert (foo := 42 - 12)
|
|||
foo(x=(y := f(x)))
|
||||
|
||||
|
||||
def foo(answer=(p := 42)):
|
||||
...
|
||||
def foo(answer=(p := 42)): ...
|
||||
|
||||
|
||||
def foo2(answer: (p := 42) = 5):
|
||||
...
|
||||
def foo2(answer: (p := 42) = 5): ...
|
||||
|
||||
|
||||
lambda: (x := 1)
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/power_op_newline.py
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
importA;()<<0**0#
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -2,5 +2,5 @@
|
||||
(
|
||||
()
|
||||
<< 0
|
||||
- ** 0
|
||||
+ **0
|
||||
) #
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
importA
|
||||
(
|
||||
()
|
||||
<< 0
|
||||
**0
|
||||
) #
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
importA
|
||||
(
|
||||
()
|
||||
<< 0
|
||||
** 0
|
||||
) #
|
||||
```
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/python39.py
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
@relaxed_decorator[0]
|
||||
def f():
|
||||
...
|
||||
|
||||
@relaxed_decorator[extremely_long_name_that_definitely_will_not_fit_on_one_line_of_standard_length]
|
||||
def f():
|
||||
...
|
||||
|
||||
@extremely_long_variable_name_that_doesnt_fit := complex.expression(with_long="arguments_value_that_wont_fit_at_the_end_of_the_line")
|
||||
def f():
|
||||
...
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,17 +1,14 @@
|
||||
@relaxed_decorator[0]
|
||||
-def f():
|
||||
- ...
|
||||
+def f(): ...
|
||||
|
||||
|
||||
@relaxed_decorator[
|
||||
extremely_long_name_that_definitely_will_not_fit_on_one_line_of_standard_length
|
||||
]
|
||||
-def f():
|
||||
- ...
|
||||
+def f(): ...
|
||||
|
||||
|
||||
@extremely_long_variable_name_that_doesnt_fit := complex.expression(
|
||||
with_long="arguments_value_that_wont_fit_at_the_end_of_the_line"
|
||||
)
|
||||
-def f():
|
||||
- ...
|
||||
+def f(): ...
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
@relaxed_decorator[0]
|
||||
def f(): ...
|
||||
|
||||
|
||||
@relaxed_decorator[
|
||||
extremely_long_name_that_definitely_will_not_fit_on_one_line_of_standard_length
|
||||
]
|
||||
def f(): ...
|
||||
|
||||
|
||||
@extremely_long_variable_name_that_doesnt_fit := complex.expression(
|
||||
with_long="arguments_value_that_wont_fit_at_the_end_of_the_line"
|
||||
)
|
||||
def f(): ...
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
@relaxed_decorator[0]
|
||||
def f():
|
||||
...
|
||||
|
||||
|
||||
@relaxed_decorator[
|
||||
extremely_long_name_that_definitely_will_not_fit_on_one_line_of_standard_length
|
||||
]
|
||||
def f():
|
||||
...
|
||||
|
||||
|
||||
@extremely_long_variable_name_that_doesnt_fit := complex.expression(
|
||||
with_long="arguments_value_that_wont_fit_at_the_end_of_the_line"
|
||||
)
|
||||
def f():
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
|
|
@ -87,39 +87,7 @@ class Conditional:
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -24,31 +24,24 @@
|
||||
if sys.version_info >= (3, 8):
|
||||
class E:
|
||||
def f(self): ...
|
||||
-
|
||||
class F:
|
||||
def f(self): ...
|
||||
-
|
||||
class G: ...
|
||||
class H: ...
|
||||
-
|
||||
else:
|
||||
class I: ...
|
||||
class J: ...
|
||||
-
|
||||
def f(): ...
|
||||
|
||||
class K:
|
||||
def f(self): ...
|
||||
-
|
||||
def f(): ...
|
||||
|
||||
class Nested:
|
||||
class dirty: ...
|
||||
class little: ...
|
||||
-
|
||||
class secret:
|
||||
def who_has_to_know(self): ...
|
||||
-
|
||||
def verse(self): ...
|
||||
|
||||
class Conditional:
|
||||
@@ -57,17 +50,14 @@
|
||||
@@ -57,12 +57,10 @@
|
||||
def g(self): ...
|
||||
else:
|
||||
def g(self): ...
|
||||
|
|
@ -132,11 +100,6 @@ class Conditional:
|
|||
def k(self): ...
|
||||
if sys.version_info >= (3, 8):
|
||||
class A: ...
|
||||
class B: ...
|
||||
-
|
||||
class C:
|
||||
def l(self): ...
|
||||
def m(self): ...
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
|
@ -168,24 +131,31 @@ def h(): ...
|
|||
if sys.version_info >= (3, 8):
|
||||
class E:
|
||||
def f(self): ...
|
||||
|
||||
class F:
|
||||
def f(self): ...
|
||||
|
||||
class G: ...
|
||||
class H: ...
|
||||
|
||||
else:
|
||||
class I: ...
|
||||
class J: ...
|
||||
|
||||
def f(): ...
|
||||
|
||||
class K:
|
||||
def f(self): ...
|
||||
|
||||
def f(): ...
|
||||
|
||||
class Nested:
|
||||
class dirty: ...
|
||||
class little: ...
|
||||
|
||||
class secret:
|
||||
def who_has_to_know(self): ...
|
||||
|
||||
def verse(self): ...
|
||||
|
||||
class Conditional:
|
||||
|
|
@ -202,6 +172,7 @@ class Conditional:
|
|||
if sys.version_info >= (3, 8):
|
||||
class A: ...
|
||||
class B: ...
|
||||
|
||||
class C:
|
||||
def l(self): ...
|
||||
def m(self): ...
|
||||
|
|
|
|||
|
|
@ -41,15 +41,6 @@ assert (
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -2,7 +2,7 @@
|
||||
(
|
||||
()
|
||||
<< 0
|
||||
- ** 101234234242352525425252352352525234890264906820496920680926538059059209922523523525
|
||||
+ **101234234242352525425252352352525234890264906820496920680926538059059209922523523525
|
||||
) #
|
||||
|
||||
assert sort_by_dependency(
|
||||
@@ -25,9 +25,9 @@
|
||||
class A:
|
||||
def foo(self):
|
||||
|
|
@ -71,7 +62,7 @@ importA
|
|||
(
|
||||
()
|
||||
<< 0
|
||||
**101234234242352525425252352352525234890264906820496920680926538059059209922523523525
|
||||
** 101234234242352525425252352352525234890264906820496920680926538059059209922523523525
|
||||
) #
|
||||
|
||||
assert sort_by_dependency(
|
||||
|
|
|
|||
|
|
@ -42,77 +42,52 @@ def eggs() -> Union[str, int]: ...
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,32 +1,58 @@
|
||||
@@ -1,32 +1,45 @@
|
||||
from typing import Union
|
||||
|
||||
+
|
||||
@bird
|
||||
-def zoo(): ...
|
||||
+def zoo():
|
||||
+ ...
|
||||
def zoo(): ...
|
||||
|
||||
-class A: ...
|
||||
|
||||
+class A:
|
||||
+ ...
|
||||
+
|
||||
class A: ...
|
||||
|
||||
+
|
||||
@bar
|
||||
class B:
|
||||
- def BMethod(self) -> None: ...
|
||||
+ def BMethod(self) -> None:
|
||||
+ ...
|
||||
+
|
||||
def BMethod(self) -> None: ...
|
||||
@overload
|
||||
- def BMethod(self, arg: List[str]) -> None: ...
|
||||
+ def BMethod(self, arg: List[str]) -> None:
|
||||
+ ...
|
||||
+
|
||||
+
|
||||
+class C:
|
||||
+ ...
|
||||
def BMethod(self, arg: List[str]) -> None: ...
|
||||
|
||||
-class C: ...
|
||||
+
|
||||
class C: ...
|
||||
|
||||
+
|
||||
@hmm
|
||||
-class D: ...
|
||||
+class D:
|
||||
+ ...
|
||||
+
|
||||
+
|
||||
+class E:
|
||||
+ ...
|
||||
class D: ...
|
||||
|
||||
-class E: ...
|
||||
+
|
||||
class E: ...
|
||||
|
||||
+
|
||||
@baz
|
||||
-def foo() -> None: ...
|
||||
+def foo() -> None:
|
||||
+ ...
|
||||
def foo() -> None: ...
|
||||
|
||||
-class F(A, C): ...
|
||||
+
|
||||
class F(A, C): ...
|
||||
|
||||
-def spam() -> None: ...
|
||||
+class F(A, C):
|
||||
+ ...
|
||||
+
|
||||
+
|
||||
+def spam() -> None:
|
||||
+ ...
|
||||
def spam() -> None: ...
|
||||
+
|
||||
+
|
||||
@overload
|
||||
-def spam(arg: str) -> str: ...
|
||||
+def spam(arg: str) -> str:
|
||||
+ ...
|
||||
+
|
||||
def spam(arg: str) -> str: ...
|
||||
|
||||
+
|
||||
var: int = 1
|
||||
|
||||
-def eggs() -> Union[str, int]: ...
|
||||
+
|
||||
+def eggs() -> Union[str, int]:
|
||||
+ ...
|
||||
def eggs() -> Union[str, int]: ...
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
|
@ -122,60 +97,47 @@ from typing import Union
|
|||
|
||||
|
||||
@bird
|
||||
def zoo():
|
||||
...
|
||||
def zoo(): ...
|
||||
|
||||
|
||||
class A:
|
||||
...
|
||||
class A: ...
|
||||
|
||||
|
||||
@bar
|
||||
class B:
|
||||
def BMethod(self) -> None:
|
||||
...
|
||||
|
||||
def BMethod(self) -> None: ...
|
||||
@overload
|
||||
def BMethod(self, arg: List[str]) -> None:
|
||||
...
|
||||
def BMethod(self, arg: List[str]) -> None: ...
|
||||
|
||||
|
||||
class C:
|
||||
...
|
||||
class C: ...
|
||||
|
||||
|
||||
@hmm
|
||||
class D:
|
||||
...
|
||||
class D: ...
|
||||
|
||||
|
||||
class E:
|
||||
...
|
||||
class E: ...
|
||||
|
||||
|
||||
@baz
|
||||
def foo() -> None:
|
||||
...
|
||||
def foo() -> None: ...
|
||||
|
||||
|
||||
class F(A, C):
|
||||
...
|
||||
class F(A, C): ...
|
||||
|
||||
|
||||
def spam() -> None:
|
||||
...
|
||||
def spam() -> None: ...
|
||||
|
||||
|
||||
@overload
|
||||
def spam(arg: str) -> str:
|
||||
...
|
||||
def spam(arg: str) -> str: ...
|
||||
|
||||
|
||||
var: int = 1
|
||||
|
||||
|
||||
def eggs() -> Union[str, int]:
|
||||
...
|
||||
def eggs() -> Union[str, int]: ...
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
|||
|
|
@ -1,128 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/miscellaneous/force_pyi.pyi
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
from typing import Union
|
||||
|
||||
@bird
|
||||
def zoo(): ...
|
||||
|
||||
class A: ...
|
||||
@bar
|
||||
class B:
|
||||
def BMethod(self) -> None: ...
|
||||
@overload
|
||||
def BMethod(self, arg : List[str]) -> None: ...
|
||||
|
||||
class C: ...
|
||||
@hmm
|
||||
class D: ...
|
||||
class E: ...
|
||||
|
||||
@baz
|
||||
def foo() -> None:
|
||||
...
|
||||
|
||||
class F (A , C): ...
|
||||
def spam() -> None: ...
|
||||
|
||||
@overload
|
||||
def spam(arg: str) -> str: ...
|
||||
|
||||
var : int = 1
|
||||
|
||||
def eggs() -> Union[str, int]: ...
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
@hmm
|
||||
class D: ...
|
||||
-
|
||||
class E: ...
|
||||
|
||||
@baz
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
from typing import Union
|
||||
|
||||
@bird
|
||||
def zoo(): ...
|
||||
|
||||
class A: ...
|
||||
|
||||
@bar
|
||||
class B:
|
||||
def BMethod(self) -> None: ...
|
||||
@overload
|
||||
def BMethod(self, arg: List[str]) -> None: ...
|
||||
|
||||
class C: ...
|
||||
|
||||
@hmm
|
||||
class D: ...
|
||||
class E: ...
|
||||
|
||||
@baz
|
||||
def foo() -> None: ...
|
||||
|
||||
class F(A, C): ...
|
||||
|
||||
def spam() -> None: ...
|
||||
@overload
|
||||
def spam(arg: str) -> str: ...
|
||||
|
||||
var: int = 1
|
||||
|
||||
def eggs() -> Union[str, int]: ...
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
from typing import Union
|
||||
|
||||
@bird
|
||||
def zoo(): ...
|
||||
|
||||
class A: ...
|
||||
|
||||
@bar
|
||||
class B:
|
||||
def BMethod(self) -> None: ...
|
||||
@overload
|
||||
def BMethod(self, arg: List[str]) -> None: ...
|
||||
|
||||
class C: ...
|
||||
|
||||
@hmm
|
||||
class D: ...
|
||||
|
||||
class E: ...
|
||||
|
||||
@baz
|
||||
def foo() -> None: ...
|
||||
|
||||
class F(A, C): ...
|
||||
|
||||
def spam() -> None: ...
|
||||
@overload
|
||||
def spam(arg: str) -> str: ...
|
||||
|
||||
var: int = 1
|
||||
|
||||
def eggs() -> Union[str, int]: ...
|
||||
```
|
||||
|
||||
|
||||
|
|
@ -28,24 +28,20 @@ class UpperCaseR:
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,4 +1,6 @@
|
||||
@@ -1,3 +1,4 @@
|
||||
+# flags: --preview --skip-string-normalization
|
||||
class C:
|
||||
+
|
||||
r"""Raw"""
|
||||
|
||||
|
||||
@@ -7,8 +9,9 @@
|
||||
@@ -7,7 +8,7 @@
|
||||
|
||||
|
||||
class SingleQuotes:
|
||||
- r'''Raw'''
|
||||
|
||||
+ r"""Raw"""
|
||||
+
|
||||
|
||||
|
||||
class UpperCaseR:
|
||||
R"""Raw"""
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
|
@ -53,7 +49,6 @@ class UpperCaseR:
|
|||
```python
|
||||
# flags: --preview --skip-string-normalization
|
||||
class C:
|
||||
|
||||
r"""Raw"""
|
||||
|
||||
|
||||
|
|
@ -62,7 +57,6 @@ def f():
|
|||
|
||||
|
||||
class SingleQuotes:
|
||||
|
||||
r"""Raw"""
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7343,10 +7343,8 @@ def rst_literal_subsequent_line_not_indented():
|
|||
Do cool stuff::
|
||||
|
||||
if True:
|
||||
cool_stuff(
|
||||
'''
|
||||
hiya'''
|
||||
)
|
||||
cool_stuff('''
|
||||
hiya''')
|
||||
|
||||
Done.
|
||||
"""
|
||||
|
|
@ -7821,13 +7819,11 @@ def markdown_nested_fences():
|
|||
Do cool stuff.
|
||||
|
||||
``````
|
||||
do_something(
|
||||
'''
|
||||
do_something('''
|
||||
```
|
||||
did i trick you?
|
||||
```
|
||||
'''
|
||||
)
|
||||
''')
|
||||
``````
|
||||
|
||||
Done.
|
||||
|
|
@ -8214,42 +8210,6 @@ def markdown_skipped_rst_directive():
|
|||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -480,10 +480,8 @@
|
||||
Do cool stuff::
|
||||
|
||||
if True:
|
||||
- cool_stuff(
|
||||
- '''
|
||||
- hiya'''
|
||||
- )
|
||||
+ cool_stuff('''
|
||||
+ hiya''')
|
||||
|
||||
Done.
|
||||
"""
|
||||
@@ -958,13 +956,11 @@
|
||||
Do cool stuff.
|
||||
|
||||
``````
|
||||
- do_something(
|
||||
- '''
|
||||
+ do_something('''
|
||||
```
|
||||
did i trick you?
|
||||
```
|
||||
- '''
|
||||
- )
|
||||
+ ''')
|
||||
``````
|
||||
|
||||
Done.
|
||||
```
|
||||
|
||||
|
||||
### Output 6
|
||||
```
|
||||
indent-style = space
|
||||
|
|
@ -8748,10 +8708,8 @@ def rst_literal_subsequent_line_not_indented():
|
|||
Do cool stuff::
|
||||
|
||||
if True:
|
||||
cool_stuff(
|
||||
'''
|
||||
hiya'''
|
||||
)
|
||||
cool_stuff('''
|
||||
hiya''')
|
||||
|
||||
Done.
|
||||
"""
|
||||
|
|
@ -9226,13 +9184,11 @@ def markdown_nested_fences():
|
|||
Do cool stuff.
|
||||
|
||||
``````
|
||||
do_something(
|
||||
'''
|
||||
do_something('''
|
||||
```
|
||||
did i trick you?
|
||||
```
|
||||
'''
|
||||
)
|
||||
''')
|
||||
``````
|
||||
|
||||
Done.
|
||||
|
|
@ -9619,42 +9575,6 @@ def markdown_skipped_rst_directive():
|
|||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -480,10 +480,8 @@
|
||||
Do cool stuff::
|
||||
|
||||
if True:
|
||||
- cool_stuff(
|
||||
- '''
|
||||
- hiya'''
|
||||
- )
|
||||
+ cool_stuff('''
|
||||
+ hiya''')
|
||||
|
||||
Done.
|
||||
"""
|
||||
@@ -958,13 +956,11 @@
|
||||
Do cool stuff.
|
||||
|
||||
``````
|
||||
- do_something(
|
||||
- '''
|
||||
+ do_something('''
|
||||
```
|
||||
did i trick you?
|
||||
```
|
||||
- '''
|
||||
- )
|
||||
+ ''')
|
||||
``````
|
||||
|
||||
Done.
|
||||
```
|
||||
|
||||
|
||||
### Output 7
|
||||
```
|
||||
indent-style = tab
|
||||
|
|
@ -10162,10 +10082,8 @@ def rst_literal_subsequent_line_not_indented():
|
|||
Do cool stuff::
|
||||
|
||||
if True:
|
||||
cool_stuff(
|
||||
'''
|
||||
hiya'''
|
||||
)
|
||||
cool_stuff('''
|
||||
hiya''')
|
||||
|
||||
Done.
|
||||
"""
|
||||
|
|
@ -10640,13 +10558,11 @@ def markdown_nested_fences():
|
|||
Do cool stuff.
|
||||
|
||||
``````
|
||||
do_something(
|
||||
'''
|
||||
do_something('''
|
||||
```
|
||||
did i trick you?
|
||||
```
|
||||
'''
|
||||
)
|
||||
''')
|
||||
``````
|
||||
|
||||
Done.
|
||||
|
|
@ -11033,42 +10949,6 @@ def markdown_skipped_rst_directive():
|
|||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -489,10 +489,8 @@
|
||||
Do cool stuff::
|
||||
|
||||
if True:
|
||||
- cool_stuff(
|
||||
- '''
|
||||
- hiya'''
|
||||
- )
|
||||
+ cool_stuff('''
|
||||
+ hiya''')
|
||||
|
||||
Done.
|
||||
"""
|
||||
@@ -967,13 +965,11 @@
|
||||
Do cool stuff.
|
||||
|
||||
``````
|
||||
- do_something(
|
||||
- '''
|
||||
+ do_something('''
|
||||
```
|
||||
did i trick you?
|
||||
```
|
||||
- '''
|
||||
- )
|
||||
+ ''')
|
||||
``````
|
||||
|
||||
Done.
|
||||
```
|
||||
|
||||
|
||||
### Output 8
|
||||
```
|
||||
indent-style = tab
|
||||
|
|
@ -11567,10 +11447,8 @@ def rst_literal_subsequent_line_not_indented():
|
|||
Do cool stuff::
|
||||
|
||||
if True:
|
||||
cool_stuff(
|
||||
'''
|
||||
hiya'''
|
||||
)
|
||||
cool_stuff('''
|
||||
hiya''')
|
||||
|
||||
Done.
|
||||
"""
|
||||
|
|
@ -12045,13 +11923,11 @@ def markdown_nested_fences():
|
|||
Do cool stuff.
|
||||
|
||||
``````
|
||||
do_something(
|
||||
'''
|
||||
do_something('''
|
||||
```
|
||||
did i trick you?
|
||||
```
|
||||
'''
|
||||
)
|
||||
''')
|
||||
``````
|
||||
|
||||
Done.
|
||||
|
|
@ -12438,42 +12314,6 @@ def markdown_skipped_rst_directive():
|
|||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -480,10 +480,8 @@
|
||||
Do cool stuff::
|
||||
|
||||
if True:
|
||||
- cool_stuff(
|
||||
- '''
|
||||
- hiya'''
|
||||
- )
|
||||
+ cool_stuff('''
|
||||
+ hiya''')
|
||||
|
||||
Done.
|
||||
"""
|
||||
@@ -958,13 +956,11 @@
|
||||
Do cool stuff.
|
||||
|
||||
``````
|
||||
- do_something(
|
||||
- '''
|
||||
+ do_something('''
|
||||
```
|
||||
did i trick you?
|
||||
```
|
||||
- '''
|
||||
- )
|
||||
+ ''')
|
||||
``````
|
||||
|
||||
Done.
|
||||
```
|
||||
|
||||
|
||||
### Output 9
|
||||
```
|
||||
indent-style = space
|
||||
|
|
@ -12981,10 +12821,8 @@ def rst_literal_subsequent_line_not_indented():
|
|||
Do cool stuff::
|
||||
|
||||
if True:
|
||||
cool_stuff(
|
||||
'''
|
||||
hiya'''
|
||||
)
|
||||
cool_stuff('''
|
||||
hiya''')
|
||||
|
||||
Done.
|
||||
"""
|
||||
|
|
@ -13459,13 +13297,11 @@ def markdown_nested_fences():
|
|||
Do cool stuff.
|
||||
|
||||
``````
|
||||
do_something(
|
||||
'''
|
||||
do_something('''
|
||||
```
|
||||
did i trick you?
|
||||
```
|
||||
'''
|
||||
)
|
||||
''')
|
||||
``````
|
||||
|
||||
Done.
|
||||
|
|
@ -13852,42 +13688,6 @@ def markdown_skipped_rst_directive():
|
|||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -489,10 +489,8 @@
|
||||
Do cool stuff::
|
||||
|
||||
if True:
|
||||
- cool_stuff(
|
||||
- '''
|
||||
- hiya'''
|
||||
- )
|
||||
+ cool_stuff('''
|
||||
+ hiya''')
|
||||
|
||||
Done.
|
||||
"""
|
||||
@@ -967,13 +965,11 @@
|
||||
Do cool stuff.
|
||||
|
||||
``````
|
||||
- do_something(
|
||||
- '''
|
||||
+ do_something('''
|
||||
```
|
||||
did i trick you?
|
||||
```
|
||||
- '''
|
||||
- )
|
||||
+ ''')
|
||||
``````
|
||||
|
||||
Done.
|
||||
```
|
||||
|
||||
|
||||
### Output 10
|
||||
```
|
||||
indent-style = space
|
||||
|
|
@ -14386,10 +14186,8 @@ def rst_literal_subsequent_line_not_indented():
|
|||
Do cool stuff::
|
||||
|
||||
if True:
|
||||
cool_stuff(
|
||||
'''
|
||||
hiya'''
|
||||
)
|
||||
cool_stuff('''
|
||||
hiya''')
|
||||
|
||||
Done.
|
||||
"""
|
||||
|
|
@ -14864,13 +14662,11 @@ def markdown_nested_fences():
|
|||
Do cool stuff.
|
||||
|
||||
``````
|
||||
do_something(
|
||||
'''
|
||||
do_something('''
|
||||
```
|
||||
did i trick you?
|
||||
```
|
||||
'''
|
||||
)
|
||||
''')
|
||||
``````
|
||||
|
||||
Done.
|
||||
|
|
@ -15257,40 +15053,4 @@ def markdown_skipped_rst_directive():
|
|||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -480,10 +480,8 @@
|
||||
Do cool stuff::
|
||||
|
||||
if True:
|
||||
- cool_stuff(
|
||||
- '''
|
||||
- hiya'''
|
||||
- )
|
||||
+ cool_stuff('''
|
||||
+ hiya''')
|
||||
|
||||
Done.
|
||||
"""
|
||||
@@ -958,13 +956,11 @@
|
||||
Do cool stuff.
|
||||
|
||||
``````
|
||||
- do_something(
|
||||
- '''
|
||||
+ do_something('''
|
||||
```
|
||||
did i trick you?
|
||||
```
|
||||
- '''
|
||||
- )
|
||||
+ ''')
|
||||
``````
|
||||
|
||||
Done.
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -288,13 +288,13 @@ ____aaa = 1111111111111111111111111111111111111111111111111111111111111111111111
|
|||
## Breaking left
|
||||
|
||||
# Should break `[a]` first
|
||||
____[
|
||||
a
|
||||
] = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvv # c
|
||||
____[a] = (
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvv # c
|
||||
)
|
||||
|
||||
____[
|
||||
a
|
||||
] = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvv # cc
|
||||
____[a] = (
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvv # cc
|
||||
)
|
||||
|
||||
(
|
||||
# some weird comments
|
||||
|
|
@ -352,9 +352,9 @@ ____a: a = (
|
|||
# 89 characters parenthesized (collapse)
|
||||
____a: a = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvvv # c
|
||||
|
||||
_a: a[
|
||||
b
|
||||
] = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvvv # c
|
||||
_a: a[b] = (
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvvv # c
|
||||
)
|
||||
|
||||
## Augmented Assign
|
||||
|
||||
|
|
@ -421,44 +421,4 @@ def test6():
|
|||
```
|
||||
|
||||
|
||||
## Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -72,13 +72,13 @@
|
||||
## Breaking left
|
||||
|
||||
# Should break `[a]` first
|
||||
-____[
|
||||
- a
|
||||
-] = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvv # c
|
||||
+____[a] = (
|
||||
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvv # c
|
||||
+)
|
||||
|
||||
-____[
|
||||
- a
|
||||
-] = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvv # cc
|
||||
+____[a] = (
|
||||
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvv # cc
|
||||
+)
|
||||
|
||||
(
|
||||
# some weird comments
|
||||
@@ -136,9 +136,9 @@
|
||||
# 89 characters parenthesized (collapse)
|
||||
____a: a = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvvv # c
|
||||
|
||||
-_a: a[
|
||||
- b
|
||||
-] = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvvv # c
|
||||
+_a: a[b] = (
|
||||
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvvv # c
|
||||
+)
|
||||
|
||||
## Augmented Assign
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ source_type = Python
|
|||
|
||||
```python
|
||||
"' test"
|
||||
|
||||
'" test'
|
||||
|
||||
'" test'
|
||||
|
|
@ -323,34 +324,10 @@ x = (
|
|||
# https://github.com/astral-sh/ruff/issues/7460
|
||||
trailing_preferred_quote_texts = [''' "''', ''' ""''', ''' """''', ''' """"''']
|
||||
|
||||
a = f"""\x1F"""
|
||||
a = """\x1F"""
|
||||
a = f"""\x1f"""
|
||||
a = """\x1f"""
|
||||
a = """\\x1F"""
|
||||
a = """\\\x1F"""
|
||||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -1,4 +1,5 @@
|
||||
"' test"
|
||||
+
|
||||
'" test'
|
||||
|
||||
'" test'
|
||||
@@ -158,7 +159,7 @@
|
||||
# https://github.com/astral-sh/ruff/issues/7460
|
||||
trailing_preferred_quote_texts = [''' "''', ''' ""''', ''' """''', ''' """"''']
|
||||
|
||||
-a = f"""\x1F"""
|
||||
-a = """\x1F"""
|
||||
+a = f"""\x1f"""
|
||||
+a = """\x1f"""
|
||||
a = """\\x1F"""
|
||||
-a = """\\\x1F"""
|
||||
+a = """\\\x1f"""
|
||||
a = """\\\x1f"""
|
||||
```
|
||||
|
||||
|
||||
|
|
@ -371,6 +348,7 @@ source_type = Python
|
|||
|
||||
```python
|
||||
"' test"
|
||||
|
||||
'" test'
|
||||
|
||||
'" test'
|
||||
|
|
@ -530,34 +508,10 @@ x = (
|
|||
# https://github.com/astral-sh/ruff/issues/7460
|
||||
trailing_preferred_quote_texts = [''' "''', ''' ""''', ''' """''', ''' """"''']
|
||||
|
||||
a = f"""\x1F"""
|
||||
a = """\x1F"""
|
||||
a = f"""\x1f"""
|
||||
a = """\x1f"""
|
||||
a = """\\x1F"""
|
||||
a = """\\\x1F"""
|
||||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -1,4 +1,5 @@
|
||||
"' test"
|
||||
+
|
||||
'" test'
|
||||
|
||||
'" test'
|
||||
@@ -158,7 +159,7 @@
|
||||
# https://github.com/astral-sh/ruff/issues/7460
|
||||
trailing_preferred_quote_texts = [''' "''', ''' ""''', ''' """''', ''' """"''']
|
||||
|
||||
-a = f"""\x1F"""
|
||||
-a = """\x1F"""
|
||||
+a = f"""\x1f"""
|
||||
+a = """\x1f"""
|
||||
a = """\\x1F"""
|
||||
-a = """\\\x1F"""
|
||||
+a = """\\\x1f"""
|
||||
a = """\\\x1f"""
|
||||
```
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -71,8 +71,7 @@ b = 20
|
|||
|
||||
|
||||
# formatted
|
||||
def test2():
|
||||
...
|
||||
def test2(): ...
|
||||
|
||||
|
||||
a = 10
|
||||
|
|
@ -93,21 +92,4 @@ def test3 ():
|
|||
```
|
||||
|
||||
|
||||
## Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -21,8 +21,7 @@
|
||||
|
||||
|
||||
# formatted
|
||||
-def test2():
|
||||
- ...
|
||||
+def test2(): ...
|
||||
|
||||
|
||||
a = 10
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -84,14 +84,12 @@ call(
|
|||
|
||||
# Black applies the hugging recursively. We don't (consistent with the hugging style).
|
||||
path.write_text(
|
||||
textwrap.dedent(
|
||||
"""\
|
||||
textwrap.dedent("""\
|
||||
A triple-quoted string
|
||||
actually leveraging the textwrap.dedent functionality
|
||||
that ends in a trailing newline,
|
||||
representing e.g. file contents.
|
||||
"""
|
||||
)
|
||||
""")
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -109,28 +107,4 @@ generated_readme = (
|
|||
```
|
||||
|
||||
|
||||
## Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -31,14 +31,12 @@
|
||||
|
||||
# Black applies the hugging recursively. We don't (consistent with the hugging style).
|
||||
path.write_text(
|
||||
- textwrap.dedent(
|
||||
- """\
|
||||
+ textwrap.dedent("""\
|
||||
A triple-quoted string
|
||||
actually leveraging the textwrap.dedent functionality
|
||||
that ends in a trailing newline,
|
||||
representing e.g. file contents.
|
||||
-"""
|
||||
- )
|
||||
+""")
|
||||
)
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -530,13 +530,11 @@ print("below nested functions")
|
|||
class Path:
|
||||
if sys.version_info >= (3, 11):
|
||||
|
||||
def joinpath(self):
|
||||
...
|
||||
def joinpath(self): ...
|
||||
|
||||
# The .open method comes from pathlib.pyi and should be kept in sync.
|
||||
@overload
|
||||
def open(self):
|
||||
...
|
||||
def open(self): ...
|
||||
|
||||
|
||||
def fakehttp():
|
||||
|
|
@ -568,20 +566,14 @@ if True:
|
|||
pass
|
||||
|
||||
|
||||
def overload1():
|
||||
... # trailing comment
|
||||
def overload1(): ... # trailing comment
|
||||
def overload1(a: int): ...
|
||||
|
||||
|
||||
def overload1(a: int):
|
||||
...
|
||||
def overload2(): ... # trailing comment
|
||||
|
||||
|
||||
def overload2():
|
||||
... # trailing comment
|
||||
|
||||
|
||||
def overload2(a: int):
|
||||
...
|
||||
def overload2(a: int): ...
|
||||
|
||||
|
||||
def overload3():
|
||||
|
|
@ -589,8 +581,7 @@ def overload3():
|
|||
# trailing comment
|
||||
|
||||
|
||||
def overload3(a: int):
|
||||
...
|
||||
def overload3(a: int): ...
|
||||
|
||||
|
||||
def overload4():
|
||||
|
|
@ -598,73 +589,7 @@ def overload4():
|
|||
# trailing comment
|
||||
|
||||
|
||||
def overload4(a: int):
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
## Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -245,13 +245,11 @@
|
||||
class Path:
|
||||
if sys.version_info >= (3, 11):
|
||||
|
||||
- def joinpath(self):
|
||||
- ...
|
||||
+ def joinpath(self): ...
|
||||
|
||||
# The .open method comes from pathlib.pyi and should be kept in sync.
|
||||
@overload
|
||||
- def open(self):
|
||||
- ...
|
||||
+ def open(self): ...
|
||||
|
||||
|
||||
def fakehttp():
|
||||
@@ -283,20 +281,14 @@
|
||||
pass
|
||||
|
||||
|
||||
-def overload1():
|
||||
- ... # trailing comment
|
||||
+def overload1(): ... # trailing comment
|
||||
+def overload1(a: int): ...
|
||||
|
||||
|
||||
-def overload1(a: int):
|
||||
- ...
|
||||
+def overload2(): ... # trailing comment
|
||||
|
||||
|
||||
-def overload2():
|
||||
- ... # trailing comment
|
||||
-
|
||||
-
|
||||
-def overload2(a: int):
|
||||
- ...
|
||||
+def overload2(a: int): ...
|
||||
|
||||
|
||||
def overload3():
|
||||
@@ -304,8 +296,7 @@
|
||||
# trailing comment
|
||||
|
||||
|
||||
-def overload3(a: int):
|
||||
- ...
|
||||
+def overload3(a: int): ...
|
||||
|
||||
|
||||
def overload4():
|
||||
@@ -313,5 +304,4 @@
|
||||
# trailing comment
|
||||
|
||||
|
||||
-def overload4(a: int):
|
||||
- ...
|
||||
+def overload4(a: int): ...
|
||||
def overload4(a: int): ...
|
||||
```
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,27 +54,12 @@ source_type = Python
|
|||
|
||||
```python
|
||||
"""
|
||||
This looks like a docstring but is not in a notebook because notebooks can't be imported as a module.
|
||||
Ruff should leave it as is
|
||||
This looks like a docstring but is not in a notebook because notebooks can't be imported as a module.
|
||||
Ruff should leave it as is
|
||||
"""
|
||||
|
||||
"another normal string"
|
||||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -1,5 +1,6 @@
|
||||
"""
|
||||
- This looks like a docstring but is not in a notebook because notebooks can't be imported as a module.
|
||||
- Ruff should leave it as is
|
||||
+This looks like a docstring but is not in a notebook because notebooks can't be imported as a module.
|
||||
+Ruff should leave it as is
|
||||
"""
|
||||
+
|
||||
"another normal string"
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -92,13 +92,13 @@ source_type = Python
|
|||
"""
|
||||
Black's `Preview.module_docstring_newlines`
|
||||
"""
|
||||
|
||||
first_stmt_after_module_level_docstring = 1
|
||||
|
||||
|
||||
class CachedRepository:
|
||||
# Black's `Preview.dummy_implementations`
|
||||
def get_release_info(self):
|
||||
...
|
||||
def get_release_info(self): ...
|
||||
|
||||
|
||||
def raw_docstring():
|
||||
|
|
@ -118,23 +118,22 @@ def reference_docstring_newlines():
|
|||
|
||||
|
||||
class RemoveNewlineBeforeClassDocstring:
|
||||
|
||||
"""Black's `Preview.no_blank_line_before_class_docstring`"""
|
||||
|
||||
|
||||
def f():
|
||||
"""Black's `Preview.prefer_splitting_right_hand_side_of_assignments`"""
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
] = cccccccc.ccccccccccccc.cccccccc
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = (
|
||||
cccccccc.ccccccccccccc.cccccccc
|
||||
)
|
||||
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
] = cccccccc.ccccccccccccc().cccccccc
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = (
|
||||
cccccccc.ccccccccccccc().cccccccc
|
||||
)
|
||||
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
] = cccccccc.ccccccccccccc(d).cccccccc
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = (
|
||||
cccccccc.ccccccccccccc(d).cccccccc
|
||||
)
|
||||
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = (
|
||||
cccccccc.ccccccccccccc(d).cccccccc + e
|
||||
|
|
@ -148,84 +147,12 @@ def f():
|
|||
+ eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
)
|
||||
|
||||
self._cache: dict[
|
||||
DependencyCacheKey, list[list[DependencyPackage]]
|
||||
] = collections.defaultdict(list)
|
||||
self._cached_dependencies_by_level: dict[
|
||||
int, list[DependencyCacheKey]
|
||||
] = collections.defaultdict(list)
|
||||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -1,13 +1,13 @@
|
||||
"""
|
||||
Black's `Preview.module_docstring_newlines`
|
||||
"""
|
||||
+
|
||||
first_stmt_after_module_level_docstring = 1
|
||||
|
||||
|
||||
class CachedRepository:
|
||||
# Black's `Preview.dummy_implementations`
|
||||
- def get_release_info(self):
|
||||
- ...
|
||||
+ def get_release_info(self): ...
|
||||
|
||||
|
||||
def raw_docstring():
|
||||
@@ -27,23 +27,22 @@
|
||||
|
||||
|
||||
class RemoveNewlineBeforeClassDocstring:
|
||||
-
|
||||
"""Black's `Preview.no_blank_line_before_class_docstring`"""
|
||||
|
||||
|
||||
def f():
|
||||
"""Black's `Preview.prefer_splitting_right_hand_side_of_assignments`"""
|
||||
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[
|
||||
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
- ] = cccccccc.ccccccccccccc.cccccccc
|
||||
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = (
|
||||
+ cccccccc.ccccccccccccc.cccccccc
|
||||
+ )
|
||||
|
||||
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[
|
||||
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
- ] = cccccccc.ccccccccccccc().cccccccc
|
||||
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = (
|
||||
+ cccccccc.ccccccccccccc().cccccccc
|
||||
+ )
|
||||
|
||||
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[
|
||||
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
- ] = cccccccc.ccccccccccccc(d).cccccccc
|
||||
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = (
|
||||
+ cccccccc.ccccccccccccc(d).cccccccc
|
||||
+ )
|
||||
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = (
|
||||
cccccccc.ccccccccccccc(d).cccccccc + e
|
||||
@@ -57,9 +56,9 @@
|
||||
+ eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
)
|
||||
|
||||
- self._cache: dict[
|
||||
- DependencyCacheKey, list[list[DependencyPackage]]
|
||||
- ] = collections.defaultdict(list)
|
||||
- self._cached_dependencies_by_level: dict[
|
||||
- int, list[DependencyCacheKey]
|
||||
- ] = collections.defaultdict(list)
|
||||
+ self._cache: dict[DependencyCacheKey, list[list[DependencyPackage]]] = (
|
||||
+ collections.defaultdict(list)
|
||||
+ )
|
||||
+ self._cached_dependencies_by_level: dict[int, list[DependencyCacheKey]] = (
|
||||
+ collections.defaultdict(list)
|
||||
+ )
|
||||
self._cache: dict[DependencyCacheKey, list[list[DependencyPackage]]] = (
|
||||
collections.defaultdict(list)
|
||||
)
|
||||
self._cached_dependencies_by_level: dict[int, list[DependencyCacheKey]] = (
|
||||
collections.defaultdict(list)
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ source_type = Python
|
|||
```
|
||||
|
||||
```python
|
||||
'single' # this string is treated as a docstring
|
||||
"single" # this string is treated as a docstring
|
||||
|
||||
'double'
|
||||
r'r single'
|
||||
r'r double'
|
||||
|
|
@ -130,20 +131,6 @@ def docstring_single():
|
|||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -1,4 +1,5 @@
|
||||
-'single' # this string is treated as a docstring
|
||||
+"single" # this string is treated as a docstring
|
||||
+
|
||||
'double'
|
||||
r'r single'
|
||||
r'r double'
|
||||
```
|
||||
|
||||
|
||||
### Output 2
|
||||
```
|
||||
indent-style = space
|
||||
|
|
@ -161,6 +148,7 @@ source_type = Python
|
|||
|
||||
```python
|
||||
"single" # this string is treated as a docstring
|
||||
|
||||
"double"
|
||||
r"r single"
|
||||
r"r double"
|
||||
|
|
@ -217,19 +205,6 @@ def docstring_single():
|
|||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -1,4 +1,5 @@
|
||||
"single" # this string is treated as a docstring
|
||||
+
|
||||
"double"
|
||||
r"r single"
|
||||
r"r double"
|
||||
```
|
||||
|
||||
|
||||
### Output 3
|
||||
```
|
||||
indent-style = space
|
||||
|
|
@ -247,6 +222,7 @@ source_type = Python
|
|||
|
||||
```python
|
||||
'single' # this string is treated as a docstring
|
||||
|
||||
"double"
|
||||
r'r single'
|
||||
r"r double"
|
||||
|
|
@ -303,17 +279,4 @@ def docstring_single():
|
|||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -1,4 +1,5 @@
|
||||
'single' # this string is treated as a docstring
|
||||
+
|
||||
"double"
|
||||
r'r single'
|
||||
r"r double"
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb = (
|
|||
Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb()
|
||||
)
|
||||
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: (
|
||||
Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) = Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb()
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb = (
|
||||
Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb()
|
||||
)
|
||||
|
||||
JSONSerializable: TypeAlias = (
|
||||
"str | int | float | bool | None | list | tuple | JSONMapping"
|
||||
|
|
@ -61,39 +61,9 @@ JSONSerializable: str | int | float | bool | None | list | tuple | JSONMapping =
|
|||
|
||||
# Regression test: Don't forget the parentheses in the annotation when breaking
|
||||
class DefaultRunner:
|
||||
task_runner_cls: TaskRunnerProtocol | typing.Callable[
|
||||
[], typing.Any
|
||||
] = DefaultTaskRunner
|
||||
```
|
||||
|
||||
|
||||
## Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -7,9 +7,9 @@
|
||||
Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb()
|
||||
)
|
||||
|
||||
-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: (
|
||||
- Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
-) = Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb()
|
||||
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb = (
|
||||
+ Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb()
|
||||
+)
|
||||
|
||||
JSONSerializable: TypeAlias = (
|
||||
"str | int | float | bool | None | list | tuple | JSONMapping"
|
||||
@@ -29,6 +29,6 @@
|
||||
|
||||
# Regression test: Don't forget the parentheses in the annotation when breaking
|
||||
class DefaultRunner:
|
||||
- task_runner_cls: TaskRunnerProtocol | typing.Callable[
|
||||
- [], typing.Any
|
||||
- ] = DefaultTaskRunner
|
||||
+ task_runner_cls: TaskRunnerProtocol | typing.Callable[[], typing.Any] = (
|
||||
+ DefaultTaskRunner
|
||||
+ )
|
||||
task_runner_cls: TaskRunnerProtocol | typing.Callable[[], typing.Any] = (
|
||||
DefaultTaskRunner
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -87,9 +87,7 @@ c = b[dddddd, aaaaaa] = (
|
|||
## Output
|
||||
```python
|
||||
# break left hand side
|
||||
a1akjdshflkjahdslkfjlasfdahjlfds = (
|
||||
bakjdshflkjahdslkfjlasfdahjlfds
|
||||
) = (
|
||||
a1akjdshflkjahdslkfjlasfdahjlfds = bakjdshflkjahdslkfjlasfdahjlfds = (
|
||||
cakjdshflkjahdslkfjlasfdahjlfds
|
||||
) = kjaödkjaföjfahlfdalfhaöfaöfhaöfha = fkjaödkjaföjfahlfdalfhaöfaöfhaöfha = g = 3
|
||||
|
||||
|
|
@ -97,15 +95,13 @@ a1akjdshflkjahdslkfjlasfdahjlfds = (
|
|||
a2 = b2 = 2
|
||||
|
||||
# Break the last element
|
||||
a = (
|
||||
asdf
|
||||
) = (
|
||||
a = asdf = (
|
||||
fjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfal
|
||||
) = 1
|
||||
|
||||
aa = [
|
||||
bakjdshflkjahdslkfjlasfdahjlfds
|
||||
] = dddd = ddd = fkjaödkjaföjfahlfdalfhaöfaöfhaöfha = g = [3]
|
||||
aa = [bakjdshflkjahdslkfjlasfdahjlfds] = dddd = ddd = (
|
||||
fkjaödkjaföjfahlfdalfhaöfaöfhaöfha
|
||||
) = g = [3]
|
||||
|
||||
aa = [] = dddd = ddd = fkjaödkjaföjfahlfdalfhaöfaöfhaöfha = g = [3]
|
||||
|
||||
|
|
@ -169,40 +165,4 @@ c = b[dddddd, aaaaaa] = (
|
|||
```
|
||||
|
||||
|
||||
## Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -1,7 +1,5 @@
|
||||
# break left hand side
|
||||
-a1akjdshflkjahdslkfjlasfdahjlfds = (
|
||||
- bakjdshflkjahdslkfjlasfdahjlfds
|
||||
-) = (
|
||||
+a1akjdshflkjahdslkfjlasfdahjlfds = bakjdshflkjahdslkfjlasfdahjlfds = (
|
||||
cakjdshflkjahdslkfjlasfdahjlfds
|
||||
) = kjaödkjaföjfahlfdalfhaöfaöfhaöfha = fkjaödkjaföjfahlfdalfhaöfaöfhaöfha = g = 3
|
||||
|
||||
@@ -9,15 +7,13 @@
|
||||
a2 = b2 = 2
|
||||
|
||||
# Break the last element
|
||||
-a = (
|
||||
- asdf
|
||||
-) = (
|
||||
+a = asdf = (
|
||||
fjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfal
|
||||
) = 1
|
||||
|
||||
-aa = [
|
||||
- bakjdshflkjahdslkfjlasfdahjlfds
|
||||
-] = dddd = ddd = fkjaödkjaföjfahlfdalfhaöfaöfhaöfha = g = [3]
|
||||
+aa = [bakjdshflkjahdslkfjlasfdahjlfds] = dddd = ddd = (
|
||||
+ fkjaödkjaföjfahlfdalfhaöfaöfhaöfha
|
||||
+) = g = [3]
|
||||
|
||||
aa = [] = dddd = ddd = fkjaödkjaföjfahlfdalfhaöfaöfhaöfha = g = [3]
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -264,8 +264,7 @@ class Test( # trailing class comment
|
|||
pass
|
||||
|
||||
|
||||
class Test((Aaaa)):
|
||||
...
|
||||
class Test((Aaaa)): ...
|
||||
|
||||
|
||||
class Test(
|
||||
|
|
@ -330,7 +329,6 @@ class Test:
|
|||
|
||||
|
||||
class Test:
|
||||
|
||||
"""Docstring"""
|
||||
|
||||
|
||||
|
|
@ -347,14 +345,12 @@ class Test:
|
|||
|
||||
|
||||
class Test:
|
||||
|
||||
"""Docstring"""
|
||||
|
||||
x = 1
|
||||
|
||||
|
||||
class Test:
|
||||
|
||||
"""Docstring"""
|
||||
|
||||
# comment
|
||||
|
|
@ -395,20 +391,17 @@ class C(
|
|||
|
||||
@dataclass
|
||||
# Copied from transformers.models.clip.modeling_clip.CLIPOutput with CLIP->AltCLIP
|
||||
class AltCLIPOutput(ModelOutput):
|
||||
...
|
||||
class AltCLIPOutput(ModelOutput): ...
|
||||
|
||||
|
||||
@dataclass
|
||||
class AltCLIPOutput: # Copied from transformers.models.clip.modeling_clip.CLIPOutput with CLIP->AltCLIP
|
||||
...
|
||||
class AltCLIPOutput: ... # Copied from transformers.models.clip.modeling_clip.CLIPOutput with CLIP->AltCLIP
|
||||
|
||||
|
||||
@dataclass
|
||||
class AltCLIPOutput(
|
||||
# Copied from transformers.models.clip.modeling_clip.CLIPOutput with CLIP->AltCLIP
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
class TestTypeParams[
|
||||
|
|
@ -499,68 +492,4 @@ class QuerySet(AltersData):
|
|||
```
|
||||
|
||||
|
||||
## Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -28,8 +28,7 @@
|
||||
pass
|
||||
|
||||
|
||||
-class Test((Aaaa)):
|
||||
- ...
|
||||
+class Test((Aaaa)): ...
|
||||
|
||||
|
||||
class Test(
|
||||
@@ -94,7 +93,6 @@
|
||||
|
||||
|
||||
class Test:
|
||||
-
|
||||
"""Docstring"""
|
||||
|
||||
|
||||
@@ -111,14 +109,12 @@
|
||||
|
||||
|
||||
class Test:
|
||||
-
|
||||
"""Docstring"""
|
||||
|
||||
x = 1
|
||||
|
||||
|
||||
class Test:
|
||||
-
|
||||
"""Docstring"""
|
||||
|
||||
# comment
|
||||
@@ -159,20 +155,17 @@
|
||||
|
||||
@dataclass
|
||||
# Copied from transformers.models.clip.modeling_clip.CLIPOutput with CLIP->AltCLIP
|
||||
-class AltCLIPOutput(ModelOutput):
|
||||
- ...
|
||||
+class AltCLIPOutput(ModelOutput): ...
|
||||
|
||||
|
||||
@dataclass
|
||||
-class AltCLIPOutput: # Copied from transformers.models.clip.modeling_clip.CLIPOutput with CLIP->AltCLIP
|
||||
- ...
|
||||
+class AltCLIPOutput: ... # Copied from transformers.models.clip.modeling_clip.CLIPOutput with CLIP->AltCLIP
|
||||
|
||||
|
||||
@dataclass
|
||||
class AltCLIPOutput(
|
||||
# Copied from transformers.models.clip.modeling_clip.CLIPOutput with CLIP->AltCLIP
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
class TestTypeParams[
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -434,8 +434,7 @@ def function_with_one_argument_and_a_keyword_separator(
|
|||
def test(
|
||||
# comment
|
||||
# another
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
# Argument empty line spacing
|
||||
|
|
@ -444,8 +443,7 @@ def test(
|
|||
a,
|
||||
# another
|
||||
b,
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
### Different function argument wrappings
|
||||
|
|
@ -489,8 +487,7 @@ def varg_with_leading_comments(
|
|||
b,
|
||||
# comment
|
||||
*args,
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def kwarg_with_leading_comments(
|
||||
|
|
@ -498,8 +495,7 @@ def kwarg_with_leading_comments(
|
|||
b,
|
||||
# comment
|
||||
**kwargs,
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def argument_with_long_default(
|
||||
|
|
@ -507,8 +503,7 @@ def argument_with_long_default(
|
|||
b=ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
+ [dddddddddddddddddddd, eeeeeeeeeeeeeeeeeeee, ffffffffffffffffffffffff],
|
||||
h=[],
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def argument_with_long_type_annotation(
|
||||
|
|
@ -517,12 +512,10 @@ def argument_with_long_type_annotation(
|
|||
| yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
|
||||
| zzzzzzzzzzzzzzzzzzz = [0, 1, 2, 3],
|
||||
h=[],
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def test():
|
||||
...
|
||||
def test(): ...
|
||||
|
||||
|
||||
# Type parameter empty line spacing
|
||||
|
|
@ -531,8 +524,7 @@ def test[
|
|||
A,
|
||||
# another
|
||||
B,
|
||||
]():
|
||||
...
|
||||
](): ...
|
||||
|
||||
|
||||
# Type parameter comments
|
||||
|
|
@ -591,8 +583,7 @@ def single_line_trailing_comma[
|
|||
|
||||
|
||||
# Comment
|
||||
def with_leading_comment():
|
||||
...
|
||||
def with_leading_comment(): ...
|
||||
|
||||
|
||||
# Comment that could be mistaken for a trailing comment of the function declaration when
|
||||
|
|
@ -624,8 +615,7 @@ def f(arg1=1, *, kwonlyarg1, kwonlyarg2=2):
|
|||
# Regression test for https://github.com/astral-sh/ruff/issues/5176#issuecomment-1598171989
|
||||
def foo(
|
||||
b=3 + 2, # comment
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
# Comments on the slash or the star, both of which don't have a node
|
||||
|
|
@ -886,8 +876,7 @@ def f(
|
|||
def f(
|
||||
# first
|
||||
# second
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def f( # first
|
||||
|
|
@ -907,8 +896,7 @@ def f(
|
|||
# first
|
||||
b,
|
||||
# second
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def f( # first
|
||||
|
|
@ -916,8 +904,7 @@ def f( # first
|
|||
# second
|
||||
b,
|
||||
# third
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def f( # first
|
||||
|
|
@ -926,8 +913,7 @@ def f( # first
|
|||
# third
|
||||
b,
|
||||
# fourth
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def f( # first
|
||||
|
|
@ -954,17 +940,14 @@ def f( # first
|
|||
a,
|
||||
# third
|
||||
/, # second
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
# Walrus operator in return type.
|
||||
def this_is_unusual() -> (please := no):
|
||||
...
|
||||
def this_is_unusual() -> (please := no): ...
|
||||
|
||||
|
||||
def this_is_unusual(x) -> (please := no):
|
||||
...
|
||||
def this_is_unusual(x) -> (please := no): ...
|
||||
|
||||
|
||||
# Regression test for: https://github.com/astral-sh/ruff/issues/7465
|
||||
|
|
@ -1018,167 +1001,4 @@ def function_with_one_argument_and_a_keyword_separator(
|
|||
```
|
||||
|
||||
|
||||
## Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -2,8 +2,7 @@
|
||||
def test(
|
||||
# comment
|
||||
# another
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
# Argument empty line spacing
|
||||
@@ -12,8 +11,7 @@
|
||||
a,
|
||||
# another
|
||||
b,
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
### Different function argument wrappings
|
||||
@@ -57,8 +55,7 @@
|
||||
b,
|
||||
# comment
|
||||
*args,
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def kwarg_with_leading_comments(
|
||||
@@ -66,8 +63,7 @@
|
||||
b,
|
||||
# comment
|
||||
**kwargs,
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def argument_with_long_default(
|
||||
@@ -75,8 +71,7 @@
|
||||
b=ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
+ [dddddddddddddddddddd, eeeeeeeeeeeeeeeeeeee, ffffffffffffffffffffffff],
|
||||
h=[],
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def argument_with_long_type_annotation(
|
||||
@@ -85,12 +80,10 @@
|
||||
| yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
|
||||
| zzzzzzzzzzzzzzzzzzz = [0, 1, 2, 3],
|
||||
h=[],
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
-def test():
|
||||
- ...
|
||||
+def test(): ...
|
||||
|
||||
|
||||
# Type parameter empty line spacing
|
||||
@@ -99,8 +92,7 @@
|
||||
A,
|
||||
# another
|
||||
B,
|
||||
-]():
|
||||
- ...
|
||||
+](): ...
|
||||
|
||||
|
||||
# Type parameter comments
|
||||
@@ -159,8 +151,7 @@
|
||||
|
||||
|
||||
# Comment
|
||||
-def with_leading_comment():
|
||||
- ...
|
||||
+def with_leading_comment(): ...
|
||||
|
||||
|
||||
# Comment that could be mistaken for a trailing comment of the function declaration when
|
||||
@@ -192,8 +183,7 @@
|
||||
# Regression test for https://github.com/astral-sh/ruff/issues/5176#issuecomment-1598171989
|
||||
def foo(
|
||||
b=3 + 2, # comment
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
# Comments on the slash or the star, both of which don't have a node
|
||||
@@ -454,8 +444,7 @@
|
||||
def f(
|
||||
# first
|
||||
# second
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def f( # first
|
||||
@@ -475,8 +464,7 @@
|
||||
# first
|
||||
b,
|
||||
# second
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def f( # first
|
||||
@@ -484,8 +472,7 @@
|
||||
# second
|
||||
b,
|
||||
# third
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def f( # first
|
||||
@@ -494,8 +481,7 @@
|
||||
# third
|
||||
b,
|
||||
# fourth
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def f( # first
|
||||
@@ -522,17 +508,14 @@
|
||||
a,
|
||||
# third
|
||||
/, # second
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
# Walrus operator in return type.
|
||||
-def this_is_unusual() -> (please := no):
|
||||
- ...
|
||||
+def this_is_unusual() -> (please := no): ...
|
||||
|
||||
|
||||
-def this_is_unusual(x) -> (please := no):
|
||||
- ...
|
||||
+def this_is_unusual(x) -> (please := no): ...
|
||||
|
||||
|
||||
# Regression test for: https://github.com/astral-sh/ruff/issues/7465
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -165,11 +165,21 @@ nested_comment: None | [
|
|||
|
||||
## Output
|
||||
```python
|
||||
x1: A[b] | EventHandler | EventSpec | list[
|
||||
EventHandler | EventSpec
|
||||
] | Other | More | AndMore | None = None
|
||||
x1: (
|
||||
A[b]
|
||||
| EventHandler
|
||||
| EventSpec
|
||||
| list[EventHandler | EventSpec]
|
||||
| Other
|
||||
| More
|
||||
| AndMore
|
||||
| None
|
||||
) = None
|
||||
|
||||
x2: "VeryLongClassNameWithAwkwardGenericSubtype[int] |" "VeryLongClassNameWithAwkwardGenericSubtype[str]"
|
||||
x2: (
|
||||
"VeryLongClassNameWithAwkwardGenericSubtype[int] |"
|
||||
"VeryLongClassNameWithAwkwardGenericSubtype[str]"
|
||||
)
|
||||
|
||||
x6: VeryLongClassNameWithAwkwardGenericSubtype[
|
||||
integeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeer,
|
||||
|
|
@ -215,12 +225,16 @@ x11: None | [
|
|||
datasets.VideoDataset,
|
||||
] = None
|
||||
|
||||
x12: None | [
|
||||
datasets.ImageDataset,
|
||||
datasets.TabularDataset,
|
||||
datasets.TextDataset,
|
||||
datasets.VideoDataset,
|
||||
] | Other = None
|
||||
x12: (
|
||||
None
|
||||
| [
|
||||
datasets.ImageDataset,
|
||||
datasets.TabularDataset,
|
||||
datasets.TextDataset,
|
||||
datasets.VideoDataset,
|
||||
]
|
||||
| Other
|
||||
) = None
|
||||
|
||||
|
||||
x13: [
|
||||
|
|
@ -242,27 +256,34 @@ x14: [
|
|||
datasets.VideoDataset,
|
||||
] = None
|
||||
|
||||
x15: [
|
||||
datasets.ImageDataset,
|
||||
datasets.TabularDataset,
|
||||
datasets.TextDataset,
|
||||
datasets.VideoDataset,
|
||||
] | [
|
||||
datasets.ImageDataset,
|
||||
datasets.TabularDataset,
|
||||
datasets.TextDataset,
|
||||
datasets.VideoDataset,
|
||||
] | Other = None
|
||||
x15: (
|
||||
[
|
||||
datasets.ImageDataset,
|
||||
datasets.TabularDataset,
|
||||
datasets.TextDataset,
|
||||
datasets.VideoDataset,
|
||||
]
|
||||
| [
|
||||
datasets.ImageDataset,
|
||||
datasets.TabularDataset,
|
||||
datasets.TextDataset,
|
||||
datasets.VideoDataset,
|
||||
]
|
||||
| Other
|
||||
) = None
|
||||
|
||||
x16: None | Literal[
|
||||
"split",
|
||||
"a bit longer",
|
||||
"records",
|
||||
"index",
|
||||
"table",
|
||||
"columns",
|
||||
"values",
|
||||
] = None
|
||||
x16: (
|
||||
None
|
||||
| Literal[
|
||||
"split",
|
||||
"a bit longer",
|
||||
"records",
|
||||
"index",
|
||||
"table",
|
||||
"columns",
|
||||
"values",
|
||||
]
|
||||
) = None
|
||||
|
||||
x17: None | [
|
||||
datasets.ImageDataset,
|
||||
|
|
@ -273,9 +294,13 @@ x17: None | [
|
|||
|
||||
|
||||
class Test:
|
||||
safe_age: Decimal # the user's age, used to determine if it's safe for them to use ruff
|
||||
safe_age: (
|
||||
Decimal # the user's age, used to determine if it's safe for them to use ruff
|
||||
)
|
||||
applied_fixes: int # the number of fixes that this user applied. Used for ranking the users with the most applied fixes.
|
||||
string_annotation: "Test" # a long comment after a quoted, runtime-only type annotation
|
||||
string_annotation: (
|
||||
"Test" # a long comment after a quoted, runtime-only type annotation
|
||||
)
|
||||
|
||||
|
||||
##########
|
||||
|
|
@ -324,128 +349,4 @@ nested_comment: None | [
|
|||
```
|
||||
|
||||
|
||||
## Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -1,8 +1,18 @@
|
||||
-x1: A[b] | EventHandler | EventSpec | list[
|
||||
- EventHandler | EventSpec
|
||||
-] | Other | More | AndMore | None = None
|
||||
+x1: (
|
||||
+ A[b]
|
||||
+ | EventHandler
|
||||
+ | EventSpec
|
||||
+ | list[EventHandler | EventSpec]
|
||||
+ | Other
|
||||
+ | More
|
||||
+ | AndMore
|
||||
+ | None
|
||||
+) = None
|
||||
|
||||
-x2: "VeryLongClassNameWithAwkwardGenericSubtype[int] |" "VeryLongClassNameWithAwkwardGenericSubtype[str]"
|
||||
+x2: (
|
||||
+ "VeryLongClassNameWithAwkwardGenericSubtype[int] |"
|
||||
+ "VeryLongClassNameWithAwkwardGenericSubtype[str]"
|
||||
+)
|
||||
|
||||
x6: VeryLongClassNameWithAwkwardGenericSubtype[
|
||||
integeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeer,
|
||||
@@ -48,12 +58,16 @@
|
||||
datasets.VideoDataset,
|
||||
] = None
|
||||
|
||||
-x12: None | [
|
||||
- datasets.ImageDataset,
|
||||
- datasets.TabularDataset,
|
||||
- datasets.TextDataset,
|
||||
- datasets.VideoDataset,
|
||||
-] | Other = None
|
||||
+x12: (
|
||||
+ None
|
||||
+ | [
|
||||
+ datasets.ImageDataset,
|
||||
+ datasets.TabularDataset,
|
||||
+ datasets.TextDataset,
|
||||
+ datasets.VideoDataset,
|
||||
+ ]
|
||||
+ | Other
|
||||
+) = None
|
||||
|
||||
|
||||
x13: [
|
||||
@@ -75,27 +89,34 @@
|
||||
datasets.VideoDataset,
|
||||
] = None
|
||||
|
||||
-x15: [
|
||||
- datasets.ImageDataset,
|
||||
- datasets.TabularDataset,
|
||||
- datasets.TextDataset,
|
||||
- datasets.VideoDataset,
|
||||
-] | [
|
||||
- datasets.ImageDataset,
|
||||
- datasets.TabularDataset,
|
||||
- datasets.TextDataset,
|
||||
- datasets.VideoDataset,
|
||||
-] | Other = None
|
||||
+x15: (
|
||||
+ [
|
||||
+ datasets.ImageDataset,
|
||||
+ datasets.TabularDataset,
|
||||
+ datasets.TextDataset,
|
||||
+ datasets.VideoDataset,
|
||||
+ ]
|
||||
+ | [
|
||||
+ datasets.ImageDataset,
|
||||
+ datasets.TabularDataset,
|
||||
+ datasets.TextDataset,
|
||||
+ datasets.VideoDataset,
|
||||
+ ]
|
||||
+ | Other
|
||||
+) = None
|
||||
|
||||
-x16: None | Literal[
|
||||
- "split",
|
||||
- "a bit longer",
|
||||
- "records",
|
||||
- "index",
|
||||
- "table",
|
||||
- "columns",
|
||||
- "values",
|
||||
-] = None
|
||||
+x16: (
|
||||
+ None
|
||||
+ | Literal[
|
||||
+ "split",
|
||||
+ "a bit longer",
|
||||
+ "records",
|
||||
+ "index",
|
||||
+ "table",
|
||||
+ "columns",
|
||||
+ "values",
|
||||
+ ]
|
||||
+) = None
|
||||
|
||||
x17: None | [
|
||||
datasets.ImageDataset,
|
||||
@@ -106,9 +127,13 @@
|
||||
|
||||
|
||||
class Test:
|
||||
- safe_age: Decimal # the user's age, used to determine if it's safe for them to use ruff
|
||||
+ safe_age: (
|
||||
+ Decimal # the user's age, used to determine if it's safe for them to use ruff
|
||||
+ )
|
||||
applied_fixes: int # the number of fixes that this user applied. Used for ranking the users with the most applied fixes.
|
||||
- string_annotation: "Test" # a long comment after a quoted, runtime-only type annotation
|
||||
+ string_annotation: (
|
||||
+ "Test" # a long comment after a quoted, runtime-only type annotation
|
||||
+ )
|
||||
|
||||
|
||||
##########
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -211,8 +211,7 @@ def zrevrangebylex(
|
|||
start: int | None = None,
|
||||
num: int | None = None,
|
||||
) -> ( # type: ignore[override]
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def zrevrangebylex(
|
||||
|
|
@ -224,8 +223,7 @@ def zrevrangebylex(
|
|||
num: int | None = None,
|
||||
) -> ( # type: ignore[override]
|
||||
# comment
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def zrevrangebylex(
|
||||
|
|
@ -237,8 +235,7 @@ def zrevrangebylex(
|
|||
num: int | None = None,
|
||||
) -> ( # type: ignore[override]
|
||||
1
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def zrevrangebylex(
|
||||
|
|
@ -251,8 +248,7 @@ def zrevrangebylex(
|
|||
) -> ( # type: ignore[override]
|
||||
1,
|
||||
2,
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def zrevrangebylex(
|
||||
|
|
@ -264,14 +260,12 @@ def zrevrangebylex(
|
|||
num: int | None = None,
|
||||
) -> ( # type: ignore[override]
|
||||
(1, 2)
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def handleMatch( # type: ignore[override] # https://github.com/python/mypy/issues/10197
|
||||
self, m: Match[str], data: str
|
||||
) -> Union[Tuple[None, None, None], Tuple[Element, int, int]]:
|
||||
...
|
||||
) -> Union[Tuple[None, None, None], Tuple[Element, int, int]]: ...
|
||||
|
||||
|
||||
def double(
|
||||
|
|
@ -299,50 +293,44 @@ def double(
|
|||
# function arguments break here with a single argument; we do not.)
|
||||
def f(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
|
||||
...
|
||||
) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: ...
|
||||
|
||||
|
||||
def f(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, a
|
||||
) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
|
||||
...
|
||||
) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: ...
|
||||
|
||||
|
||||
def f(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
) -> a:
|
||||
...
|
||||
) -> a: ...
|
||||
|
||||
|
||||
def f(
|
||||
a,
|
||||
) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
|
||||
...
|
||||
) -> (
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
): ...
|
||||
|
||||
|
||||
def f[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]() -> (
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def f[
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
]() -> a:
|
||||
...
|
||||
]() -> a: ...
|
||||
|
||||
|
||||
def f[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa](
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
|
||||
...
|
||||
) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: ...
|
||||
|
||||
|
||||
def f[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa](
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
) -> a:
|
||||
...
|
||||
) -> a: ...
|
||||
|
||||
|
||||
# Breaking return type annotations. Black adds parentheses if the parameters are
|
||||
|
|
@ -351,137 +339,126 @@ def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
|||
Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
]
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
]
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
]
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
]
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
) -> Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
]:
|
||||
...
|
||||
]: ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
) -> Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
]:
|
||||
...
|
||||
]: ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
*args,
|
||||
) -> Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
]:
|
||||
...
|
||||
]: ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx( # foo
|
||||
) -> Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
]:
|
||||
...
|
||||
]: ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
# bar
|
||||
) -> Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
]:
|
||||
...
|
||||
]: ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
) -> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:
|
||||
...
|
||||
) -> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
) -> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:
|
||||
...
|
||||
) -> (
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> X + Y + foooooooooooooooooooooooooooooooooooo():
|
||||
...
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
X + Y + foooooooooooooooooooooooooooooooooooo()
|
||||
): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(x) -> X + Y + foooooooooooooooooooooooooooooooooooo():
|
||||
...
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
) -> X + Y + foooooooooooooooooooooooooooooooooooo(): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
X and Y and foooooooooooooooooooooooooooooooooooo()
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
) -> X and Y and foooooooooooooooooooooooooooooooooooo():
|
||||
...
|
||||
) -> X and Y and foooooooooooooooooooooooooooooooooooo(): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> X | Y | foooooooooooooooooooooooooooooooooooo():
|
||||
...
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
X | Y | foooooooooooooooooooooooooooooooooooo()
|
||||
): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(x) -> X | Y | foooooooooooooooooooooooooooooooooooo():
|
||||
...
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
) -> X | Y | foooooooooooooooooooooooooooooooooooo(): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
X | Y | foooooooooooooooooooooooooooooooooooo() # comment
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
) -> (
|
||||
X | Y | foooooooooooooooooooooooooooooooooooo() # comment
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
|
||||
def double() -> (
|
||||
|
|
@ -544,298 +521,4 @@ def process_board_action(
|
|||
```
|
||||
|
||||
|
||||
## Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -7,8 +7,7 @@
|
||||
start: int | None = None,
|
||||
num: int | None = None,
|
||||
) -> ( # type: ignore[override]
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def zrevrangebylex(
|
||||
@@ -20,8 +19,7 @@
|
||||
num: int | None = None,
|
||||
) -> ( # type: ignore[override]
|
||||
# comment
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def zrevrangebylex(
|
||||
@@ -33,8 +31,7 @@
|
||||
num: int | None = None,
|
||||
) -> ( # type: ignore[override]
|
||||
1
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def zrevrangebylex(
|
||||
@@ -47,8 +44,7 @@
|
||||
) -> ( # type: ignore[override]
|
||||
1,
|
||||
2,
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def zrevrangebylex(
|
||||
@@ -60,14 +56,12 @@
|
||||
num: int | None = None,
|
||||
) -> ( # type: ignore[override]
|
||||
(1, 2)
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def handleMatch( # type: ignore[override] # https://github.com/python/mypy/issues/10197
|
||||
self, m: Match[str], data: str
|
||||
-) -> Union[Tuple[None, None, None], Tuple[Element, int, int]]:
|
||||
- ...
|
||||
+) -> Union[Tuple[None, None, None], Tuple[Element, int, int]]: ...
|
||||
|
||||
|
||||
def double(
|
||||
@@ -95,50 +89,44 @@
|
||||
# function arguments break here with a single argument; we do not.)
|
||||
def f(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
-) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
|
||||
- ...
|
||||
+) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: ...
|
||||
|
||||
|
||||
def f(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, a
|
||||
-) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
|
||||
- ...
|
||||
+) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: ...
|
||||
|
||||
|
||||
def f(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
-) -> a:
|
||||
- ...
|
||||
+) -> a: ...
|
||||
|
||||
|
||||
def f(
|
||||
a,
|
||||
-) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
|
||||
- ...
|
||||
+) -> (
|
||||
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
+): ...
|
||||
|
||||
|
||||
def f[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]() -> (
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def f[
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
-]() -> a:
|
||||
- ...
|
||||
+]() -> a: ...
|
||||
|
||||
|
||||
def f[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa](
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
-) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
|
||||
- ...
|
||||
+) -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: ...
|
||||
|
||||
|
||||
def f[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa](
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
-) -> a:
|
||||
- ...
|
||||
+) -> a: ...
|
||||
|
||||
|
||||
# Breaking return type annotations. Black adds parentheses if the parameters are
|
||||
@@ -147,137 +135,126 @@
|
||||
Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
]
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
]
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
]
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
]
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
) -> Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
-]:
|
||||
- ...
|
||||
+]: ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
) -> Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
-]:
|
||||
- ...
|
||||
+]: ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
*args,
|
||||
) -> Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
-]:
|
||||
- ...
|
||||
+]: ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx( # foo
|
||||
) -> Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
-]:
|
||||
- ...
|
||||
+]: ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
# bar
|
||||
) -> Set[
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
-]:
|
||||
- ...
|
||||
+]: ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
-) -> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:
|
||||
- ...
|
||||
+) -> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
-) -> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:
|
||||
- ...
|
||||
+) -> (
|
||||
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
+): ...
|
||||
|
||||
|
||||
-def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> X + Y + foooooooooooooooooooooooooooooooooooo():
|
||||
- ...
|
||||
+def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
+ X + Y + foooooooooooooooooooooooooooooooooooo()
|
||||
+): ...
|
||||
|
||||
|
||||
-def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(x) -> X + Y + foooooooooooooooooooooooooooooooooooo():
|
||||
- ...
|
||||
+def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
+ x,
|
||||
+) -> X + Y + foooooooooooooooooooooooooooooooooooo(): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
X and Y and foooooooooooooooooooooooooooooooooooo()
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
-) -> X and Y and foooooooooooooooooooooooooooooooooooo():
|
||||
- ...
|
||||
+) -> X and Y and foooooooooooooooooooooooooooooooooooo(): ...
|
||||
|
||||
|
||||
-def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> X | Y | foooooooooooooooooooooooooooooooooooo():
|
||||
- ...
|
||||
+def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
+ X | Y | foooooooooooooooooooooooooooooooooooo()
|
||||
+): ...
|
||||
|
||||
|
||||
-def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(x) -> X | Y | foooooooooooooooooooooooooooooooooooo():
|
||||
- ...
|
||||
+def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
+ x,
|
||||
+) -> X | Y | foooooooooooooooooooooooooooooooooooo(): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx() -> (
|
||||
X | Y | foooooooooooooooooooooooooooooooooooo() # comment
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def xxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
x,
|
||||
) -> (
|
||||
X | Y | foooooooooooooooooooooooooooooooooooo() # comment
|
||||
-):
|
||||
- ...
|
||||
+): ...
|
||||
|
||||
|
||||
def double() -> (
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -61,25 +61,20 @@ def foo():
|
|||
pass
|
||||
|
||||
|
||||
class Del(expr_context):
|
||||
...
|
||||
class Del(expr_context): ...
|
||||
|
||||
|
||||
class Load(expr_context):
|
||||
...
|
||||
class Load(expr_context): ...
|
||||
|
||||
|
||||
# Some comment.
|
||||
class Other(expr_context):
|
||||
...
|
||||
class Other(expr_context): ...
|
||||
|
||||
|
||||
class Store(expr_context):
|
||||
...
|
||||
class Store(expr_context): ...
|
||||
|
||||
|
||||
class Foo(Bar):
|
||||
...
|
||||
class Foo(Bar): ...
|
||||
|
||||
|
||||
class Baz(Qux):
|
||||
|
|
@ -98,14 +93,8 @@ class Quuz(Qux):
|
|||
pass
|
||||
|
||||
|
||||
def bar():
|
||||
...
|
||||
|
||||
|
||||
def baz():
|
||||
...
|
||||
|
||||
|
||||
def bar(): ...
|
||||
def baz(): ...
|
||||
def quux():
|
||||
"""Some docstring."""
|
||||
|
||||
|
|
@ -115,59 +104,4 @@ def quuz():
|
|||
```
|
||||
|
||||
|
||||
## Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -12,25 +12,20 @@
|
||||
pass
|
||||
|
||||
|
||||
-class Del(expr_context):
|
||||
- ...
|
||||
+class Del(expr_context): ...
|
||||
|
||||
|
||||
-class Load(expr_context):
|
||||
- ...
|
||||
+class Load(expr_context): ...
|
||||
|
||||
|
||||
# Some comment.
|
||||
-class Other(expr_context):
|
||||
- ...
|
||||
+class Other(expr_context): ...
|
||||
|
||||
|
||||
-class Store(expr_context):
|
||||
- ...
|
||||
+class Store(expr_context): ...
|
||||
|
||||
|
||||
-class Foo(Bar):
|
||||
- ...
|
||||
+class Foo(Bar): ...
|
||||
|
||||
|
||||
class Baz(Qux):
|
||||
@@ -49,14 +44,8 @@
|
||||
pass
|
||||
|
||||
|
||||
-def bar():
|
||||
- ...
|
||||
-
|
||||
-
|
||||
-def baz():
|
||||
- ...
|
||||
-
|
||||
-
|
||||
+def bar(): ...
|
||||
+def baz(): ...
|
||||
def quux():
|
||||
"""Some docstring."""
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -629,8 +629,9 @@ with (
|
|||
pass
|
||||
|
||||
with (
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb as b,
|
||||
(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) as b,
|
||||
c as d,
|
||||
):
|
||||
pass
|
||||
|
|
@ -668,25 +669,6 @@ with Child(aaaaaaaaa, bbbbbbbbbbbbbbb, cccccc), Document(
|
|||
```
|
||||
|
||||
|
||||
#### Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -295,8 +295,9 @@
|
||||
pass
|
||||
|
||||
with (
|
||||
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
- + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb as b,
|
||||
+ (
|
||||
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
+ ) as b,
|
||||
c as d,
|
||||
):
|
||||
pass
|
||||
```
|
||||
|
||||
|
||||
### Output 2
|
||||
```
|
||||
indent-style = space
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@ class NewlinesBetweenInnerClasses:
|
|||
|
||||
class InnerClass5:
|
||||
def a(self): ...
|
||||
|
||||
field1 = 1
|
||||
|
||||
class InnerClass6:
|
||||
|
|
@ -278,6 +279,7 @@ class NewlinesBetweenInnerClasses:
|
|||
|
||||
class InnerClass7:
|
||||
def a(self): ...
|
||||
|
||||
print("hi")
|
||||
|
||||
class InnerClass8:
|
||||
|
|
@ -309,27 +311,4 @@ class ComplexStatements:
|
|||
```
|
||||
|
||||
|
||||
## Preview changes
|
||||
```diff
|
||||
--- Stable
|
||||
+++ Preview
|
||||
@@ -110,6 +110,7 @@
|
||||
|
||||
class InnerClass5:
|
||||
def a(self): ...
|
||||
+
|
||||
field1 = 1
|
||||
|
||||
class InnerClass6:
|
||||
@@ -119,6 +120,7 @@
|
||||
|
||||
class InnerClass7:
|
||||
def a(self): ...
|
||||
+
|
||||
print("hi")
|
||||
|
||||
class InnerClass8:
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue