mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:56 +00:00

This ensures the python label is used for all python code blocks for consistency. ## Test Plan Visual inspection of all changes via git client ensuring no other changes were made in error.
311 lines
2.1 KiB
Text
311 lines
2.1 KiB
Text
---
|
|
source: crates/ruff_python_formatter/tests/fixtures.rs
|
|
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/newlines.pyi
|
|
---
|
|
## Input
|
|
```python
|
|
###
|
|
# Blank lines around functions
|
|
###
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
|
|
if True:
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
|
|
x = 1
|
|
|
|
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
|
|
x = 1
|
|
|
|
|
|
|
|
# comment
|
|
def f():
|
|
pass
|
|
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
# comment
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
# comment
|
|
def f():
|
|
pass
|
|
|
|
|
|
x = 1
|
|
|
|
|
|
# comment
|
|
|
|
|
|
|
|
# comment
|
|
|
|
|
|
|
|
def f():
|
|
pass
|
|
# comment
|
|
|
|
|
|
def f():
|
|
pass
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
|
|
# comment
|
|
|
|
###
|
|
# Blank lines around imports.
|
|
###
|
|
|
|
def f():
|
|
import x
|
|
# comment
|
|
import y
|
|
|
|
|
|
def f():
|
|
import x
|
|
|
|
# comment
|
|
import y
|
|
|
|
|
|
def f():
|
|
import x
|
|
# comment
|
|
|
|
import y
|
|
|
|
|
|
def f():
|
|
import x
|
|
# comment
|
|
|
|
|
|
import y
|
|
|
|
|
|
def f():
|
|
import x
|
|
|
|
|
|
# comment
|
|
import y
|
|
|
|
|
|
def f():
|
|
import x
|
|
|
|
# comment
|
|
|
|
import y
|
|
|
|
|
|
def f():
|
|
import x # comment
|
|
# comment
|
|
|
|
import y
|
|
|
|
|
|
def f(): pass # comment
|
|
# comment
|
|
|
|
x = 1
|
|
|
|
|
|
def f():
|
|
pass
|
|
|
|
|
|
|
|
|
|
# comment
|
|
|
|
x = 1
|
|
```
|
|
|
|
## Output
|
|
```python
|
|
###
|
|
# Blank lines around functions
|
|
###
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
if True:
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
# comment
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
# comment
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
# comment
|
|
|
|
###
|
|
# Blank lines around imports.
|
|
###
|
|
|
|
def f():
|
|
import x
|
|
|
|
# comment
|
|
import y
|
|
|
|
def f():
|
|
import x
|
|
|
|
# comment
|
|
import y
|
|
|
|
def f():
|
|
import x
|
|
# comment
|
|
|
|
import y
|
|
|
|
def f():
|
|
import x
|
|
# comment
|
|
|
|
import y
|
|
|
|
def f():
|
|
import x
|
|
|
|
# comment
|
|
import y
|
|
|
|
def f():
|
|
import x
|
|
|
|
# comment
|
|
|
|
import y
|
|
|
|
def f():
|
|
import x # comment
|
|
# comment
|
|
|
|
import y
|
|
|
|
def f():
|
|
pass # comment
|
|
|
|
# comment
|
|
|
|
x = 1
|
|
|
|
def f():
|
|
pass
|
|
|
|
# comment
|
|
|
|
x = 1
|
|
```
|
|
|
|
|
|
|