mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:26:23 +00:00
Change default for Python version from 3.8 to 3.9 (#13896)
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
parent
afeb217452
commit
1b180c8342
123 changed files with 90 additions and 5488 deletions
|
@ -0,0 +1 @@
|
|||
{"target_version": "py38"}
|
|
@ -0,0 +1 @@
|
|||
{"target_version": "py38"}
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,82 +0,0 @@
|
|||
def foo():
|
||||
"""
|
||||
Docstring
|
||||
"""
|
||||
|
||||
# Here we go
|
||||
if x:
|
||||
|
||||
# This is also now fine
|
||||
a = 123
|
||||
|
||||
else:
|
||||
# But not necessary
|
||||
a = 123
|
||||
|
||||
if y:
|
||||
|
||||
while True:
|
||||
|
||||
"""
|
||||
Long comment here
|
||||
"""
|
||||
a = 123
|
||||
|
||||
if z:
|
||||
|
||||
for _ in range(100):
|
||||
a = 123
|
||||
else:
|
||||
|
||||
try:
|
||||
|
||||
# this should be ok
|
||||
a = 123
|
||||
except:
|
||||
|
||||
"""also this"""
|
||||
a = 123
|
||||
|
||||
|
||||
def bar():
|
||||
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def baz():
|
||||
|
||||
# OK
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
def quux():
|
||||
|
||||
new_line = here
|
||||
|
||||
|
||||
class Cls:
|
||||
|
||||
def method(self):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
async def async_fn():
|
||||
|
||||
"""Docstring."""
|
||||
|
||||
|
||||
@decorated
|
||||
async def async_fn():
|
||||
|
||||
"""Docstring."""
|
||||
|
||||
|
||||
def top_level(
|
||||
a: int,
|
||||
b: str,
|
||||
) -> Whatever[Generic, Something]:
|
||||
|
||||
def nested(x: int) -> int:
|
||||
pass
|
|
@ -1,81 +0,0 @@
|
|||
def foo():
|
||||
"""
|
||||
Docstring
|
||||
"""
|
||||
|
||||
# Here we go
|
||||
if x:
|
||||
|
||||
# This is also now fine
|
||||
a = 123
|
||||
|
||||
else:
|
||||
# But not necessary
|
||||
a = 123
|
||||
|
||||
if y:
|
||||
|
||||
while True:
|
||||
|
||||
"""
|
||||
Long comment here
|
||||
"""
|
||||
a = 123
|
||||
|
||||
if z:
|
||||
|
||||
for _ in range(100):
|
||||
a = 123
|
||||
else:
|
||||
|
||||
try:
|
||||
|
||||
# this should be ok
|
||||
a = 123
|
||||
except:
|
||||
|
||||
"""also this"""
|
||||
a = 123
|
||||
|
||||
|
||||
def bar():
|
||||
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def baz():
|
||||
|
||||
# OK
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def quux():
|
||||
|
||||
new_line = here
|
||||
|
||||
|
||||
class Cls:
|
||||
|
||||
def method(self):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
async def async_fn():
|
||||
"""Docstring."""
|
||||
|
||||
|
||||
@decorated
|
||||
async def async_fn():
|
||||
"""Docstring."""
|
||||
|
||||
|
||||
def top_level(
|
||||
a: int,
|
||||
b: str,
|
||||
) -> Whatever[Generic, Something]:
|
||||
|
||||
def nested(x: int) -> int:
|
||||
pass
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,51 +0,0 @@
|
|||
def foo():
|
||||
"""
|
||||
Docstring
|
||||
"""
|
||||
|
||||
# Here we go
|
||||
if x:
|
||||
|
||||
# This is also now fine
|
||||
a = 123
|
||||
|
||||
else:
|
||||
# But not necessary
|
||||
a = 123
|
||||
|
||||
if y:
|
||||
|
||||
while True:
|
||||
|
||||
"""
|
||||
Long comment here
|
||||
"""
|
||||
a = 123
|
||||
|
||||
if z:
|
||||
|
||||
for _ in range(100):
|
||||
a = 123
|
||||
else:
|
||||
|
||||
try:
|
||||
|
||||
# this should be ok
|
||||
a = 123
|
||||
except:
|
||||
|
||||
"""also this"""
|
||||
a = 123
|
||||
|
||||
|
||||
def bar():
|
||||
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def baz():
|
||||
|
||||
# OK
|
||||
if x:
|
||||
a = 123
|
|
@ -1,51 +0,0 @@
|
|||
def foo():
|
||||
"""
|
||||
Docstring
|
||||
"""
|
||||
|
||||
# Here we go
|
||||
if x:
|
||||
|
||||
# This is also now fine
|
||||
a = 123
|
||||
|
||||
else:
|
||||
# But not necessary
|
||||
a = 123
|
||||
|
||||
if y:
|
||||
|
||||
while True:
|
||||
|
||||
"""
|
||||
Long comment here
|
||||
"""
|
||||
a = 123
|
||||
|
||||
if z:
|
||||
|
||||
for _ in range(100):
|
||||
a = 123
|
||||
else:
|
||||
|
||||
try:
|
||||
|
||||
# this should be ok
|
||||
a = 123
|
||||
except:
|
||||
|
||||
"""also this"""
|
||||
a = 123
|
||||
|
||||
|
||||
def bar():
|
||||
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def baz():
|
||||
|
||||
# OK
|
||||
if x:
|
||||
a = 123
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,11 +0,0 @@
|
|||
async def func() -> (int):
|
||||
return 0
|
||||
|
||||
|
||||
@decorated
|
||||
async def func() -> (int):
|
||||
return 0
|
||||
|
||||
|
||||
async for (item) in async_iter:
|
||||
pass
|
|
@ -1,11 +0,0 @@
|
|||
async def func() -> int:
|
||||
return 0
|
||||
|
||||
|
||||
@decorated
|
||||
async def func() -> int:
|
||||
return 0
|
||||
|
||||
|
||||
async for item in async_iter:
|
||||
pass
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled", "target_version": "py38"}
|
|
@ -1,31 +0,0 @@
|
|||
with \
|
||||
make_context_manager1() as cm1, \
|
||||
make_context_manager2() as cm2, \
|
||||
make_context_manager3() as cm3, \
|
||||
make_context_manager4() as cm4 \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
with \
|
||||
make_context_manager1() as cm1, \
|
||||
make_context_manager2(), \
|
||||
make_context_manager3() as cm3, \
|
||||
make_context_manager4() \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
with \
|
||||
new_new_new1() as cm1, \
|
||||
new_new_new2() \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
with mock.patch.object(
|
||||
self.my_runner, "first_method", autospec=True
|
||||
) as mock_run_adb, mock.patch.object(
|
||||
self.my_runner, "second_method", autospec=True, return_value="foo"
|
||||
):
|
||||
pass
|
|
@ -1,18 +0,0 @@
|
|||
with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
|
||||
pass
|
||||
|
||||
|
||||
with make_context_manager1() as cm1, make_context_manager2(), make_context_manager3() as cm3, make_context_manager4():
|
||||
pass
|
||||
|
||||
|
||||
with new_new_new1() as cm1, new_new_new2():
|
||||
pass
|
||||
|
||||
|
||||
with mock.patch.object(
|
||||
self.my_runner, "first_method", autospec=True
|
||||
) as mock_run_adb, mock.patch.object(
|
||||
self.my_runner, "second_method", autospec=True, return_value="foo"
|
||||
):
|
||||
pass
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled", "target_version": "py39"}
|
|
@ -1,84 +0,0 @@
|
|||
with \
|
||||
make_context_manager1() as cm1, \
|
||||
make_context_manager2() as cm2, \
|
||||
make_context_manager3() as cm3, \
|
||||
make_context_manager4() as cm4 \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
# Leading comment
|
||||
with \
|
||||
make_context_manager1() as cm1, \
|
||||
make_context_manager2(), \
|
||||
make_context_manager3() as cm3, \
|
||||
make_context_manager4() \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
with \
|
||||
new_new_new1() as cm1, \
|
||||
new_new_new2() \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
with (
|
||||
new_new_new1() as cm1,
|
||||
new_new_new2()
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
# Leading comment.
|
||||
with (
|
||||
# First comment.
|
||||
new_new_new1() as cm1,
|
||||
# Second comment.
|
||||
new_new_new2()
|
||||
# Last comment.
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with \
|
||||
this_is_a_very_long_call(looong_arg1=looong_value1, looong_arg2=looong_value2) as cm1, \
|
||||
this_is_a_very_long_call(looong_arg1=looong_value1, looong_arg2=looong_value2, looong_arg3=looong_value3, looong_arg4=looong_value4) as cm2 \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
with mock.patch.object(
|
||||
self.my_runner, "first_method", autospec=True
|
||||
) as mock_run_adb, mock.patch.object(
|
||||
self.my_runner, "second_method", autospec=True, return_value="foo"
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with xxxxxxxx.some_kind_of_method(
|
||||
some_argument=[
|
||||
"first",
|
||||
"second",
|
||||
"third",
|
||||
]
|
||||
).another_method() as cmd:
|
||||
pass
|
||||
|
||||
|
||||
async def func():
|
||||
async with \
|
||||
make_context_manager1() as cm1, \
|
||||
make_context_manager2() as cm2, \
|
||||
make_context_manager3() as cm3, \
|
||||
make_context_manager4() as cm4 \
|
||||
:
|
||||
pass
|
||||
|
||||
async with some_function(
|
||||
argument1, argument2, argument3="some_value"
|
||||
) as some_cm, some_other_function(
|
||||
argument1, argument2, argument3="some_value"
|
||||
):
|
||||
pass
|
|
@ -1,85 +0,0 @@
|
|||
with (
|
||||
make_context_manager1() as cm1,
|
||||
make_context_manager2() as cm2,
|
||||
make_context_manager3() as cm3,
|
||||
make_context_manager4() as cm4,
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
# Leading comment
|
||||
with (
|
||||
make_context_manager1() as cm1,
|
||||
make_context_manager2(),
|
||||
make_context_manager3() as cm3,
|
||||
make_context_manager4(),
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with new_new_new1() as cm1, new_new_new2():
|
||||
pass
|
||||
|
||||
|
||||
with new_new_new1() as cm1, new_new_new2():
|
||||
pass
|
||||
|
||||
|
||||
# Leading comment.
|
||||
with (
|
||||
# First comment.
|
||||
new_new_new1() as cm1,
|
||||
# Second comment.
|
||||
new_new_new2(),
|
||||
# Last comment.
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with (
|
||||
this_is_a_very_long_call(
|
||||
looong_arg1=looong_value1, looong_arg2=looong_value2
|
||||
) as cm1,
|
||||
this_is_a_very_long_call(
|
||||
looong_arg1=looong_value1,
|
||||
looong_arg2=looong_value2,
|
||||
looong_arg3=looong_value3,
|
||||
looong_arg4=looong_value4,
|
||||
) as cm2,
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with (
|
||||
mock.patch.object(self.my_runner, "first_method", autospec=True) as mock_run_adb,
|
||||
mock.patch.object(
|
||||
self.my_runner, "second_method", autospec=True, return_value="foo"
|
||||
),
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with xxxxxxxx.some_kind_of_method(
|
||||
some_argument=[
|
||||
"first",
|
||||
"second",
|
||||
"third",
|
||||
]
|
||||
).another_method() as cmd:
|
||||
pass
|
||||
|
||||
|
||||
async def func():
|
||||
async with (
|
||||
make_context_manager1() as cm1,
|
||||
make_context_manager2() as cm2,
|
||||
make_context_manager3() as cm3,
|
||||
make_context_manager4() as cm4,
|
||||
):
|
||||
pass
|
||||
|
||||
async with (
|
||||
some_function(argument1, argument2, argument3="some_value") as some_cm,
|
||||
some_other_function(argument1, argument2, argument3="some_value"),
|
||||
):
|
||||
pass
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled", "target_version": "py310"}
|
|
@ -1,15 +0,0 @@
|
|||
# This file uses pattern matching introduced in Python 3.10.
|
||||
|
||||
|
||||
match http_code:
|
||||
case 404:
|
||||
print("Not found")
|
||||
|
||||
|
||||
with \
|
||||
make_context_manager1() as cm1, \
|
||||
make_context_manager2() as cm2, \
|
||||
make_context_manager3() as cm3, \
|
||||
make_context_manager4() as cm4 \
|
||||
:
|
||||
pass
|
|
@ -1,15 +0,0 @@
|
|||
# This file uses pattern matching introduced in Python 3.10.
|
||||
|
||||
|
||||
match http_code:
|
||||
case 404:
|
||||
print("Not found")
|
||||
|
||||
|
||||
with (
|
||||
make_context_manager1() as cm1,
|
||||
make_context_manager2() as cm2,
|
||||
make_context_manager3() as cm3,
|
||||
make_context_manager4() as cm4,
|
||||
):
|
||||
pass
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled", "target_version": "py311"}
|
|
@ -1,16 +0,0 @@
|
|||
# This file uses except* clause in Python 3.11.
|
||||
|
||||
|
||||
try:
|
||||
some_call()
|
||||
except* Error as e:
|
||||
pass
|
||||
|
||||
|
||||
with \
|
||||
make_context_manager1() as cm1, \
|
||||
make_context_manager2() as cm2, \
|
||||
make_context_manager3() as cm3, \
|
||||
make_context_manager4() as cm4 \
|
||||
:
|
||||
pass
|
|
@ -1,16 +0,0 @@
|
|||
# This file uses except* clause in Python 3.11.
|
||||
|
||||
|
||||
try:
|
||||
some_call()
|
||||
except* Error as e:
|
||||
pass
|
||||
|
||||
|
||||
with (
|
||||
make_context_manager1() as cm1,
|
||||
make_context_manager2() as cm2,
|
||||
make_context_manager3() as cm3,
|
||||
make_context_manager4() as cm4,
|
||||
):
|
||||
pass
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,24 +0,0 @@
|
|||
# This file doesn't use any Python 3.9+ only grammars.
|
||||
|
||||
|
||||
# Make sure parens around a single context manager don't get autodetected as
|
||||
# Python 3.9+.
|
||||
with (a):
|
||||
pass
|
||||
|
||||
|
||||
with \
|
||||
make_context_manager1() as cm1, \
|
||||
make_context_manager2() as cm2, \
|
||||
make_context_manager3() as cm3, \
|
||||
make_context_manager4() as cm4 \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
with mock.patch.object(
|
||||
self.my_runner, "first_method", autospec=True
|
||||
) as mock_run_adb, mock.patch.object(
|
||||
self.my_runner, "second_method", autospec=True, return_value="foo"
|
||||
):
|
||||
pass
|
|
@ -1,19 +0,0 @@
|
|||
# This file doesn't use any Python 3.9+ only grammars.
|
||||
|
||||
|
||||
# Make sure parens around a single context manager don't get autodetected as
|
||||
# Python 3.9+.
|
||||
with a:
|
||||
pass
|
||||
|
||||
|
||||
with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
|
||||
pass
|
||||
|
||||
|
||||
with mock.patch.object(
|
||||
self.my_runner, "first_method", autospec=True
|
||||
) as mock_run_adb, mock.patch.object(
|
||||
self.my_runner, "second_method", autospec=True, return_value="foo"
|
||||
):
|
||||
pass
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled", "target_version": "py39"}
|
|
@ -1,17 +0,0 @@
|
|||
# This file uses parenthesized context managers introduced in Python 3.9.
|
||||
|
||||
|
||||
with \
|
||||
make_context_manager1() as cm1, \
|
||||
make_context_manager2() as cm2, \
|
||||
make_context_manager3() as cm3, \
|
||||
make_context_manager4() as cm4 \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
with (
|
||||
new_new_new1() as cm1,
|
||||
new_new_new2()
|
||||
):
|
||||
pass
|
|
@ -1,14 +0,0 @@
|
|||
# This file uses parenthesized context managers introduced in Python 3.9.
|
||||
|
||||
|
||||
with (
|
||||
make_context_manager1() as cm1,
|
||||
make_context_manager2() as cm2,
|
||||
make_context_manager3() as cm3,
|
||||
make_context_manager4() as cm4,
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with new_new_new1() as cm1, new_new_new2():
|
||||
pass
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,10 +0,0 @@
|
|||
def do_not_touch_this_prefix():
|
||||
R"""There was a bug where docstring prefixes would be normalized even with -S."""
|
||||
|
||||
|
||||
def do_not_touch_this_prefix2():
|
||||
FR'There was a bug where docstring prefixes would be normalized even with -S.'
|
||||
|
||||
|
||||
def do_not_touch_this_prefix3():
|
||||
u'''There was a bug where docstring prefixes would be normalized even with -S.'''
|
|
@ -1,10 +0,0 @@
|
|||
def do_not_touch_this_prefix():
|
||||
R"""There was a bug where docstring prefixes would be normalized even with -S."""
|
||||
|
||||
|
||||
def do_not_touch_this_prefix2():
|
||||
FR'There was a bug where docstring prefixes would be normalized even with -S.'
|
||||
|
||||
|
||||
def do_not_touch_this_prefix3():
|
||||
u'''There was a bug where docstring prefixes would be normalized even with -S.'''
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,69 +0,0 @@
|
|||
from typing import NoReturn, Protocol, Union, overload
|
||||
|
||||
class Empty:
|
||||
...
|
||||
|
||||
def dummy(a): ...
|
||||
async def other(b): ...
|
||||
|
||||
|
||||
@overload
|
||||
def a(arg: int) -> int: ...
|
||||
@overload
|
||||
def a(arg: str) -> str: ...
|
||||
@overload
|
||||
def a(arg: object) -> NoReturn: ...
|
||||
def a(arg: Union[int, str, object]) -> Union[int, str]:
|
||||
if not isinstance(arg, (int, str)):
|
||||
raise TypeError
|
||||
return arg
|
||||
|
||||
class Proto(Protocol):
|
||||
def foo(self, a: int) -> int:
|
||||
...
|
||||
|
||||
def bar(self, b: str) -> str: ...
|
||||
def baz(self, c: bytes) -> str:
|
||||
...
|
||||
|
||||
|
||||
def dummy_two():
|
||||
...
|
||||
@dummy
|
||||
def dummy_three():
|
||||
...
|
||||
|
||||
def dummy_four():
|
||||
...
|
||||
|
||||
@overload
|
||||
def b(arg: int) -> int: ...
|
||||
|
||||
@overload
|
||||
def b(arg: str) -> str: ...
|
||||
@overload
|
||||
def b(arg: object) -> NoReturn: ...
|
||||
|
||||
def b(arg: Union[int, str, object]) -> Union[int, str]:
|
||||
if not isinstance(arg, (int, str)):
|
||||
raise TypeError
|
||||
return arg
|
||||
|
||||
def has_comment():
|
||||
... # still a dummy
|
||||
|
||||
if some_condition:
|
||||
...
|
||||
|
||||
if already_dummy: ...
|
||||
|
||||
class AsyncCls:
|
||||
async def async_method(self):
|
||||
...
|
||||
|
||||
async def async_function(self):
|
||||
...
|
||||
|
||||
@decorated
|
||||
async def async_function(self):
|
||||
...
|
|
@ -1,72 +0,0 @@
|
|||
from typing import NoReturn, Protocol, Union, overload
|
||||
|
||||
|
||||
class Empty: ...
|
||||
|
||||
|
||||
def dummy(a): ...
|
||||
async def other(b): ...
|
||||
|
||||
|
||||
@overload
|
||||
def a(arg: int) -> int: ...
|
||||
@overload
|
||||
def a(arg: str) -> str: ...
|
||||
@overload
|
||||
def a(arg: object) -> NoReturn: ...
|
||||
def a(arg: Union[int, str, object]) -> Union[int, str]:
|
||||
if not isinstance(arg, (int, str)):
|
||||
raise TypeError
|
||||
return arg
|
||||
|
||||
|
||||
class Proto(Protocol):
|
||||
def foo(self, a: int) -> int: ...
|
||||
|
||||
def bar(self, b: str) -> str: ...
|
||||
def baz(self, c: bytes) -> str: ...
|
||||
|
||||
|
||||
def dummy_two(): ...
|
||||
@dummy
|
||||
def dummy_three(): ...
|
||||
|
||||
|
||||
def dummy_four(): ...
|
||||
|
||||
|
||||
@overload
|
||||
def b(arg: int) -> int: ...
|
||||
|
||||
|
||||
@overload
|
||||
def b(arg: str) -> str: ...
|
||||
@overload
|
||||
def b(arg: object) -> NoReturn: ...
|
||||
|
||||
|
||||
def b(arg: Union[int, str, object]) -> Union[int, str]:
|
||||
if not isinstance(arg, (int, str)):
|
||||
raise TypeError
|
||||
return arg
|
||||
|
||||
|
||||
def has_comment(): ... # still a dummy
|
||||
|
||||
|
||||
if some_condition:
|
||||
...
|
||||
|
||||
if already_dummy:
|
||||
...
|
||||
|
||||
|
||||
class AsyncCls:
|
||||
async def async_method(self): ...
|
||||
|
||||
|
||||
async def async_function(self): ...
|
||||
|
||||
|
||||
@decorated
|
||||
async def async_function(self): ...
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,116 +0,0 @@
|
|||
# Warning! This file contains form feeds (ASCII 0x0C, often represented by \f or ^L).
|
||||
# These may be invisible in your editor: ensure you can see them before making changes here.
|
||||
|
||||
# There's one at the start that'll get stripped
|
||||
|
||||
# Comment and statement processing is different enough that we'll test variations of both
|
||||
# contexts here
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
\
|
||||
#
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
||||
# form feed after a dedent
|
||||
def foo():
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
||||
# form feeds are prohibited inside blocks, or on a line with nonwhitespace
|
||||
defbar(a=1,b:bool=False):
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class Baz:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def something(self):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
#
|
||||
pass
|
||||
pass #
|
||||
a = 1
|
||||
#
|
||||
pass
|
||||
a = 1
|
||||
|
||||
a = [
|
||||
|
||||
]
|
||||
|
||||
# as internal whitespace of a comment is allowed but why
|
||||
"form feed literal in a string is okay"
|
||||
|
||||
# form feeds at the very end get removed.
|
|
@ -1,103 +0,0 @@
|
|||
# Warning! This file contains form feeds (ASCII 0x0C, often represented by \f or ^L).
|
||||
# These may be invisible in your editor: ensure you can see them before making changes here.
|
||||
|
||||
# There's one at the start that'll get stripped
|
||||
|
||||
# Comment and statement processing is different enough that we'll test variations of both
|
||||
# contexts here
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
||||
# form feed after a dedent
|
||||
def foo():
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
# form feeds are prohibited inside blocks, or on a line with nonwhitespace
|
||||
def bar(a=1, b: bool = False):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class Baz:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def something(self):
|
||||
pass
|
||||
|
||||
|
||||
#
|
||||
pass
|
||||
pass #
|
||||
a = 1
|
||||
#
|
||||
pass
|
||||
a = 1
|
||||
|
||||
a = []
|
||||
|
||||
# as internal whitespace of a comment is allowed but why
|
||||
"form feed literal in a string is okay"
|
||||
|
||||
# form feeds at the very end get removed.
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,33 +0,0 @@
|
|||
def line_before_docstring():
|
||||
|
||||
"""Please move me up"""
|
||||
|
||||
|
||||
class LineBeforeDocstring:
|
||||
|
||||
"""Please move me up"""
|
||||
|
||||
|
||||
class EvenIfThereIsAMethodAfter:
|
||||
|
||||
"""I'm the docstring"""
|
||||
def method(self):
|
||||
pass
|
||||
|
||||
|
||||
class TwoLinesBeforeDocstring:
|
||||
|
||||
|
||||
"""I want to be treated the same as if I were closer"""
|
||||
|
||||
|
||||
class MultilineDocstringsAsWell:
|
||||
|
||||
"""I'm so far
|
||||
|
||||
and on so many lines...
|
||||
"""
|
||||
|
||||
class SingleQuotedDocstring:
|
||||
|
||||
"I'm a docstring but I don't even get triple quotes."
|
|
@ -1,28 +0,0 @@
|
|||
def line_before_docstring():
|
||||
"""Please move me up"""
|
||||
|
||||
|
||||
class LineBeforeDocstring:
|
||||
"""Please move me up"""
|
||||
|
||||
|
||||
class EvenIfThereIsAMethodAfter:
|
||||
"""I'm the docstring"""
|
||||
|
||||
def method(self):
|
||||
pass
|
||||
|
||||
|
||||
class TwoLinesBeforeDocstring:
|
||||
"""I want to be treated the same as if I were closer"""
|
||||
|
||||
|
||||
class MultilineDocstringsAsWell:
|
||||
"""I'm so far
|
||||
|
||||
and on so many lines...
|
||||
"""
|
||||
|
||||
|
||||
class SingleQuotedDocstring:
|
||||
"I'm a docstring but I don't even get triple quotes."
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled", "target_version": "py310"}
|
|
@ -1,7 +0,0 @@
|
|||
match x:
|
||||
case "abcd" | "abcd" | "abcd" :
|
||||
pass
|
||||
case "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd":
|
||||
pass
|
||||
case xxxxxxxxxxxxxxxxxxxxxxx:
|
||||
pass
|
|
@ -1,23 +0,0 @@
|
|||
match x:
|
||||
case "abcd" | "abcd" | "abcd":
|
||||
pass
|
||||
case (
|
||||
"abcd"
|
||||
| "abcd"
|
||||
| "abcd"
|
||||
| "abcd"
|
||||
| "abcd"
|
||||
| "abcd"
|
||||
| "abcd"
|
||||
| "abcd"
|
||||
| "abcd"
|
||||
| "abcd"
|
||||
| "abcd"
|
||||
| "abcd"
|
||||
| "abcd"
|
||||
| "abcd"
|
||||
| "abcd"
|
||||
):
|
||||
pass
|
||||
case xxxxxxxxxxxxxxxxxxxxxxx:
|
||||
pass
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled", "target_version": "py310"}
|
|
@ -1,14 +0,0 @@
|
|||
match maybe, multiple:
|
||||
case perhaps, 5:
|
||||
pass
|
||||
case perhaps, 6,:
|
||||
pass
|
||||
|
||||
|
||||
match more := (than, one), indeed,:
|
||||
case _, (5, 6):
|
||||
pass
|
||||
case [[5], (6)], [7],:
|
||||
pass
|
||||
case _:
|
||||
pass
|
|
@ -1,20 +0,0 @@
|
|||
match maybe, multiple:
|
||||
case perhaps, 5:
|
||||
pass
|
||||
case (
|
||||
perhaps,
|
||||
6,
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
match more := (than, one), indeed,:
|
||||
case _, (5, 6):
|
||||
pass
|
||||
case (
|
||||
[[5], (6)],
|
||||
[7],
|
||||
):
|
||||
pass
|
||||
case _:
|
||||
pass
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,2 +0,0 @@
|
|||
x[(a:=0):]
|
||||
x[:(a:=0)]
|
|
@ -1,2 +0,0 @@
|
|||
x[(a := 0) :]
|
||||
x[: (a := 0)]
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,20 +0,0 @@
|
|||
("" % a) ** 2
|
||||
("" % a)[0]
|
||||
("" % a)()
|
||||
("" % a).b
|
||||
|
||||
2 * ("" % a)
|
||||
2 @ ("" % a)
|
||||
2 / ("" % a)
|
||||
2 // ("" % a)
|
||||
2 % ("" % a)
|
||||
+("" % a)
|
||||
b + ("" % a)
|
||||
-("" % a)
|
||||
b - ("" % a)
|
||||
b + -("" % a)
|
||||
~("" % a)
|
||||
2 ** ("" % a)
|
||||
await ("" % a)
|
||||
b[("" % a)]
|
||||
b(("" % a))
|
|
@ -1,20 +0,0 @@
|
|||
("" % a) ** 2
|
||||
("" % a)[0]
|
||||
("" % a)()
|
||||
("" % a).b
|
||||
|
||||
2 * ("" % a)
|
||||
2 @ ("" % a)
|
||||
2 / ("" % a)
|
||||
2 // ("" % a)
|
||||
2 % ("" % a)
|
||||
+("" % a)
|
||||
b + "" % a
|
||||
-("" % a)
|
||||
b - "" % a
|
||||
b + -("" % a)
|
||||
~("" % a)
|
||||
2 ** ("" % a)
|
||||
await ("" % a)
|
||||
b[("" % a)]
|
||||
b(("" % a))
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,11 +0,0 @@
|
|||
a = 1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1
|
||||
b = 1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1
|
||||
c = 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1 ** 1
|
||||
d = 1**1 ** 1**1 ** 1**1 ** 1**1 ** 1**1**1 ** 1 ** 1**1 ** 1**1**1**1**1 ** 1 ** 1**1**1 **1**1** 1 ** 1 ** 1
|
||||
e = 𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟
|
||||
f = 𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟
|
||||
|
||||
a = 1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0
|
||||
b = 1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0
|
||||
c = 1.0 ** 1.0 ** 1.0 ** 1.0 ** 1.0 ** 1.0 ** 1.0 ** 1.0 ** 1.0 ** 1.0 ** 1.0 ** 1.0 ** 1.0 ** 1.0 ** 1.0 ** 1.0 ** 1.0
|
||||
d = 1.0**1.0 ** 1.0**1.0 ** 1.0**1.0 ** 1.0**1.0 ** 1.0**1.0**1.0 ** 1.0 ** 1.0**1.0 ** 1.0**1.0**1.0
|
|
@ -1,83 +0,0 @@
|
|||
a = 1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1
|
||||
b = (
|
||||
1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
** 1
|
||||
)
|
||||
c = 1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1
|
||||
d = 1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1
|
||||
e = 𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟**𨉟
|
||||
f = (
|
||||
𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
** 𨉟
|
||||
)
|
||||
|
||||
a = 1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0
|
||||
b = (
|
||||
1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
** 1.0
|
||||
)
|
||||
c = 1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0
|
||||
d = 1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0**1.0
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,106 +0,0 @@
|
|||
first_item, second_item = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
some_dict["with_a_long_key"] = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
# Make sure it works when the RHS only has one pair of (optional) parens.
|
||||
first_item, second_item = (
|
||||
some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
|
||||
)
|
||||
|
||||
some_dict["with_a_long_key"] = (
|
||||
some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
|
||||
)
|
||||
|
||||
# Make sure chaining assignments work.
|
||||
first_item, second_item, third_item, forth_item = m["everything"] = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
# Make sure when the RHS's first split at the non-optional paren fits,
|
||||
# we split there instead of the outer RHS optional paren.
|
||||
first_item, second_item = some_looooooooong_module.some_loooooog_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
(
|
||||
first_item,
|
||||
second_item,
|
||||
third_item,
|
||||
forth_item,
|
||||
fifth_item,
|
||||
last_item_very_loooooong,
|
||||
) = some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
(
|
||||
first_item,
|
||||
second_item,
|
||||
third_item,
|
||||
forth_item,
|
||||
fifth_item,
|
||||
last_item_very_loooooong,
|
||||
) = everything = some_looooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
|
||||
# Make sure unsplittable type ignore won't be moved.
|
||||
some_kind_of_table[some_key] = util.some_function( # type: ignore # noqa: E501
|
||||
some_arg
|
||||
).intersection(pk_cols)
|
||||
|
||||
some_kind_of_table[
|
||||
some_key
|
||||
] = lambda obj: obj.some_long_named_method() # type: ignore # noqa: E501
|
||||
|
||||
some_kind_of_table[
|
||||
some_key # type: ignore # noqa: E501
|
||||
] = lambda obj: obj.some_long_named_method()
|
||||
|
||||
|
||||
# Make when when the left side of assignment plus the opening paren "... = (" is
|
||||
# exactly line length limit + 1, it won't be split like that.
|
||||
xxxxxxxxx_yyy_zzzzzzzz[
|
||||
xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1)
|
||||
] = 1
|
||||
|
||||
|
||||
# Right side of assignment contains un-nested pairs of inner parens.
|
||||
some_kind_of_instance.some_kind_of_map[a_key] = (
|
||||
isinstance(some_var, SomeClass)
|
||||
and table.something_and_something != table.something_else
|
||||
) or (
|
||||
isinstance(some_other_var, BaseClass) and table.something != table.some_other_thing
|
||||
)
|
||||
|
||||
# Multiple targets
|
||||
a = b = (
|
||||
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
)
|
||||
|
||||
a = b = c = d = e = f = g = (
|
||||
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
) = i = j = (
|
||||
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
)
|
||||
|
||||
a = (
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) = c
|
||||
|
||||
a = (
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) = (
|
||||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
) = ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
@ -1,106 +0,0 @@
|
|||
first_item, second_item = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
some_dict["with_a_long_key"] = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
# Make sure it works when the RHS only has one pair of (optional) parens.
|
||||
first_item, second_item = (
|
||||
some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
|
||||
)
|
||||
|
||||
some_dict["with_a_long_key"] = (
|
||||
some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
|
||||
)
|
||||
|
||||
# Make sure chaining assignments work.
|
||||
first_item, second_item, third_item, forth_item = m["everything"] = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
# Make sure when the RHS's first split at the non-optional paren fits,
|
||||
# we split there instead of the outer RHS optional paren.
|
||||
first_item, second_item = some_looooooooong_module.some_loooooog_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
(
|
||||
first_item,
|
||||
second_item,
|
||||
third_item,
|
||||
forth_item,
|
||||
fifth_item,
|
||||
last_item_very_loooooong,
|
||||
) = some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
(
|
||||
first_item,
|
||||
second_item,
|
||||
third_item,
|
||||
forth_item,
|
||||
fifth_item,
|
||||
last_item_very_loooooong,
|
||||
) = everything = some_looooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
|
||||
# Make sure unsplittable type ignore won't be moved.
|
||||
some_kind_of_table[some_key] = util.some_function( # type: ignore # noqa: E501
|
||||
some_arg
|
||||
).intersection(pk_cols)
|
||||
|
||||
some_kind_of_table[
|
||||
some_key
|
||||
] = lambda obj: obj.some_long_named_method() # type: ignore # noqa: E501
|
||||
|
||||
some_kind_of_table[
|
||||
some_key # type: ignore # noqa: E501
|
||||
] = lambda obj: obj.some_long_named_method()
|
||||
|
||||
|
||||
# Make when when the left side of assignment plus the opening paren "... = (" is
|
||||
# exactly line length limit + 1, it won't be split like that.
|
||||
xxxxxxxxx_yyy_zzzzzzzz[
|
||||
xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1)
|
||||
] = 1
|
||||
|
||||
|
||||
# Right side of assignment contains un-nested pairs of inner parens.
|
||||
some_kind_of_instance.some_kind_of_map[a_key] = (
|
||||
isinstance(some_var, SomeClass)
|
||||
and table.something_and_something != table.something_else
|
||||
) or (
|
||||
isinstance(some_other_var, BaseClass) and table.something != table.some_other_thing
|
||||
)
|
||||
|
||||
# Multiple targets
|
||||
a = b = (
|
||||
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
)
|
||||
|
||||
a = b = c = d = e = f = g = (
|
||||
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
) = i = j = (
|
||||
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
)
|
||||
|
||||
a = (
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) = c
|
||||
|
||||
a = (
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) = (
|
||||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
) = ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,8 +0,0 @@
|
|||
foo = 123 # fmt: skip # noqa: E501 # pylint
|
||||
bar = (
|
||||
123 ,
|
||||
( 1 + 5 ) # pylint # fmt:skip
|
||||
)
|
||||
baz = "a" + "b" # pylint; fmt: skip; noqa: E501
|
||||
skip_will_not_work = "a" + "b" # pylint fmt:skip
|
||||
skip_will_not_work2 = "a" + "b" # some text; fmt:skip happens to be part of it
|
|
@ -1,8 +0,0 @@
|
|||
foo = 123 # fmt: skip # noqa: E501 # pylint
|
||||
bar = (
|
||||
123 ,
|
||||
( 1 + 5 ) # pylint # fmt:skip
|
||||
)
|
||||
baz = "a" + "b" # pylint; fmt: skip; noqa: E501
|
||||
skip_will_not_work = "a" + "b" # pylint fmt:skip
|
||||
skip_will_not_work2 = "a" + "b" # some text; fmt:skip happens to be part of it
|
|
@ -1 +0,0 @@
|
|||
{"preview": "enabled"}
|
|
@ -1,24 +0,0 @@
|
|||
e = {
|
||||
"a": fun(msg, "ts"),
|
||||
"longggggggggggggggid": ...,
|
||||
"longgggggggggggggggggggkey": ..., "created": ...
|
||||
# "longkey": ...
|
||||
}
|
||||
f = [
|
||||
arg1,
|
||||
arg2,
|
||||
arg3, arg4
|
||||
# comment
|
||||
]
|
||||
g = (
|
||||
arg1,
|
||||
arg2,
|
||||
arg3, arg4
|
||||
# comment
|
||||
)
|
||||
h = {
|
||||
arg1,
|
||||
arg2,
|
||||
arg3, arg4
|
||||
# comment
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
e = {
|
||||
"a": fun(msg, "ts"),
|
||||
"longggggggggggggggid": ...,
|
||||
"longgggggggggggggggggggkey": ...,
|
||||
"created": ...,
|
||||
# "longkey": ...
|
||||
}
|
||||
f = [
|
||||
arg1,
|
||||
arg2,
|
||||
arg3,
|
||||
arg4,
|
||||
# comment
|
||||
]
|
||||
g = (
|
||||
arg1,
|
||||
arg2,
|
||||
arg3,
|
||||
arg4,
|
||||
# comment
|
||||
)
|
||||
h = {
|
||||
arg1,
|
||||
arg2,
|
||||
arg3,
|
||||
arg4,
|
||||
# comment
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{"target_version": "py310"}
|
|
@ -1,19 +0,0 @@
|
|||
def http_status(status):
|
||||
|
||||
match status:
|
||||
|
||||
case 400:
|
||||
|
||||
return "Bad request"
|
||||
|
||||
case 401:
|
||||
|
||||
return "Unauthorized"
|
||||
|
||||
case 403:
|
||||
|
||||
return "Forbidden"
|
||||
|
||||
case 404:
|
||||
|
||||
return "Not found"
|
|
@ -1,13 +0,0 @@
|
|||
def http_status(status):
|
||||
match status:
|
||||
case 400:
|
||||
return "Bad request"
|
||||
|
||||
case 401:
|
||||
return "Unauthorized"
|
||||
|
||||
case 403:
|
||||
return "Forbidden"
|
||||
|
||||
case 404:
|
||||
return "Not found"
|
|
@ -1,67 +0,0 @@
|
|||
long_kwargs_single_line = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=some_long_value_name_foo_bar_baz if some_boolean_variable else some_fallback_value_foo_bar_baz,
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
multiline_kwargs_indented = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz,
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
imploding_kwargs = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=a
|
||||
if foo
|
||||
else b,
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
imploding_line = (
|
||||
1
|
||||
if 1 + 1 == 2
|
||||
else 0
|
||||
)
|
||||
|
||||
exploding_line = "hello this is a slightly long string" if some_long_value_name_foo_bar_baz else "this one is a little shorter"
|
||||
|
||||
positional_argument_test(some_long_value_name_foo_bar_baz if some_boolean_variable else some_fallback_value_foo_bar_baz)
|
||||
|
||||
def weird_default_argument(x=some_long_value_name_foo_bar_baz
|
||||
if SOME_CONSTANT
|
||||
else some_fallback_value_foo_bar_baz):
|
||||
pass
|
||||
|
||||
nested = "hello this is a slightly long string" if (some_long_value_name_foo_bar_baz if
|
||||
nesting_test_expressions else some_fallback_value_foo_bar_baz) \
|
||||
else "this one is a little shorter"
|
||||
|
||||
generator_expression = (
|
||||
some_long_value_name_foo_bar_baz if some_boolean_variable else some_fallback_value_foo_bar_baz for some_boolean_variable in some_iterable
|
||||
)
|
||||
|
||||
|
||||
def limit_offset_sql(self, low_mark, high_mark):
|
||||
"""Return LIMIT/OFFSET SQL clause."""
|
||||
limit, offset = self._get_limit_offset_params(low_mark, high_mark)
|
||||
return " ".join(
|
||||
sql
|
||||
for sql in (
|
||||
"LIMIT %d" % limit if limit else None,
|
||||
("OFFSET %d" % offset) if offset else None,
|
||||
)
|
||||
if sql
|
||||
)
|
||||
|
||||
|
||||
def something():
|
||||
clone._iterable_class = (
|
||||
NamedValuesListIterable
|
||||
if named
|
||||
else FlatValuesListIterable
|
||||
if flat
|
||||
else ValuesListIterable
|
||||
)
|
|
@ -1,90 +0,0 @@
|
|||
long_kwargs_single_line = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=(
|
||||
some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz
|
||||
),
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
multiline_kwargs_indented = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=(
|
||||
some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz
|
||||
),
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
imploding_kwargs = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=a if foo else b,
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
imploding_line = 1 if 1 + 1 == 2 else 0
|
||||
|
||||
exploding_line = (
|
||||
"hello this is a slightly long string"
|
||||
if some_long_value_name_foo_bar_baz
|
||||
else "this one is a little shorter"
|
||||
)
|
||||
|
||||
positional_argument_test(
|
||||
some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz
|
||||
)
|
||||
|
||||
|
||||
def weird_default_argument(
|
||||
x=(
|
||||
some_long_value_name_foo_bar_baz
|
||||
if SOME_CONSTANT
|
||||
else some_fallback_value_foo_bar_baz
|
||||
),
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
nested = (
|
||||
"hello this is a slightly long string"
|
||||
if (
|
||||
some_long_value_name_foo_bar_baz
|
||||
if nesting_test_expressions
|
||||
else some_fallback_value_foo_bar_baz
|
||||
)
|
||||
else "this one is a little shorter"
|
||||
)
|
||||
|
||||
generator_expression = (
|
||||
(
|
||||
some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz
|
||||
)
|
||||
for some_boolean_variable in some_iterable
|
||||
)
|
||||
|
||||
|
||||
def limit_offset_sql(self, low_mark, high_mark):
|
||||
"""Return LIMIT/OFFSET SQL clause."""
|
||||
limit, offset = self._get_limit_offset_params(low_mark, high_mark)
|
||||
return " ".join(
|
||||
sql
|
||||
for sql in (
|
||||
"LIMIT %d" % limit if limit else None,
|
||||
("OFFSET %d" % offset) if offset else None,
|
||||
)
|
||||
if sql
|
||||
)
|
||||
|
||||
|
||||
def something():
|
||||
clone._iterable_class = (
|
||||
NamedValuesListIterable
|
||||
if named
|
||||
else FlatValuesListIterable if flat else ValuesListIterable
|
||||
)
|
|
@ -1,30 +0,0 @@
|
|||
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]: ...
|
|
@ -1,32 +0,0 @@
|
|||
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]: ...
|
|
@ -1,16 +0,0 @@
|
|||
# flags: --preview --skip-string-normalization
|
||||
class C:
|
||||
|
||||
r"""Raw"""
|
||||
|
||||
def f():
|
||||
|
||||
r"""Raw"""
|
||||
|
||||
class SingleQuotes:
|
||||
|
||||
|
||||
r'''Raw'''
|
||||
|
||||
class UpperCaseR:
|
||||
R"""Raw"""
|
|
@ -1,14 +0,0 @@
|
|||
class C:
|
||||
r"""Raw"""
|
||||
|
||||
|
||||
def f():
|
||||
r"""Raw"""
|
||||
|
||||
|
||||
class SingleQuotes:
|
||||
r'''Raw'''
|
||||
|
||||
|
||||
class UpperCaseR:
|
||||
R"""Raw"""
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"preview": "enabled"
|
||||
}
|
|
@ -1,141 +0,0 @@
|
|||
def foo_brackets(request):
|
||||
return JsonResponse(
|
||||
{
|
||||
"var_1": foo,
|
||||
"var_2": bar,
|
||||
}
|
||||
)
|
||||
|
||||
def foo_square_brackets(request):
|
||||
return JsonResponse(
|
||||
[
|
||||
"var_1",
|
||||
"var_2",
|
||||
]
|
||||
)
|
||||
|
||||
func({"a": 37, "b": 42, "c": 927, "aaaaaaaaaaaaaaaaaaaaaaaaa": 11111111111111111111111111111111111111111})
|
||||
|
||||
func(["random_string_number_one","random_string_number_two","random_string_number_three","random_string_number_four"])
|
||||
|
||||
func(
|
||||
{
|
||||
# expand me
|
||||
'a':37,
|
||||
'b':42,
|
||||
'c':927
|
||||
}
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
]
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
],
|
||||
)
|
||||
|
||||
func( # a
|
||||
[ # b
|
||||
"c", # c
|
||||
"d", # d
|
||||
"e", # e
|
||||
] # f
|
||||
) # g
|
||||
|
||||
func( # a
|
||||
{ # b
|
||||
"c": 1, # c
|
||||
"d": 2, # d
|
||||
"e": 3, # e
|
||||
} # f
|
||||
) # g
|
||||
|
||||
func(
|
||||
# preserve me
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
)
|
||||
|
||||
func(
|
||||
[ # preserve me but hug brackets
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
# preserve me but hug brackets
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
"c",
|
||||
# preserve me but hug brackets
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
# preserve me but hug brackets
|
||||
]
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
] # preserve me but hug brackets
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
# preserve me
|
||||
)
|
||||
|
||||
func([x for x in "short line"])
|
||||
func([x for x in "long line long line long line long line long line long line long line"])
|
||||
func([x for x in [x for x in "long line long line long line long line long line long line long line"]])
|
||||
|
||||
func({"short line"})
|
||||
func({"long line", "long long line", "long long long line", "long long long long line", "long long long long long line"})
|
||||
func({{"long line", "long long line", "long long long line", "long long long long line", "long long long long long line"}})
|
||||
|
||||
foooooooooooooooooooo(
|
||||
[{c: n + 1 for c in range(256)} for n in range(100)] + [{}], {size}
|
||||
)
|
||||
|
||||
baaaaaaaaaaaaar(
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], {x}, "a string", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
)
|
||||
|
||||
foo(*["long long long long long line", "long long long long long line", "long long long long long line"])
|
||||
|
||||
foo(*[str(i) for i in range(100000000000000000000000000000000000000000000000000000000000)])
|
|
@ -1,159 +0,0 @@
|
|||
def foo_brackets(request):
|
||||
return JsonResponse({
|
||||
"var_1": foo,
|
||||
"var_2": bar,
|
||||
})
|
||||
|
||||
|
||||
def foo_square_brackets(request):
|
||||
return JsonResponse([
|
||||
"var_1",
|
||||
"var_2",
|
||||
])
|
||||
|
||||
|
||||
func({
|
||||
"a": 37,
|
||||
"b": 42,
|
||||
"c": 927,
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaa": 11111111111111111111111111111111111111111,
|
||||
})
|
||||
|
||||
func([
|
||||
"random_string_number_one",
|
||||
"random_string_number_two",
|
||||
"random_string_number_three",
|
||||
"random_string_number_four",
|
||||
])
|
||||
|
||||
func({
|
||||
# expand me
|
||||
"a": 37,
|
||||
"b": 42,
|
||||
"c": 927,
|
||||
})
|
||||
|
||||
func([
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
])
|
||||
|
||||
func(
|
||||
[
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
],
|
||||
)
|
||||
|
||||
func([ # a # b
|
||||
"c", # c
|
||||
"d", # d
|
||||
"e", # e
|
||||
]) # f # g
|
||||
|
||||
func({ # a # b
|
||||
"c": 1, # c
|
||||
"d": 2, # d
|
||||
"e": 3, # e
|
||||
}) # f # g
|
||||
|
||||
func(
|
||||
# preserve me
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
)
|
||||
|
||||
func([ # preserve me but hug brackets
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
])
|
||||
|
||||
func([
|
||||
# preserve me but hug brackets
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
])
|
||||
|
||||
func([
|
||||
"c",
|
||||
# preserve me but hug brackets
|
||||
"d",
|
||||
"e",
|
||||
])
|
||||
|
||||
func([
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
# preserve me but hug brackets
|
||||
])
|
||||
|
||||
func([
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]) # preserve me but hug brackets
|
||||
|
||||
func(
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
# preserve me
|
||||
)
|
||||
|
||||
func([x for x in "short line"])
|
||||
func([
|
||||
x for x in "long line long line long line long line long line long line long line"
|
||||
])
|
||||
func([
|
||||
x
|
||||
for x in [
|
||||
x
|
||||
for x in "long line long line long line long line long line long line long line"
|
||||
]
|
||||
])
|
||||
|
||||
func({"short line"})
|
||||
func({
|
||||
"long line",
|
||||
"long long line",
|
||||
"long long long line",
|
||||
"long long long long line",
|
||||
"long long long long long line",
|
||||
})
|
||||
func({
|
||||
{
|
||||
"long line",
|
||||
"long long line",
|
||||
"long long long line",
|
||||
"long long long long line",
|
||||
"long long long long long line",
|
||||
}
|
||||
})
|
||||
|
||||
foooooooooooooooooooo(
|
||||
[{c: n + 1 for c in range(256)} for n in range(100)] + [{}], {size}
|
||||
)
|
||||
|
||||
baaaaaaaaaaaaar(
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], {x}, "a string", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
)
|
||||
|
||||
foo(*[
|
||||
"long long long long long line",
|
||||
"long long long long long line",
|
||||
"long long long long long line",
|
||||
])
|
||||
|
||||
foo(*[
|
||||
str(i) for i in range(100000000000000000000000000000000000000000000000000000000000)
|
||||
])
|
|
@ -35,12 +35,12 @@ def import_fixture(fixture: Path, fixture_set: str):
|
|||
# If there's no output marker, treat the whole file as already pre-formatted
|
||||
expected = input
|
||||
|
||||
options = {}
|
||||
black_options = {}
|
||||
extension = "py"
|
||||
|
||||
if flags:
|
||||
if "--preview" in flags or "--unstable" in flags:
|
||||
options["preview"] = "enabled"
|
||||
black_options["preview"] = "enabled"
|
||||
|
||||
if "--pyi" in flags:
|
||||
extension = "pyi"
|
||||
|
@ -53,21 +53,23 @@ def import_fixture(fixture: Path, fixture_set: str):
|
|||
[_, length_and_rest] = flags.split("--line-length=", 1)
|
||||
length = length_and_rest.split(" ", 1)[0]
|
||||
length = int(length)
|
||||
options["line_width"] = 1 if length == 0 else length
|
||||
black_options["line_width"] = 1 if length == 0 else length
|
||||
|
||||
if "--minimum-version=" in flags:
|
||||
[_, version] = flags.split("--minimum-version=", 1)
|
||||
version = version.split(" ", 1)[0]
|
||||
# Convert 3.10 to py310
|
||||
options["target_version"] = f"py{version.strip().replace('.', '')}"
|
||||
black_options["target_version"] = f"py{version.strip().replace('.', '')}"
|
||||
|
||||
if "--skip-magic-trailing-comma" in flags:
|
||||
options["magic_trailing_comma"] = "ignore"
|
||||
black_options["magic_trailing_comma"] = "ignore"
|
||||
|
||||
fixture_path = output_directory.joinpath(fixture.name).with_suffix(f".{extension}")
|
||||
expect_path = fixture_path.with_suffix(f".{extension}.expect")
|
||||
options_path = fixture_path.with_suffix(".options.json")
|
||||
|
||||
options = OPTIONS_OVERRIDES.get(fixture.name, black_options)
|
||||
|
||||
if len(options) > 0:
|
||||
if extension == "pyi":
|
||||
options["source_type"] = "Stub"
|
||||
|
@ -109,6 +111,16 @@ IGNORE_LIST = [
|
|||
"line_ranges_outside_source.py",
|
||||
]
|
||||
|
||||
# Specs for which to override the formatter options
|
||||
OPTIONS_OVERRIDES = {
|
||||
"context_managers_38.py": {
|
||||
"target_version": "py38"
|
||||
},
|
||||
"context_managers_autodetect_38.py" : {
|
||||
"target_version": "py38"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def import_fixtures(black_dir: str):
|
||||
"""Imports all the black fixtures"""
|
||||
|
|
|
@ -457,10 +457,10 @@ where
|
|||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
pub enum PythonVersion {
|
||||
Py37,
|
||||
Py38,
|
||||
// Make sure to also change the default for `ruff_linter::settings::types::PythonVersion`
|
||||
// when changing the default here.
|
||||
#[default]
|
||||
Py38,
|
||||
Py39,
|
||||
Py310,
|
||||
Py311,
|
||||
|
|
|
@ -1,341 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/context_managers_39.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
with \
|
||||
make_context_manager1() as cm1, \
|
||||
make_context_manager2() as cm2, \
|
||||
make_context_manager3() as cm3, \
|
||||
make_context_manager4() as cm4 \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
# Leading comment
|
||||
with \
|
||||
make_context_manager1() as cm1, \
|
||||
make_context_manager2(), \
|
||||
make_context_manager3() as cm3, \
|
||||
make_context_manager4() \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
with \
|
||||
new_new_new1() as cm1, \
|
||||
new_new_new2() \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
with (
|
||||
new_new_new1() as cm1,
|
||||
new_new_new2()
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
# Leading comment.
|
||||
with (
|
||||
# First comment.
|
||||
new_new_new1() as cm1,
|
||||
# Second comment.
|
||||
new_new_new2()
|
||||
# Last comment.
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with \
|
||||
this_is_a_very_long_call(looong_arg1=looong_value1, looong_arg2=looong_value2) as cm1, \
|
||||
this_is_a_very_long_call(looong_arg1=looong_value1, looong_arg2=looong_value2, looong_arg3=looong_value3, looong_arg4=looong_value4) as cm2 \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
with mock.patch.object(
|
||||
self.my_runner, "first_method", autospec=True
|
||||
) as mock_run_adb, mock.patch.object(
|
||||
self.my_runner, "second_method", autospec=True, return_value="foo"
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with xxxxxxxx.some_kind_of_method(
|
||||
some_argument=[
|
||||
"first",
|
||||
"second",
|
||||
"third",
|
||||
]
|
||||
).another_method() as cmd:
|
||||
pass
|
||||
|
||||
|
||||
async def func():
|
||||
async with \
|
||||
make_context_manager1() as cm1, \
|
||||
make_context_manager2() as cm2, \
|
||||
make_context_manager3() as cm3, \
|
||||
make_context_manager4() as cm4 \
|
||||
:
|
||||
pass
|
||||
|
||||
async with some_function(
|
||||
argument1, argument2, argument3="some_value"
|
||||
) as some_cm, some_other_function(
|
||||
argument1, argument2, argument3="some_value"
|
||||
):
|
||||
pass
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,19 +1,9 @@
|
||||
-with (
|
||||
- make_context_manager1() as cm1,
|
||||
- make_context_manager2() as cm2,
|
||||
- make_context_manager3() as cm3,
|
||||
- make_context_manager4() as cm4,
|
||||
-):
|
||||
+with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
|
||||
pass
|
||||
|
||||
|
||||
# Leading comment
|
||||
-with (
|
||||
- make_context_manager1() as cm1,
|
||||
- make_context_manager2(),
|
||||
- make_context_manager3() as cm3,
|
||||
- make_context_manager4(),
|
||||
-):
|
||||
+with make_context_manager1() as cm1, make_context_manager2(), make_context_manager3() as cm3, make_context_manager4():
|
||||
pass
|
||||
|
||||
|
||||
@@ -36,25 +26,21 @@
|
||||
pass
|
||||
|
||||
|
||||
-with (
|
||||
- this_is_a_very_long_call(
|
||||
- looong_arg1=looong_value1, looong_arg2=looong_value2
|
||||
- ) as cm1,
|
||||
- this_is_a_very_long_call(
|
||||
- looong_arg1=looong_value1,
|
||||
- looong_arg2=looong_value2,
|
||||
- looong_arg3=looong_value3,
|
||||
- looong_arg4=looong_value4,
|
||||
- ) as cm2,
|
||||
-):
|
||||
+with this_is_a_very_long_call(
|
||||
+ looong_arg1=looong_value1, looong_arg2=looong_value2
|
||||
+) as cm1, this_is_a_very_long_call(
|
||||
+ looong_arg1=looong_value1,
|
||||
+ looong_arg2=looong_value2,
|
||||
+ looong_arg3=looong_value3,
|
||||
+ looong_arg4=looong_value4,
|
||||
+) as cm2:
|
||||
pass
|
||||
|
||||
|
||||
-with (
|
||||
- mock.patch.object(self.my_runner, "first_method", autospec=True) as mock_run_adb,
|
||||
- mock.patch.object(
|
||||
- self.my_runner, "second_method", autospec=True, return_value="foo"
|
||||
- ),
|
||||
+with mock.patch.object(
|
||||
+ self.my_runner, "first_method", autospec=True
|
||||
+) as mock_run_adb, mock.patch.object(
|
||||
+ self.my_runner, "second_method", autospec=True, return_value="foo"
|
||||
):
|
||||
pass
|
||||
|
||||
@@ -70,16 +56,10 @@
|
||||
|
||||
|
||||
async def func():
|
||||
- async with (
|
||||
- make_context_manager1() as cm1,
|
||||
- make_context_manager2() as cm2,
|
||||
- make_context_manager3() as cm3,
|
||||
- make_context_manager4() as cm4,
|
||||
- ):
|
||||
+ async with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
|
||||
pass
|
||||
|
||||
- async with (
|
||||
- some_function(argument1, argument2, argument3="some_value") as some_cm,
|
||||
- some_other_function(argument1, argument2, argument3="some_value"),
|
||||
- ):
|
||||
+ async with some_function(
|
||||
+ argument1, argument2, argument3="some_value"
|
||||
+ ) as some_cm, some_other_function(argument1, argument2, argument3="some_value"):
|
||||
pass
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
|
||||
pass
|
||||
|
||||
|
||||
# Leading comment
|
||||
with make_context_manager1() as cm1, make_context_manager2(), make_context_manager3() as cm3, make_context_manager4():
|
||||
pass
|
||||
|
||||
|
||||
with new_new_new1() as cm1, new_new_new2():
|
||||
pass
|
||||
|
||||
|
||||
with new_new_new1() as cm1, new_new_new2():
|
||||
pass
|
||||
|
||||
|
||||
# Leading comment.
|
||||
with (
|
||||
# First comment.
|
||||
new_new_new1() as cm1,
|
||||
# Second comment.
|
||||
new_new_new2(),
|
||||
# Last comment.
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with this_is_a_very_long_call(
|
||||
looong_arg1=looong_value1, looong_arg2=looong_value2
|
||||
) as cm1, this_is_a_very_long_call(
|
||||
looong_arg1=looong_value1,
|
||||
looong_arg2=looong_value2,
|
||||
looong_arg3=looong_value3,
|
||||
looong_arg4=looong_value4,
|
||||
) as cm2:
|
||||
pass
|
||||
|
||||
|
||||
with mock.patch.object(
|
||||
self.my_runner, "first_method", autospec=True
|
||||
) as mock_run_adb, mock.patch.object(
|
||||
self.my_runner, "second_method", autospec=True, return_value="foo"
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with xxxxxxxx.some_kind_of_method(
|
||||
some_argument=[
|
||||
"first",
|
||||
"second",
|
||||
"third",
|
||||
]
|
||||
).another_method() as cmd:
|
||||
pass
|
||||
|
||||
|
||||
async def func():
|
||||
async with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
|
||||
pass
|
||||
|
||||
async with some_function(
|
||||
argument1, argument2, argument3="some_value"
|
||||
) as some_cm, some_other_function(argument1, argument2, argument3="some_value"):
|
||||
pass
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
with (
|
||||
make_context_manager1() as cm1,
|
||||
make_context_manager2() as cm2,
|
||||
make_context_manager3() as cm3,
|
||||
make_context_manager4() as cm4,
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
# Leading comment
|
||||
with (
|
||||
make_context_manager1() as cm1,
|
||||
make_context_manager2(),
|
||||
make_context_manager3() as cm3,
|
||||
make_context_manager4(),
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with new_new_new1() as cm1, new_new_new2():
|
||||
pass
|
||||
|
||||
|
||||
with new_new_new1() as cm1, new_new_new2():
|
||||
pass
|
||||
|
||||
|
||||
# Leading comment.
|
||||
with (
|
||||
# First comment.
|
||||
new_new_new1() as cm1,
|
||||
# Second comment.
|
||||
new_new_new2(),
|
||||
# Last comment.
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with (
|
||||
this_is_a_very_long_call(
|
||||
looong_arg1=looong_value1, looong_arg2=looong_value2
|
||||
) as cm1,
|
||||
this_is_a_very_long_call(
|
||||
looong_arg1=looong_value1,
|
||||
looong_arg2=looong_value2,
|
||||
looong_arg3=looong_value3,
|
||||
looong_arg4=looong_value4,
|
||||
) as cm2,
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with (
|
||||
mock.patch.object(self.my_runner, "first_method", autospec=True) as mock_run_adb,
|
||||
mock.patch.object(
|
||||
self.my_runner, "second_method", autospec=True, return_value="foo"
|
||||
),
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with xxxxxxxx.some_kind_of_method(
|
||||
some_argument=[
|
||||
"first",
|
||||
"second",
|
||||
"third",
|
||||
]
|
||||
).another_method() as cmd:
|
||||
pass
|
||||
|
||||
|
||||
async def func():
|
||||
async with (
|
||||
make_context_manager1() as cm1,
|
||||
make_context_manager2() as cm2,
|
||||
make_context_manager3() as cm3,
|
||||
make_context_manager4() as cm4,
|
||||
):
|
||||
pass
|
||||
|
||||
async with (
|
||||
some_function(argument1, argument2, argument3="some_value") as some_cm,
|
||||
some_other_function(argument1, argument2, argument3="some_value"),
|
||||
):
|
||||
pass
|
||||
```
|
|
@ -1,80 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/context_managers_autodetect_39.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
# This file uses parenthesized context managers introduced in Python 3.9.
|
||||
|
||||
|
||||
with \
|
||||
make_context_manager1() as cm1, \
|
||||
make_context_manager2() as cm2, \
|
||||
make_context_manager3() as cm3, \
|
||||
make_context_manager4() as cm4 \
|
||||
:
|
||||
pass
|
||||
|
||||
|
||||
with (
|
||||
new_new_new1() as cm1,
|
||||
new_new_new2()
|
||||
):
|
||||
pass
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,12 +1,7 @@
|
||||
# This file uses parenthesized context managers introduced in Python 3.9.
|
||||
|
||||
|
||||
-with (
|
||||
- make_context_manager1() as cm1,
|
||||
- make_context_manager2() as cm2,
|
||||
- make_context_manager3() as cm3,
|
||||
- make_context_manager4() as cm4,
|
||||
-):
|
||||
+with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
|
||||
pass
|
||||
|
||||
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
# This file uses parenthesized context managers introduced in Python 3.9.
|
||||
|
||||
|
||||
with make_context_manager1() as cm1, make_context_manager2() as cm2, make_context_manager3() as cm3, make_context_manager4() as cm4:
|
||||
pass
|
||||
|
||||
|
||||
with new_new_new1() as cm1, new_new_new2():
|
||||
pass
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
# This file uses parenthesized context managers introduced in Python 3.9.
|
||||
|
||||
|
||||
with (
|
||||
make_context_manager1() as cm1,
|
||||
make_context_manager2() as cm2,
|
||||
make_context_manager3() as cm3,
|
||||
make_context_manager4() as cm4,
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
with new_new_new1() as cm1, new_new_new2():
|
||||
pass
|
||||
```
|
|
@ -1,325 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/preview_allow_empty_first_line.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
def foo():
|
||||
"""
|
||||
Docstring
|
||||
"""
|
||||
|
||||
# Here we go
|
||||
if x:
|
||||
|
||||
# This is also now fine
|
||||
a = 123
|
||||
|
||||
else:
|
||||
# But not necessary
|
||||
a = 123
|
||||
|
||||
if y:
|
||||
|
||||
while True:
|
||||
|
||||
"""
|
||||
Long comment here
|
||||
"""
|
||||
a = 123
|
||||
|
||||
if z:
|
||||
|
||||
for _ in range(100):
|
||||
a = 123
|
||||
else:
|
||||
|
||||
try:
|
||||
|
||||
# this should be ok
|
||||
a = 123
|
||||
except:
|
||||
|
||||
"""also this"""
|
||||
a = 123
|
||||
|
||||
|
||||
def bar():
|
||||
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def baz():
|
||||
|
||||
# OK
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
def quux():
|
||||
|
||||
new_line = here
|
||||
|
||||
|
||||
class Cls:
|
||||
|
||||
def method(self):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
async def async_fn():
|
||||
|
||||
"""Docstring."""
|
||||
|
||||
|
||||
@decorated
|
||||
async def async_fn():
|
||||
|
||||
"""Docstring."""
|
||||
|
||||
|
||||
def top_level(
|
||||
a: int,
|
||||
b: str,
|
||||
) -> Whatever[Generic, Something]:
|
||||
|
||||
def nested(x: int) -> int:
|
||||
pass
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
# Here we go
|
||||
if x:
|
||||
-
|
||||
# This is also now fine
|
||||
a = 123
|
||||
|
||||
@@ -14,52 +13,41 @@
|
||||
a = 123
|
||||
|
||||
if y:
|
||||
-
|
||||
while True:
|
||||
-
|
||||
"""
|
||||
Long comment here
|
||||
"""
|
||||
a = 123
|
||||
|
||||
if z:
|
||||
-
|
||||
for _ in range(100):
|
||||
a = 123
|
||||
else:
|
||||
-
|
||||
try:
|
||||
-
|
||||
# this should be ok
|
||||
a = 123
|
||||
except:
|
||||
-
|
||||
"""also this"""
|
||||
a = 123
|
||||
|
||||
|
||||
def bar():
|
||||
-
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def baz():
|
||||
-
|
||||
# OK
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def quux():
|
||||
-
|
||||
new_line = here
|
||||
|
||||
|
||||
class Cls:
|
||||
-
|
||||
def method(self):
|
||||
-
|
||||
pass
|
||||
|
||||
|
||||
@@ -76,6 +64,5 @@
|
||||
a: int,
|
||||
b: str,
|
||||
) -> Whatever[Generic, Something]:
|
||||
-
|
||||
def nested(x: int) -> int:
|
||||
pass
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
def foo():
|
||||
"""
|
||||
Docstring
|
||||
"""
|
||||
|
||||
# Here we go
|
||||
if x:
|
||||
# This is also now fine
|
||||
a = 123
|
||||
|
||||
else:
|
||||
# But not necessary
|
||||
a = 123
|
||||
|
||||
if y:
|
||||
while True:
|
||||
"""
|
||||
Long comment here
|
||||
"""
|
||||
a = 123
|
||||
|
||||
if z:
|
||||
for _ in range(100):
|
||||
a = 123
|
||||
else:
|
||||
try:
|
||||
# this should be ok
|
||||
a = 123
|
||||
except:
|
||||
"""also this"""
|
||||
a = 123
|
||||
|
||||
|
||||
def bar():
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def baz():
|
||||
# OK
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def quux():
|
||||
new_line = here
|
||||
|
||||
|
||||
class Cls:
|
||||
def method(self):
|
||||
pass
|
||||
|
||||
|
||||
async def async_fn():
|
||||
"""Docstring."""
|
||||
|
||||
|
||||
@decorated
|
||||
async def async_fn():
|
||||
"""Docstring."""
|
||||
|
||||
|
||||
def top_level(
|
||||
a: int,
|
||||
b: str,
|
||||
) -> Whatever[Generic, Something]:
|
||||
def nested(x: int) -> int:
|
||||
pass
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
def foo():
|
||||
"""
|
||||
Docstring
|
||||
"""
|
||||
|
||||
# Here we go
|
||||
if x:
|
||||
|
||||
# This is also now fine
|
||||
a = 123
|
||||
|
||||
else:
|
||||
# But not necessary
|
||||
a = 123
|
||||
|
||||
if y:
|
||||
|
||||
while True:
|
||||
|
||||
"""
|
||||
Long comment here
|
||||
"""
|
||||
a = 123
|
||||
|
||||
if z:
|
||||
|
||||
for _ in range(100):
|
||||
a = 123
|
||||
else:
|
||||
|
||||
try:
|
||||
|
||||
# this should be ok
|
||||
a = 123
|
||||
except:
|
||||
|
||||
"""also this"""
|
||||
a = 123
|
||||
|
||||
|
||||
def bar():
|
||||
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def baz():
|
||||
|
||||
# OK
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def quux():
|
||||
|
||||
new_line = here
|
||||
|
||||
|
||||
class Cls:
|
||||
|
||||
def method(self):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
async def async_fn():
|
||||
"""Docstring."""
|
||||
|
||||
|
||||
@decorated
|
||||
async def async_fn():
|
||||
"""Docstring."""
|
||||
|
||||
|
||||
def top_level(
|
||||
a: int,
|
||||
b: str,
|
||||
) -> Whatever[Generic, Something]:
|
||||
|
||||
def nested(x: int) -> int:
|
||||
pass
|
||||
```
|
|
@ -1,217 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/preview_allow_empty_first_line_in_special_cases.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
def foo():
|
||||
"""
|
||||
Docstring
|
||||
"""
|
||||
|
||||
# Here we go
|
||||
if x:
|
||||
|
||||
# This is also now fine
|
||||
a = 123
|
||||
|
||||
else:
|
||||
# But not necessary
|
||||
a = 123
|
||||
|
||||
if y:
|
||||
|
||||
while True:
|
||||
|
||||
"""
|
||||
Long comment here
|
||||
"""
|
||||
a = 123
|
||||
|
||||
if z:
|
||||
|
||||
for _ in range(100):
|
||||
a = 123
|
||||
else:
|
||||
|
||||
try:
|
||||
|
||||
# this should be ok
|
||||
a = 123
|
||||
except:
|
||||
|
||||
"""also this"""
|
||||
a = 123
|
||||
|
||||
|
||||
def bar():
|
||||
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def baz():
|
||||
|
||||
# OK
|
||||
if x:
|
||||
a = 123
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
# Here we go
|
||||
if x:
|
||||
-
|
||||
# This is also now fine
|
||||
a = 123
|
||||
|
||||
@@ -14,38 +13,30 @@
|
||||
a = 123
|
||||
|
||||
if y:
|
||||
-
|
||||
while True:
|
||||
-
|
||||
"""
|
||||
Long comment here
|
||||
"""
|
||||
a = 123
|
||||
|
||||
if z:
|
||||
-
|
||||
for _ in range(100):
|
||||
a = 123
|
||||
else:
|
||||
-
|
||||
try:
|
||||
-
|
||||
# this should be ok
|
||||
a = 123
|
||||
except:
|
||||
-
|
||||
"""also this"""
|
||||
a = 123
|
||||
|
||||
|
||||
def bar():
|
||||
-
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def baz():
|
||||
-
|
||||
# OK
|
||||
if x:
|
||||
a = 123
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
def foo():
|
||||
"""
|
||||
Docstring
|
||||
"""
|
||||
|
||||
# Here we go
|
||||
if x:
|
||||
# This is also now fine
|
||||
a = 123
|
||||
|
||||
else:
|
||||
# But not necessary
|
||||
a = 123
|
||||
|
||||
if y:
|
||||
while True:
|
||||
"""
|
||||
Long comment here
|
||||
"""
|
||||
a = 123
|
||||
|
||||
if z:
|
||||
for _ in range(100):
|
||||
a = 123
|
||||
else:
|
||||
try:
|
||||
# this should be ok
|
||||
a = 123
|
||||
except:
|
||||
"""also this"""
|
||||
a = 123
|
||||
|
||||
|
||||
def bar():
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def baz():
|
||||
# OK
|
||||
if x:
|
||||
a = 123
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
def foo():
|
||||
"""
|
||||
Docstring
|
||||
"""
|
||||
|
||||
# Here we go
|
||||
if x:
|
||||
|
||||
# This is also now fine
|
||||
a = 123
|
||||
|
||||
else:
|
||||
# But not necessary
|
||||
a = 123
|
||||
|
||||
if y:
|
||||
|
||||
while True:
|
||||
|
||||
"""
|
||||
Long comment here
|
||||
"""
|
||||
a = 123
|
||||
|
||||
if z:
|
||||
|
||||
for _ in range(100):
|
||||
a = 123
|
||||
else:
|
||||
|
||||
try:
|
||||
|
||||
# this should be ok
|
||||
a = 123
|
||||
except:
|
||||
|
||||
"""also this"""
|
||||
a = 123
|
||||
|
||||
|
||||
def bar():
|
||||
|
||||
if x:
|
||||
a = 123
|
||||
|
||||
|
||||
def baz():
|
||||
|
||||
# OK
|
||||
if x:
|
||||
a = 123
|
||||
```
|
|
@ -1,67 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/preview_docstring_no_string_normalization.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
def do_not_touch_this_prefix():
|
||||
R"""There was a bug where docstring prefixes would be normalized even with -S."""
|
||||
|
||||
|
||||
def do_not_touch_this_prefix2():
|
||||
FR'There was a bug where docstring prefixes would be normalized even with -S.'
|
||||
|
||||
|
||||
def do_not_touch_this_prefix3():
|
||||
u'''There was a bug where docstring prefixes would be normalized even with -S.'''
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
|
||||
def do_not_touch_this_prefix2():
|
||||
- FR'There was a bug where docstring prefixes would be normalized even with -S.'
|
||||
+ Rf"There was a bug where docstring prefixes would be normalized even with -S."
|
||||
|
||||
|
||||
def do_not_touch_this_prefix3():
|
||||
- u'''There was a bug where docstring prefixes would be normalized even with -S.'''
|
||||
+ """There was a bug where docstring prefixes would be normalized even with -S."""
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
def do_not_touch_this_prefix():
|
||||
R"""There was a bug where docstring prefixes would be normalized even with -S."""
|
||||
|
||||
|
||||
def do_not_touch_this_prefix2():
|
||||
Rf"There was a bug where docstring prefixes would be normalized even with -S."
|
||||
|
||||
|
||||
def do_not_touch_this_prefix3():
|
||||
"""There was a bug where docstring prefixes would be normalized even with -S."""
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
def do_not_touch_this_prefix():
|
||||
R"""There was a bug where docstring prefixes would be normalized even with -S."""
|
||||
|
||||
|
||||
def do_not_touch_this_prefix2():
|
||||
FR'There was a bug where docstring prefixes would be normalized even with -S.'
|
||||
|
||||
|
||||
def do_not_touch_this_prefix3():
|
||||
u'''There was a bug where docstring prefixes would be normalized even with -S.'''
|
||||
```
|
|
@ -1,457 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/preview_form_feeds.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
# Warning! This file contains form feeds (ASCII 0x0C, often represented by \f or ^L).
|
||||
# These may be invisible in your editor: ensure you can see them before making changes here.
|
||||
|
||||
# There's one at the start that'll get stripped
|
||||
|
||||
# Comment and statement processing is different enough that we'll test variations of both
|
||||
# contexts here
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
\
|
||||
#
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
||||
# form feed after a dedent
|
||||
def foo():
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
||||
# form feeds are prohibited inside blocks, or on a line with nonwhitespace
|
||||
defbar(a=1,b:bool=False):
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class Baz:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def something(self):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
#
|
||||
pass
|
||||
pass #
|
||||
a = 1
|
||||
#
|
||||
pass
|
||||
a = 1
|
||||
|
||||
a = [
|
||||
|
||||
]
|
||||
|
||||
# as internal whitespace of a comment is allowed but why
|
||||
"form feed literal in a string is okay"
|
||||
|
||||
# form feeds at the very end get removed.
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -5,62 +5,62 @@
|
||||
|
||||
# Comment and statement processing is different enough that we'll test variations of both
|
||||
# contexts here
|
||||
-
|
||||
+
|
||||
#
|
||||
|
||||
-
|
||||
+
|
||||
#
|
||||
|
||||
-
|
||||
+
|
||||
#
|
||||
|
||||
-
|
||||
+
|
||||
#
|
||||
|
||||
-
|
||||
+
|
||||
#
|
||||
|
||||
-
|
||||
+
|
||||
#
|
||||
|
||||
-
|
||||
+
|
||||
#
|
||||
|
||||
-
|
||||
+
|
||||
#
|
||||
-
|
||||
+
|
||||
#
|
||||
-
|
||||
+
|
||||
#
|
||||
|
||||
#
|
||||
pass
|
||||
-
|
||||
+
|
||||
pass
|
||||
|
||||
-
|
||||
+
|
||||
pass
|
||||
|
||||
-
|
||||
+
|
||||
pass
|
||||
|
||||
-
|
||||
+
|
||||
pass
|
||||
|
||||
-
|
||||
+
|
||||
pass
|
||||
|
||||
-
|
||||
+
|
||||
pass
|
||||
|
||||
-
|
||||
+
|
||||
pass
|
||||
|
||||
-
|
||||
+
|
||||
pass
|
||||
-
|
||||
+
|
||||
pass
|
||||
-
|
||||
+
|
||||
pass
|
||||
|
||||
|
||||
@@ -68,25 +68,23 @@
|
||||
def foo():
|
||||
pass
|
||||
|
||||
-
|
||||
+
|
||||
pass
|
||||
|
||||
|
||||
# form feeds are prohibited inside blocks, or on a line with nonwhitespace
|
||||
def bar(a=1, b: bool = False):
|
||||
-
|
||||
pass
|
||||
|
||||
|
||||
class Baz:
|
||||
-
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def something(self):
|
||||
pass
|
||||
|
||||
-
|
||||
+
|
||||
#
|
||||
pass
|
||||
pass #
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
# Warning! This file contains form feeds (ASCII 0x0C, often represented by \f or ^L).
|
||||
# These may be invisible in your editor: ensure you can see them before making changes here.
|
||||
|
||||
# There's one at the start that'll get stripped
|
||||
|
||||
# Comment and statement processing is different enough that we'll test variations of both
|
||||
# contexts here
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
||||
# form feed after a dedent
|
||||
def foo():
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
# form feeds are prohibited inside blocks, or on a line with nonwhitespace
|
||||
def bar(a=1, b: bool = False):
|
||||
pass
|
||||
|
||||
|
||||
class Baz:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def something(self):
|
||||
pass
|
||||
|
||||
|
||||
#
|
||||
pass
|
||||
pass #
|
||||
a = 1
|
||||
#
|
||||
pass
|
||||
a = 1
|
||||
|
||||
a = []
|
||||
|
||||
# as internal whitespace of a comment is allowed but why
|
||||
"form feed literal in a string is okay"
|
||||
|
||||
# form feeds at the very end get removed.
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
# Warning! This file contains form feeds (ASCII 0x0C, often represented by \f or ^L).
|
||||
# These may be invisible in your editor: ensure you can see them before making changes here.
|
||||
|
||||
# There's one at the start that'll get stripped
|
||||
|
||||
# Comment and statement processing is different enough that we'll test variations of both
|
||||
# contexts here
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
||||
# form feed after a dedent
|
||||
def foo():
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
# form feeds are prohibited inside blocks, or on a line with nonwhitespace
|
||||
def bar(a=1, b: bool = False):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class Baz:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def something(self):
|
||||
pass
|
||||
|
||||
|
||||
#
|
||||
pass
|
||||
pass #
|
||||
a = 1
|
||||
#
|
||||
pass
|
||||
a = 1
|
||||
|
||||
a = []
|
||||
|
||||
# as internal whitespace of a comment is allowed but why
|
||||
"form feed literal in a string is okay"
|
||||
|
||||
# form feeds at the very end get removed.
|
||||
```
|
|
@ -1,103 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/preview_pattern_matching_trailing_comma.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
match maybe, multiple:
|
||||
case perhaps, 5:
|
||||
pass
|
||||
case perhaps, 6,:
|
||||
pass
|
||||
|
||||
|
||||
match more := (than, one), indeed,:
|
||||
case _, (5, 6):
|
||||
pass
|
||||
case [[5], (6)], [7],:
|
||||
pass
|
||||
case _:
|
||||
pass
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -8,13 +8,16 @@
|
||||
pass
|
||||
|
||||
|
||||
-match more := (than, one), indeed,:
|
||||
+match (
|
||||
+ more := (than, one),
|
||||
+ indeed,
|
||||
+):
|
||||
case _, (5, 6):
|
||||
pass
|
||||
- case (
|
||||
+ case [
|
||||
[[5], (6)],
|
||||
[7],
|
||||
- ):
|
||||
+ ]:
|
||||
pass
|
||||
case _:
|
||||
pass
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
match maybe, multiple:
|
||||
case perhaps, 5:
|
||||
pass
|
||||
case (
|
||||
perhaps,
|
||||
6,
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
match (
|
||||
more := (than, one),
|
||||
indeed,
|
||||
):
|
||||
case _, (5, 6):
|
||||
pass
|
||||
case [
|
||||
[[5], (6)],
|
||||
[7],
|
||||
]:
|
||||
pass
|
||||
case _:
|
||||
pass
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
match maybe, multiple:
|
||||
case perhaps, 5:
|
||||
pass
|
||||
case (
|
||||
perhaps,
|
||||
6,
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
match more := (than, one), indeed,:
|
||||
case _, (5, 6):
|
||||
pass
|
||||
case (
|
||||
[[5], (6)],
|
||||
[7],
|
||||
):
|
||||
pass
|
||||
case _:
|
||||
pass
|
||||
```
|
|
@ -1,98 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/preview_percent_precedence.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
("" % a) ** 2
|
||||
("" % a)[0]
|
||||
("" % a)()
|
||||
("" % a).b
|
||||
|
||||
2 * ("" % a)
|
||||
2 @ ("" % a)
|
||||
2 / ("" % a)
|
||||
2 // ("" % a)
|
||||
2 % ("" % a)
|
||||
+("" % a)
|
||||
b + ("" % a)
|
||||
-("" % a)
|
||||
b - ("" % a)
|
||||
b + -("" % a)
|
||||
~("" % a)
|
||||
2 ** ("" % a)
|
||||
await ("" % a)
|
||||
b[("" % a)]
|
||||
b(("" % a))
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -9,9 +9,9 @@
|
||||
2 // ("" % a)
|
||||
2 % ("" % a)
|
||||
+("" % a)
|
||||
-b + "" % a
|
||||
+b + ("" % a)
|
||||
-("" % a)
|
||||
-b - "" % a
|
||||
+b - ("" % a)
|
||||
b + -("" % a)
|
||||
~("" % a)
|
||||
2 ** ("" % a)
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
("" % a) ** 2
|
||||
("" % a)[0]
|
||||
("" % a)()
|
||||
("" % a).b
|
||||
|
||||
2 * ("" % a)
|
||||
2 @ ("" % a)
|
||||
2 / ("" % a)
|
||||
2 // ("" % a)
|
||||
2 % ("" % a)
|
||||
+("" % a)
|
||||
b + ("" % a)
|
||||
-("" % a)
|
||||
b - ("" % a)
|
||||
b + -("" % a)
|
||||
~("" % a)
|
||||
2 ** ("" % a)
|
||||
await ("" % a)
|
||||
b[("" % a)]
|
||||
b(("" % a))
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
("" % a) ** 2
|
||||
("" % a)[0]
|
||||
("" % a)()
|
||||
("" % a).b
|
||||
|
||||
2 * ("" % a)
|
||||
2 @ ("" % a)
|
||||
2 / ("" % a)
|
||||
2 // ("" % a)
|
||||
2 % ("" % a)
|
||||
+("" % a)
|
||||
b + "" % a
|
||||
-("" % a)
|
||||
b - "" % a
|
||||
b + -("" % a)
|
||||
~("" % a)
|
||||
2 ** ("" % a)
|
||||
await ("" % a)
|
||||
b[("" % a)]
|
||||
b(("" % a))
|
||||
```
|
|
@ -1,353 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/preview_prefer_rhs_split.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
first_item, second_item = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
some_dict["with_a_long_key"] = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
# Make sure it works when the RHS only has one pair of (optional) parens.
|
||||
first_item, second_item = (
|
||||
some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
|
||||
)
|
||||
|
||||
some_dict["with_a_long_key"] = (
|
||||
some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
|
||||
)
|
||||
|
||||
# Make sure chaining assignments work.
|
||||
first_item, second_item, third_item, forth_item = m["everything"] = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
# Make sure when the RHS's first split at the non-optional paren fits,
|
||||
# we split there instead of the outer RHS optional paren.
|
||||
first_item, second_item = some_looooooooong_module.some_loooooog_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
(
|
||||
first_item,
|
||||
second_item,
|
||||
third_item,
|
||||
forth_item,
|
||||
fifth_item,
|
||||
last_item_very_loooooong,
|
||||
) = some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
(
|
||||
first_item,
|
||||
second_item,
|
||||
third_item,
|
||||
forth_item,
|
||||
fifth_item,
|
||||
last_item_very_loooooong,
|
||||
) = everything = some_looooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
|
||||
# Make sure unsplittable type ignore won't be moved.
|
||||
some_kind_of_table[some_key] = util.some_function( # type: ignore # noqa: E501
|
||||
some_arg
|
||||
).intersection(pk_cols)
|
||||
|
||||
some_kind_of_table[
|
||||
some_key
|
||||
] = lambda obj: obj.some_long_named_method() # type: ignore # noqa: E501
|
||||
|
||||
some_kind_of_table[
|
||||
some_key # type: ignore # noqa: E501
|
||||
] = lambda obj: obj.some_long_named_method()
|
||||
|
||||
|
||||
# Make when when the left side of assignment plus the opening paren "... = (" is
|
||||
# exactly line length limit + 1, it won't be split like that.
|
||||
xxxxxxxxx_yyy_zzzzzzzz[
|
||||
xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1)
|
||||
] = 1
|
||||
|
||||
|
||||
# Right side of assignment contains un-nested pairs of inner parens.
|
||||
some_kind_of_instance.some_kind_of_map[a_key] = (
|
||||
isinstance(some_var, SomeClass)
|
||||
and table.something_and_something != table.something_else
|
||||
) or (
|
||||
isinstance(some_other_var, BaseClass) and table.something != table.some_other_thing
|
||||
)
|
||||
|
||||
# Multiple targets
|
||||
a = b = (
|
||||
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
)
|
||||
|
||||
a = b = c = d = e = f = g = (
|
||||
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
) = i = j = (
|
||||
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
)
|
||||
|
||||
a = (
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) = c
|
||||
|
||||
a = (
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) = (
|
||||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
) = ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -60,9 +60,7 @@
|
||||
some_arg
|
||||
).intersection(pk_cols)
|
||||
|
||||
-some_kind_of_table[
|
||||
- some_key
|
||||
-] = lambda obj: obj.some_long_named_method() # type: ignore # noqa: E501
|
||||
+some_kind_of_table[some_key] = lambda obj: obj.some_long_named_method() # type: ignore # noqa: E501
|
||||
|
||||
some_kind_of_table[
|
||||
some_key # type: ignore # noqa: E501
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
first_item, second_item = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
some_dict["with_a_long_key"] = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
# Make sure it works when the RHS only has one pair of (optional) parens.
|
||||
first_item, second_item = (
|
||||
some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
|
||||
)
|
||||
|
||||
some_dict["with_a_long_key"] = (
|
||||
some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
|
||||
)
|
||||
|
||||
# Make sure chaining assignments work.
|
||||
first_item, second_item, third_item, forth_item = m["everything"] = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
# Make sure when the RHS's first split at the non-optional paren fits,
|
||||
# we split there instead of the outer RHS optional paren.
|
||||
first_item, second_item = some_looooooooong_module.some_loooooog_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
(
|
||||
first_item,
|
||||
second_item,
|
||||
third_item,
|
||||
forth_item,
|
||||
fifth_item,
|
||||
last_item_very_loooooong,
|
||||
) = some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
(
|
||||
first_item,
|
||||
second_item,
|
||||
third_item,
|
||||
forth_item,
|
||||
fifth_item,
|
||||
last_item_very_loooooong,
|
||||
) = everything = some_looooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
|
||||
# Make sure unsplittable type ignore won't be moved.
|
||||
some_kind_of_table[some_key] = util.some_function( # type: ignore # noqa: E501
|
||||
some_arg
|
||||
).intersection(pk_cols)
|
||||
|
||||
some_kind_of_table[some_key] = lambda obj: obj.some_long_named_method() # type: ignore # noqa: E501
|
||||
|
||||
some_kind_of_table[
|
||||
some_key # type: ignore # noqa: E501
|
||||
] = lambda obj: obj.some_long_named_method()
|
||||
|
||||
|
||||
# Make when when the left side of assignment plus the opening paren "... = (" is
|
||||
# exactly line length limit + 1, it won't be split like that.
|
||||
xxxxxxxxx_yyy_zzzzzzzz[
|
||||
xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1)
|
||||
] = 1
|
||||
|
||||
|
||||
# Right side of assignment contains un-nested pairs of inner parens.
|
||||
some_kind_of_instance.some_kind_of_map[a_key] = (
|
||||
isinstance(some_var, SomeClass)
|
||||
and table.something_and_something != table.something_else
|
||||
) or (
|
||||
isinstance(some_other_var, BaseClass) and table.something != table.some_other_thing
|
||||
)
|
||||
|
||||
# Multiple targets
|
||||
a = b = (
|
||||
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
)
|
||||
|
||||
a = b = c = d = e = f = g = (
|
||||
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
) = i = j = (
|
||||
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
)
|
||||
|
||||
a = (
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) = c
|
||||
|
||||
a = (
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) = (
|
||||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
) = ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
first_item, second_item = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
some_dict["with_a_long_key"] = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
# Make sure it works when the RHS only has one pair of (optional) parens.
|
||||
first_item, second_item = (
|
||||
some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
|
||||
)
|
||||
|
||||
some_dict["with_a_long_key"] = (
|
||||
some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
|
||||
)
|
||||
|
||||
# Make sure chaining assignments work.
|
||||
first_item, second_item, third_item, forth_item = m["everything"] = (
|
||||
some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
)
|
||||
|
||||
# Make sure when the RHS's first split at the non-optional paren fits,
|
||||
# we split there instead of the outer RHS optional paren.
|
||||
first_item, second_item = some_looooooooong_module.some_loooooog_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
(
|
||||
first_item,
|
||||
second_item,
|
||||
third_item,
|
||||
forth_item,
|
||||
fifth_item,
|
||||
last_item_very_loooooong,
|
||||
) = some_looooooooong_module.some_looooooooooooooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
(
|
||||
first_item,
|
||||
second_item,
|
||||
third_item,
|
||||
forth_item,
|
||||
fifth_item,
|
||||
last_item_very_loooooong,
|
||||
) = everything = some_looooong_function_name(
|
||||
first_argument, second_argument, third_argument
|
||||
)
|
||||
|
||||
|
||||
# Make sure unsplittable type ignore won't be moved.
|
||||
some_kind_of_table[some_key] = util.some_function( # type: ignore # noqa: E501
|
||||
some_arg
|
||||
).intersection(pk_cols)
|
||||
|
||||
some_kind_of_table[
|
||||
some_key
|
||||
] = lambda obj: obj.some_long_named_method() # type: ignore # noqa: E501
|
||||
|
||||
some_kind_of_table[
|
||||
some_key # type: ignore # noqa: E501
|
||||
] = lambda obj: obj.some_long_named_method()
|
||||
|
||||
|
||||
# Make when when the left side of assignment plus the opening paren "... = (" is
|
||||
# exactly line length limit + 1, it won't be split like that.
|
||||
xxxxxxxxx_yyy_zzzzzzzz[
|
||||
xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1)
|
||||
] = 1
|
||||
|
||||
|
||||
# Right side of assignment contains un-nested pairs of inner parens.
|
||||
some_kind_of_instance.some_kind_of_map[a_key] = (
|
||||
isinstance(some_var, SomeClass)
|
||||
and table.something_and_something != table.something_else
|
||||
) or (
|
||||
isinstance(some_other_var, BaseClass) and table.something != table.some_other_thing
|
||||
)
|
||||
|
||||
# Multiple targets
|
||||
a = b = (
|
||||
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
)
|
||||
|
||||
a = b = c = d = e = f = g = (
|
||||
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
) = i = j = (
|
||||
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
)
|
||||
|
||||
a = (
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) = c
|
||||
|
||||
a = (
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) = (
|
||||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
) = ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
||||
```
|
|
@ -1,62 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/preview_single_line_format_skip_with_multiple_comments.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
foo = 123 # fmt: skip # noqa: E501 # pylint
|
||||
bar = (
|
||||
123 ,
|
||||
( 1 + 5 ) # pylint # fmt:skip
|
||||
)
|
||||
baz = "a" + "b" # pylint; fmt: skip; noqa: E501
|
||||
skip_will_not_work = "a" + "b" # pylint fmt:skip
|
||||
skip_will_not_work2 = "a" + "b" # some text; fmt:skip happens to be part of it
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,8 +1,8 @@
|
||||
foo = 123 # fmt: skip # noqa: E501 # pylint
|
||||
bar = (
|
||||
- 123 ,
|
||||
- ( 1 + 5 ) # pylint # fmt:skip
|
||||
+ 123,
|
||||
+ (1 + 5), # pylint # fmt:skip
|
||||
)
|
||||
-baz = "a" + "b" # pylint; fmt: skip; noqa: E501
|
||||
+baz = "a" + "b" # pylint; fmt: skip; noqa: E501
|
||||
skip_will_not_work = "a" + "b" # pylint fmt:skip
|
||||
skip_will_not_work2 = "a" + "b" # some text; fmt:skip happens to be part of it
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
foo = 123 # fmt: skip # noqa: E501 # pylint
|
||||
bar = (
|
||||
123,
|
||||
(1 + 5), # pylint # fmt:skip
|
||||
)
|
||||
baz = "a" + "b" # pylint; fmt: skip; noqa: E501
|
||||
skip_will_not_work = "a" + "b" # pylint fmt:skip
|
||||
skip_will_not_work2 = "a" + "b" # some text; fmt:skip happens to be part of it
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
foo = 123 # fmt: skip # noqa: E501 # pylint
|
||||
bar = (
|
||||
123 ,
|
||||
( 1 + 5 ) # pylint # fmt:skip
|
||||
)
|
||||
baz = "a" + "b" # pylint; fmt: skip; noqa: E501
|
||||
skip_will_not_work = "a" + "b" # pylint fmt:skip
|
||||
skip_will_not_work2 = "a" + "b" # some text; fmt:skip happens to be part of it
|
||||
```
|
|
@ -1,333 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/conditional_expression.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
long_kwargs_single_line = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=some_long_value_name_foo_bar_baz if some_boolean_variable else some_fallback_value_foo_bar_baz,
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
multiline_kwargs_indented = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz,
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
imploding_kwargs = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=a
|
||||
if foo
|
||||
else b,
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
imploding_line = (
|
||||
1
|
||||
if 1 + 1 == 2
|
||||
else 0
|
||||
)
|
||||
|
||||
exploding_line = "hello this is a slightly long string" if some_long_value_name_foo_bar_baz else "this one is a little shorter"
|
||||
|
||||
positional_argument_test(some_long_value_name_foo_bar_baz if some_boolean_variable else some_fallback_value_foo_bar_baz)
|
||||
|
||||
def weird_default_argument(x=some_long_value_name_foo_bar_baz
|
||||
if SOME_CONSTANT
|
||||
else some_fallback_value_foo_bar_baz):
|
||||
pass
|
||||
|
||||
nested = "hello this is a slightly long string" if (some_long_value_name_foo_bar_baz if
|
||||
nesting_test_expressions else some_fallback_value_foo_bar_baz) \
|
||||
else "this one is a little shorter"
|
||||
|
||||
generator_expression = (
|
||||
some_long_value_name_foo_bar_baz if some_boolean_variable else some_fallback_value_foo_bar_baz for some_boolean_variable in some_iterable
|
||||
)
|
||||
|
||||
|
||||
def limit_offset_sql(self, low_mark, high_mark):
|
||||
"""Return LIMIT/OFFSET SQL clause."""
|
||||
limit, offset = self._get_limit_offset_params(low_mark, high_mark)
|
||||
return " ".join(
|
||||
sql
|
||||
for sql in (
|
||||
"LIMIT %d" % limit if limit else None,
|
||||
("OFFSET %d" % offset) if offset else None,
|
||||
)
|
||||
if sql
|
||||
)
|
||||
|
||||
|
||||
def something():
|
||||
clone._iterable_class = (
|
||||
NamedValuesListIterable
|
||||
if named
|
||||
else FlatValuesListIterable
|
||||
if flat
|
||||
else ValuesListIterable
|
||||
)
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,20 +1,16 @@
|
||||
long_kwargs_single_line = my_function(
|
||||
foo="test, this is a sample value",
|
||||
- bar=(
|
||||
- some_long_value_name_foo_bar_baz
|
||||
- if some_boolean_variable
|
||||
- else some_fallback_value_foo_bar_baz
|
||||
- ),
|
||||
+ bar=some_long_value_name_foo_bar_baz
|
||||
+ if some_boolean_variable
|
||||
+ else some_fallback_value_foo_bar_baz,
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
multiline_kwargs_indented = my_function(
|
||||
foo="test, this is a sample value",
|
||||
- bar=(
|
||||
- some_long_value_name_foo_bar_baz
|
||||
- if some_boolean_variable
|
||||
- else some_fallback_value_foo_bar_baz
|
||||
- ),
|
||||
+ bar=some_long_value_name_foo_bar_baz
|
||||
+ if some_boolean_variable
|
||||
+ else some_fallback_value_foo_bar_baz,
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
@@ -40,11 +36,9 @@
|
||||
|
||||
|
||||
def weird_default_argument(
|
||||
- x=(
|
||||
- some_long_value_name_foo_bar_baz
|
||||
- if SOME_CONSTANT
|
||||
- else some_fallback_value_foo_bar_baz
|
||||
- ),
|
||||
+ x=some_long_value_name_foo_bar_baz
|
||||
+ if SOME_CONSTANT
|
||||
+ else some_fallback_value_foo_bar_baz,
|
||||
):
|
||||
pass
|
||||
|
||||
@@ -60,11 +54,9 @@
|
||||
)
|
||||
|
||||
generator_expression = (
|
||||
- (
|
||||
- some_long_value_name_foo_bar_baz
|
||||
- if some_boolean_variable
|
||||
- else some_fallback_value_foo_bar_baz
|
||||
- )
|
||||
+ some_long_value_name_foo_bar_baz
|
||||
+ if some_boolean_variable
|
||||
+ else some_fallback_value_foo_bar_baz
|
||||
for some_boolean_variable in some_iterable
|
||||
)
|
||||
|
||||
@@ -86,5 +78,7 @@
|
||||
clone._iterable_class = (
|
||||
NamedValuesListIterable
|
||||
if named
|
||||
- else FlatValuesListIterable if flat else ValuesListIterable
|
||||
+ else FlatValuesListIterable
|
||||
+ if flat
|
||||
+ else ValuesListIterable
|
||||
)
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
long_kwargs_single_line = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz,
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
multiline_kwargs_indented = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz,
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
imploding_kwargs = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=a if foo else b,
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
imploding_line = 1 if 1 + 1 == 2 else 0
|
||||
|
||||
exploding_line = (
|
||||
"hello this is a slightly long string"
|
||||
if some_long_value_name_foo_bar_baz
|
||||
else "this one is a little shorter"
|
||||
)
|
||||
|
||||
positional_argument_test(
|
||||
some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz
|
||||
)
|
||||
|
||||
|
||||
def weird_default_argument(
|
||||
x=some_long_value_name_foo_bar_baz
|
||||
if SOME_CONSTANT
|
||||
else some_fallback_value_foo_bar_baz,
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
nested = (
|
||||
"hello this is a slightly long string"
|
||||
if (
|
||||
some_long_value_name_foo_bar_baz
|
||||
if nesting_test_expressions
|
||||
else some_fallback_value_foo_bar_baz
|
||||
)
|
||||
else "this one is a little shorter"
|
||||
)
|
||||
|
||||
generator_expression = (
|
||||
some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz
|
||||
for some_boolean_variable in some_iterable
|
||||
)
|
||||
|
||||
|
||||
def limit_offset_sql(self, low_mark, high_mark):
|
||||
"""Return LIMIT/OFFSET SQL clause."""
|
||||
limit, offset = self._get_limit_offset_params(low_mark, high_mark)
|
||||
return " ".join(
|
||||
sql
|
||||
for sql in (
|
||||
"LIMIT %d" % limit if limit else None,
|
||||
("OFFSET %d" % offset) if offset else None,
|
||||
)
|
||||
if sql
|
||||
)
|
||||
|
||||
|
||||
def something():
|
||||
clone._iterable_class = (
|
||||
NamedValuesListIterable
|
||||
if named
|
||||
else FlatValuesListIterable
|
||||
if flat
|
||||
else ValuesListIterable
|
||||
)
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
long_kwargs_single_line = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=(
|
||||
some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz
|
||||
),
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
multiline_kwargs_indented = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=(
|
||||
some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz
|
||||
),
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
imploding_kwargs = my_function(
|
||||
foo="test, this is a sample value",
|
||||
bar=a if foo else b,
|
||||
baz="hello, this is a another value",
|
||||
)
|
||||
|
||||
imploding_line = 1 if 1 + 1 == 2 else 0
|
||||
|
||||
exploding_line = (
|
||||
"hello this is a slightly long string"
|
||||
if some_long_value_name_foo_bar_baz
|
||||
else "this one is a little shorter"
|
||||
)
|
||||
|
||||
positional_argument_test(
|
||||
some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz
|
||||
)
|
||||
|
||||
|
||||
def weird_default_argument(
|
||||
x=(
|
||||
some_long_value_name_foo_bar_baz
|
||||
if SOME_CONSTANT
|
||||
else some_fallback_value_foo_bar_baz
|
||||
),
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
nested = (
|
||||
"hello this is a slightly long string"
|
||||
if (
|
||||
some_long_value_name_foo_bar_baz
|
||||
if nesting_test_expressions
|
||||
else some_fallback_value_foo_bar_baz
|
||||
)
|
||||
else "this one is a little shorter"
|
||||
)
|
||||
|
||||
generator_expression = (
|
||||
(
|
||||
some_long_value_name_foo_bar_baz
|
||||
if some_boolean_variable
|
||||
else some_fallback_value_foo_bar_baz
|
||||
)
|
||||
for some_boolean_variable in some_iterable
|
||||
)
|
||||
|
||||
|
||||
def limit_offset_sql(self, low_mark, high_mark):
|
||||
"""Return LIMIT/OFFSET SQL clause."""
|
||||
limit, offset = self._get_limit_offset_params(low_mark, high_mark)
|
||||
return " ".join(
|
||||
sql
|
||||
for sql in (
|
||||
"LIMIT %d" % limit if limit else None,
|
||||
("OFFSET %d" % offset) if offset else None,
|
||||
)
|
||||
if sql
|
||||
)
|
||||
|
||||
|
||||
def something():
|
||||
clone._iterable_class = (
|
||||
NamedValuesListIterable
|
||||
if named
|
||||
else FlatValuesListIterable if flat else ValuesListIterable
|
||||
)
|
||||
```
|
|
@ -1,179 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/miscellaneous/force_pyi.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## 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
|
||||
@@ -1,32 +1,45 @@
|
||||
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]: ...
|
||||
```
|
||||
|
||||
## 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]: ...
|
||||
```
|
|
@ -1,85 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/raw_docstring.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
# flags: --preview --skip-string-normalization
|
||||
class C:
|
||||
|
||||
r"""Raw"""
|
||||
|
||||
def f():
|
||||
|
||||
r"""Raw"""
|
||||
|
||||
class SingleQuotes:
|
||||
|
||||
|
||||
r'''Raw'''
|
||||
|
||||
class UpperCaseR:
|
||||
R"""Raw"""
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,3 +1,4 @@
|
||||
+# flags: --preview --skip-string-normalization
|
||||
class C:
|
||||
r"""Raw"""
|
||||
|
||||
@@ -7,7 +8,7 @@
|
||||
|
||||
|
||||
class SingleQuotes:
|
||||
- r'''Raw'''
|
||||
+ r"""Raw"""
|
||||
|
||||
|
||||
class UpperCaseR:
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
# flags: --preview --skip-string-normalization
|
||||
class C:
|
||||
r"""Raw"""
|
||||
|
||||
|
||||
def f():
|
||||
r"""Raw"""
|
||||
|
||||
|
||||
class SingleQuotes:
|
||||
r"""Raw"""
|
||||
|
||||
|
||||
class UpperCaseR:
|
||||
R"""Raw"""
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
class C:
|
||||
r"""Raw"""
|
||||
|
||||
|
||||
def f():
|
||||
r"""Raw"""
|
||||
|
||||
|
||||
class SingleQuotes:
|
||||
r'''Raw'''
|
||||
|
||||
|
||||
class UpperCaseR:
|
||||
R"""Raw"""
|
||||
```
|
|
@ -1,542 +0,0 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/preview_hug_parens_with_braces_and_square_brackets.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
|
||||
```python
|
||||
def foo_brackets(request):
|
||||
return JsonResponse(
|
||||
{
|
||||
"var_1": foo,
|
||||
"var_2": bar,
|
||||
}
|
||||
)
|
||||
|
||||
def foo_square_brackets(request):
|
||||
return JsonResponse(
|
||||
[
|
||||
"var_1",
|
||||
"var_2",
|
||||
]
|
||||
)
|
||||
|
||||
func({"a": 37, "b": 42, "c": 927, "aaaaaaaaaaaaaaaaaaaaaaaaa": 11111111111111111111111111111111111111111})
|
||||
|
||||
func(["random_string_number_one","random_string_number_two","random_string_number_three","random_string_number_four"])
|
||||
|
||||
func(
|
||||
{
|
||||
# expand me
|
||||
'a':37,
|
||||
'b':42,
|
||||
'c':927
|
||||
}
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
]
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
],
|
||||
)
|
||||
|
||||
func( # a
|
||||
[ # b
|
||||
"c", # c
|
||||
"d", # d
|
||||
"e", # e
|
||||
] # f
|
||||
) # g
|
||||
|
||||
func( # a
|
||||
{ # b
|
||||
"c": 1, # c
|
||||
"d": 2, # d
|
||||
"e": 3, # e
|
||||
} # f
|
||||
) # g
|
||||
|
||||
func(
|
||||
# preserve me
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
)
|
||||
|
||||
func(
|
||||
[ # preserve me but hug brackets
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
# preserve me but hug brackets
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
"c",
|
||||
# preserve me but hug brackets
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
# preserve me but hug brackets
|
||||
]
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
] # preserve me but hug brackets
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
# preserve me
|
||||
)
|
||||
|
||||
func([x for x in "short line"])
|
||||
func([x for x in "long line long line long line long line long line long line long line"])
|
||||
func([x for x in [x for x in "long line long line long line long line long line long line long line"]])
|
||||
|
||||
func({"short line"})
|
||||
func({"long line", "long long line", "long long long line", "long long long long line", "long long long long long line"})
|
||||
func({{"long line", "long long line", "long long long line", "long long long long line", "long long long long long line"}})
|
||||
|
||||
foooooooooooooooooooo(
|
||||
[{c: n + 1 for c in range(256)} for n in range(100)] + [{}], {size}
|
||||
)
|
||||
|
||||
baaaaaaaaaaaaar(
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], {x}, "a string", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
)
|
||||
|
||||
foo(*["long long long long long line", "long long long long long line", "long long long long long line"])
|
||||
|
||||
foo(*[str(i) for i in range(100000000000000000000000000000000000000000000000000000000000)])
|
||||
```
|
||||
|
||||
## Black Differences
|
||||
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -47,17 +47,21 @@
|
||||
],
|
||||
)
|
||||
|
||||
-func([ # a # b
|
||||
- "c", # c
|
||||
- "d", # d
|
||||
- "e", # e
|
||||
-]) # f # g
|
||||
+func( # a
|
||||
+ [ # b
|
||||
+ "c", # c
|
||||
+ "d", # d
|
||||
+ "e", # e
|
||||
+ ] # f
|
||||
+) # g
|
||||
|
||||
-func({ # a # b
|
||||
- "c": 1, # c
|
||||
- "d": 2, # d
|
||||
- "e": 3, # e
|
||||
-}) # f # g
|
||||
+func( # a
|
||||
+ { # b
|
||||
+ "c": 1, # c
|
||||
+ "d": 2, # d
|
||||
+ "e": 3, # e
|
||||
+ } # f
|
||||
+) # g
|
||||
|
||||
func(
|
||||
# preserve me
|
||||
@@ -95,11 +99,13 @@
|
||||
# preserve me but hug brackets
|
||||
])
|
||||
|
||||
-func([
|
||||
- "c",
|
||||
- "d",
|
||||
- "e",
|
||||
-]) # preserve me but hug brackets
|
||||
+func(
|
||||
+ [
|
||||
+ "c",
|
||||
+ "d",
|
||||
+ "e",
|
||||
+ ] # preserve me but hug brackets
|
||||
+)
|
||||
|
||||
func(
|
||||
[
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```python
|
||||
def foo_brackets(request):
|
||||
return JsonResponse({
|
||||
"var_1": foo,
|
||||
"var_2": bar,
|
||||
})
|
||||
|
||||
|
||||
def foo_square_brackets(request):
|
||||
return JsonResponse([
|
||||
"var_1",
|
||||
"var_2",
|
||||
])
|
||||
|
||||
|
||||
func({
|
||||
"a": 37,
|
||||
"b": 42,
|
||||
"c": 927,
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaa": 11111111111111111111111111111111111111111,
|
||||
})
|
||||
|
||||
func([
|
||||
"random_string_number_one",
|
||||
"random_string_number_two",
|
||||
"random_string_number_three",
|
||||
"random_string_number_four",
|
||||
])
|
||||
|
||||
func({
|
||||
# expand me
|
||||
"a": 37,
|
||||
"b": 42,
|
||||
"c": 927,
|
||||
})
|
||||
|
||||
func([
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
])
|
||||
|
||||
func(
|
||||
[
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
],
|
||||
)
|
||||
|
||||
func( # a
|
||||
[ # b
|
||||
"c", # c
|
||||
"d", # d
|
||||
"e", # e
|
||||
] # f
|
||||
) # g
|
||||
|
||||
func( # a
|
||||
{ # b
|
||||
"c": 1, # c
|
||||
"d": 2, # d
|
||||
"e": 3, # e
|
||||
} # f
|
||||
) # g
|
||||
|
||||
func(
|
||||
# preserve me
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
)
|
||||
|
||||
func([ # preserve me but hug brackets
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
])
|
||||
|
||||
func([
|
||||
# preserve me but hug brackets
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
])
|
||||
|
||||
func([
|
||||
"c",
|
||||
# preserve me but hug brackets
|
||||
"d",
|
||||
"e",
|
||||
])
|
||||
|
||||
func([
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
# preserve me but hug brackets
|
||||
])
|
||||
|
||||
func(
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
] # preserve me but hug brackets
|
||||
)
|
||||
|
||||
func(
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
# preserve me
|
||||
)
|
||||
|
||||
func([x for x in "short line"])
|
||||
func([
|
||||
x for x in "long line long line long line long line long line long line long line"
|
||||
])
|
||||
func([
|
||||
x
|
||||
for x in [
|
||||
x
|
||||
for x in "long line long line long line long line long line long line long line"
|
||||
]
|
||||
])
|
||||
|
||||
func({"short line"})
|
||||
func({
|
||||
"long line",
|
||||
"long long line",
|
||||
"long long long line",
|
||||
"long long long long line",
|
||||
"long long long long long line",
|
||||
})
|
||||
func({
|
||||
{
|
||||
"long line",
|
||||
"long long line",
|
||||
"long long long line",
|
||||
"long long long long line",
|
||||
"long long long long long line",
|
||||
}
|
||||
})
|
||||
|
||||
foooooooooooooooooooo(
|
||||
[{c: n + 1 for c in range(256)} for n in range(100)] + [{}], {size}
|
||||
)
|
||||
|
||||
baaaaaaaaaaaaar(
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], {x}, "a string", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
)
|
||||
|
||||
foo(*[
|
||||
"long long long long long line",
|
||||
"long long long long long line",
|
||||
"long long long long long line",
|
||||
])
|
||||
|
||||
foo(*[
|
||||
str(i) for i in range(100000000000000000000000000000000000000000000000000000000000)
|
||||
])
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
||||
```python
|
||||
def foo_brackets(request):
|
||||
return JsonResponse({
|
||||
"var_1": foo,
|
||||
"var_2": bar,
|
||||
})
|
||||
|
||||
|
||||
def foo_square_brackets(request):
|
||||
return JsonResponse([
|
||||
"var_1",
|
||||
"var_2",
|
||||
])
|
||||
|
||||
|
||||
func({
|
||||
"a": 37,
|
||||
"b": 42,
|
||||
"c": 927,
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaa": 11111111111111111111111111111111111111111,
|
||||
})
|
||||
|
||||
func([
|
||||
"random_string_number_one",
|
||||
"random_string_number_two",
|
||||
"random_string_number_three",
|
||||
"random_string_number_four",
|
||||
])
|
||||
|
||||
func({
|
||||
# expand me
|
||||
"a": 37,
|
||||
"b": 42,
|
||||
"c": 927,
|
||||
})
|
||||
|
||||
func([
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
])
|
||||
|
||||
func(
|
||||
[
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
],
|
||||
)
|
||||
|
||||
func([ # a # b
|
||||
"c", # c
|
||||
"d", # d
|
||||
"e", # e
|
||||
]) # f # g
|
||||
|
||||
func({ # a # b
|
||||
"c": 1, # c
|
||||
"d": 2, # d
|
||||
"e": 3, # e
|
||||
}) # f # g
|
||||
|
||||
func(
|
||||
# preserve me
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
)
|
||||
|
||||
func([ # preserve me but hug brackets
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
])
|
||||
|
||||
func([
|
||||
# preserve me but hug brackets
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
])
|
||||
|
||||
func([
|
||||
"c",
|
||||
# preserve me but hug brackets
|
||||
"d",
|
||||
"e",
|
||||
])
|
||||
|
||||
func([
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
# preserve me but hug brackets
|
||||
])
|
||||
|
||||
func([
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]) # preserve me but hug brackets
|
||||
|
||||
func(
|
||||
[
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
]
|
||||
# preserve me
|
||||
)
|
||||
|
||||
func([x for x in "short line"])
|
||||
func([
|
||||
x for x in "long line long line long line long line long line long line long line"
|
||||
])
|
||||
func([
|
||||
x
|
||||
for x in [
|
||||
x
|
||||
for x in "long line long line long line long line long line long line long line"
|
||||
]
|
||||
])
|
||||
|
||||
func({"short line"})
|
||||
func({
|
||||
"long line",
|
||||
"long long line",
|
||||
"long long long line",
|
||||
"long long long long line",
|
||||
"long long long long long line",
|
||||
})
|
||||
func({
|
||||
{
|
||||
"long line",
|
||||
"long long line",
|
||||
"long long long line",
|
||||
"long long long long line",
|
||||
"long long long long long line",
|
||||
}
|
||||
})
|
||||
|
||||
foooooooooooooooooooo(
|
||||
[{c: n + 1 for c in range(256)} for n in range(100)] + [{}], {size}
|
||||
)
|
||||
|
||||
baaaaaaaaaaaaar(
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], {x}, "a string", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
)
|
||||
|
||||
foo(*[
|
||||
"long long long long long line",
|
||||
"long long long long long line",
|
||||
"long long long long long line",
|
||||
])
|
||||
|
||||
foo(*[
|
||||
str(i) for i in range(100000000000000000000000000000000000000000000000000000000000)
|
||||
])
|
||||
```
|
|
@ -57,7 +57,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Enabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -352,7 +352,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -528,7 +528,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -704,7 +704,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -880,7 +880,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
|
|
@ -1369,7 +1369,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -2741,7 +2741,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -4113,7 +4113,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -5485,7 +5485,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -6857,7 +6857,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Enabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -8222,7 +8222,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Enabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -9587,7 +9587,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Enabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -10961,7 +10961,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Enabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -12326,7 +12326,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Enabled
|
||||
docstring-code-line-width = 60
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -13700,7 +13700,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Enabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Enabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Enabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -860,7 +860,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Enabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -1386,7 +1386,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Enabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -1937,7 +1937,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Enabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -185,7 +185,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
@ -324,7 +324,7 @@ magic-trailing-comma = Respect
|
|||
docstring-code = Disabled
|
||||
docstring-code-line-width = "dynamic"
|
||||
preview = Disabled
|
||||
target_version = Py38
|
||||
target_version = Py39
|
||||
source_type = Python
|
||||
```
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue