mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:10 +00:00
Use one line between top-level items if formatting a stub file (#6501)
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
parent
455db84a59
commit
84d178a219
7 changed files with 451 additions and 2 deletions
39
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/top_level.py
vendored
Normal file
39
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/top_level.py
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
class A:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
class B:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def foo():
|
||||
pass
|
||||
|
||||
class Del(expr_context): ...
|
||||
class Load(expr_context): ...
|
||||
|
||||
# Some comment.
|
||||
class Other(expr_context): ...
|
||||
class Store(expr_context): ...
|
||||
class Foo(Bar): ...
|
||||
|
||||
class Baz(Qux):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
class Quux(Qux):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
# Some comment.
|
||||
class Quuz(Qux):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def bar(): ...
|
||||
def baz(): ...
|
||||
def quux():
|
||||
"""Some docstring."""
|
||||
|
||||
def quuz():
|
||||
"""Some docstring."""
|
78
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/top_level.pyi
vendored
Normal file
78
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/top_level.pyi
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
class A:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
class B:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def foo():
|
||||
pass
|
||||
|
||||
|
||||
class Del(expr_context):
|
||||
...
|
||||
|
||||
|
||||
class Load(expr_context):
|
||||
...
|
||||
|
||||
|
||||
# Some comment.
|
||||
class Other(expr_context):
|
||||
...
|
||||
|
||||
|
||||
class Store(expr_context):
|
||||
...
|
||||
|
||||
|
||||
class Foo(Bar):
|
||||
...
|
||||
|
||||
|
||||
class Baz(Qux):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
class Quux(Qux):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
# Some comment.
|
||||
class Quuz(Qux):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def bar():
|
||||
...
|
||||
|
||||
|
||||
def baz():
|
||||
...
|
||||
|
||||
|
||||
def quux():
|
||||
"""Some docstring."""
|
||||
|
||||
|
||||
def quuz():
|
||||
"""Some docstring."""
|
||||
|
||||
def a():
|
||||
...
|
||||
|
||||
class Test:
|
||||
...
|
||||
|
||||
class Test2(A):
|
||||
...
|
||||
|
||||
def b(): ...
|
||||
# comment
|
||||
def c(): ...
|
Loading…
Add table
Add a link
Reference in a new issue