Skip to content

Commit

Permalink
Update empty line documentation
Browse files Browse the repository at this point in the history
Reflects status quo following psf#4043

Fixes psf#4238
  • Loading branch information
hauntsaninja committed Feb 18, 2024
1 parent 6fdf8a4 commit 6831055
Showing 1 changed file with 15 additions and 24 deletions.
39 changes: 15 additions & 24 deletions docs/the_black_code_style/current_style.md
Expand Up @@ -166,44 +166,35 @@ that in-function vertical whitespace should only be used sparingly.
_Black_ will allow single empty lines inside functions, and single and double empty
lines on module level left by the original editors, except when they're within
parenthesized expressions. Since such expressions are always reformatted to fit minimal
space, this whitespace is lost. The other exception is that it will remove any empty
lines immediately following a statement that introduces a new indentation level.
space, this whitespace is lost.

```python
# in:

def foo():
def function(
some_argument: int,

print("All the newlines above me should be deleted!")
other_argument: int = 5,
) -> EmptyLineInParenWillBeDeleted:


if condition:

print("No newline above me!")

print("There is a newline above me, and that's OK!")


class Point:

x: int
y: int
print("One empty line above me will be kept!")

def this_is_okay_too():
print("No empty line here")
# out:

def foo():
print("All the newlines above me should be deleted!")


if condition:
print("No newline above me!")
def function(
some_argument: int,
other_argument: int = 5,
) -> EmptyLineInParenWillBeDeleted:

print("There is a newline above me, and that's OK!")
print("One empty line above me will be kept!")


class Point:
x: int
y: int
def this_is_okay_too():
print("No empty line here")
```

It will also insert proper spacing before and after function definitions. It's one line
Expand Down

0 comments on commit 6831055

Please sign in to comment.