Formatting nits
This commit is contained in:
parent
6dbb657681
commit
b1cd59f267
12
black.py
12
black.py
@ -743,9 +743,8 @@ def append(self, leaf: Leaf, preformatted: bool = False) -> None:
|
|||||||
if not has_value:
|
if not has_value:
|
||||||
return
|
return
|
||||||
|
|
||||||
if token.COLON == leaf.type and self.is_class_parenth_empty:
|
if token.COLON == leaf.type and self.is_class_paren_empty:
|
||||||
del self.leaves[-2:]
|
del self.leaves[-2:]
|
||||||
|
|
||||||
if self.leaves and not preformatted:
|
if self.leaves and not preformatted:
|
||||||
# Note: at this point leaf.prefix should be empty except for
|
# Note: at this point leaf.prefix should be empty except for
|
||||||
# imports, for which we only preserve newlines.
|
# imports, for which we only preserve newlines.
|
||||||
@ -755,7 +754,6 @@ def append(self, leaf: Leaf, preformatted: bool = False) -> None:
|
|||||||
if self.inside_brackets or not preformatted:
|
if self.inside_brackets or not preformatted:
|
||||||
self.bracket_tracker.mark(leaf)
|
self.bracket_tracker.mark(leaf)
|
||||||
self.maybe_remove_trailing_comma(leaf)
|
self.maybe_remove_trailing_comma(leaf)
|
||||||
|
|
||||||
if not self.append_comment(leaf):
|
if not self.append_comment(leaf):
|
||||||
self.leaves.append(leaf)
|
self.leaves.append(leaf)
|
||||||
|
|
||||||
@ -844,8 +842,11 @@ def is_yield(self) -> bool:
|
|||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_class_parenth_empty(self) -> bool:
|
def is_class_paren_empty(self) -> bool:
|
||||||
"""Is this class parentheses blank?"""
|
"""Is this a class with no base classes but using parentheses?
|
||||||
|
|
||||||
|
Those are unnecessary and should be removed.
|
||||||
|
"""
|
||||||
return (
|
return (
|
||||||
bool(self)
|
bool(self)
|
||||||
and len(self.leaves) == 4
|
and len(self.leaves) == 4
|
||||||
@ -1141,7 +1142,6 @@ def line(self, indent: int = 0, type: Type[Line] = Line) -> Iterator[Line]:
|
|||||||
|
|
||||||
If any lines were generated, set up a new current_line.
|
If any lines were generated, set up a new current_line.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not self.current_line:
|
if not self.current_line:
|
||||||
if self.current_line.__class__ == type:
|
if self.current_line.__class__ == type:
|
||||||
self.current_line.depth += indent
|
self.current_line.depth += indent
|
||||||
|
@ -1,15 +1,10 @@
|
|||||||
class SimpleClassWithBlankParentheses():
|
class SimpleClassWithBlankParentheses():
|
||||||
pass
|
pass
|
||||||
|
class ClassWithSpaceParentheses ( ):
|
||||||
|
|
||||||
class ClassWithSpaceParentheses():
|
|
||||||
first_test_data = 90
|
first_test_data = 90
|
||||||
second_test_data = 100
|
second_test_data = 100
|
||||||
|
|
||||||
def test_func(self):
|
def test_func(self):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class ClassWithEmptyFunc(object):
|
class ClassWithEmptyFunc(object):
|
||||||
|
|
||||||
def func_with_blank_parentheses():
|
def func_with_blank_parentheses():
|
||||||
@ -18,16 +13,11 @@ def func_with_blank_parentheses():
|
|||||||
|
|
||||||
def public_func_with_blank_parentheses():
|
def public_func_with_blank_parentheses():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def class_under_the_func_with_blank_parentheses():
|
def class_under_the_func_with_blank_parentheses():
|
||||||
|
|
||||||
class InsideFunc():
|
class InsideFunc():
|
||||||
pass
|
pass
|
||||||
|
class NormalClass (
|
||||||
|
):
|
||||||
class NormalClass():
|
|
||||||
|
|
||||||
def func_for_testing(self, first, second):
|
def func_for_testing(self, first, second):
|
||||||
sum = first + second
|
sum = first + second
|
||||||
return sum
|
return sum
|
||||||
|
Loading…
Reference in New Issue
Block a user