Remove remains of extra empty lines for flow control statements
This commit is contained in:
parent
bbed104e6d
commit
e9a940d69e
24
black.py
24
black.py
@ -971,27 +971,6 @@ def is_def(self) -> bool:
|
|||||||
and second_leaf.value == "def"
|
and second_leaf.value == "def"
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
|
||||||
def is_flow_control(self) -> bool:
|
|
||||||
"""Is this line a flow control statement?
|
|
||||||
|
|
||||||
Those are `return`, `raise`, `break`, and `continue`.
|
|
||||||
"""
|
|
||||||
return (
|
|
||||||
bool(self)
|
|
||||||
and self.leaves[0].type == token.NAME
|
|
||||||
and self.leaves[0].value in FLOW_CONTROL
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def is_yield(self) -> bool:
|
|
||||||
"""Is this line a yield statement?"""
|
|
||||||
return (
|
|
||||||
bool(self)
|
|
||||||
and self.leaves[0].type == token.NAME
|
|
||||||
and self.leaves[0].value == "yield"
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_class_paren_empty(self) -> bool:
|
def is_class_paren_empty(self) -> bool:
|
||||||
"""Is this a class with no base classes but using parentheses?
|
"""Is this a class with no base classes but using parentheses?
|
||||||
@ -1224,8 +1203,7 @@ def maybe_empty_lines(self, current_line: Line) -> Tuple[int, int]:
|
|||||||
"""Return the number of extra empty lines before and after the `current_line`.
|
"""Return the number of extra empty lines before and after the `current_line`.
|
||||||
|
|
||||||
This is for separating `def`, `async def` and `class` with extra empty
|
This is for separating `def`, `async def` and `class` with extra empty
|
||||||
lines (two on module-level), as well as providing an extra empty line
|
lines (two on module-level).
|
||||||
after flow control keywords to make them more prominent.
|
|
||||||
"""
|
"""
|
||||||
if isinstance(current_line, UnformattedLines):
|
if isinstance(current_line, UnformattedLines):
|
||||||
return 0, 0
|
return 0, 0
|
||||||
|
Loading…
Reference in New Issue
Block a user