Skip to content

Commit

Permalink
[ignore] curious for diff shade output
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Jul 22, 2023
1 parent 13bd4ff commit 9a10436
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/black/linegen.py
Expand Up @@ -281,7 +281,9 @@ def visit_match_case(self, node: Node) -> Iterator[Line]:

def visit_suite(self, node: Node) -> Iterator[Line]:
"""Visit a suite."""
if self.mode.is_pyi and is_stub_suite(node):
if (
self.mode.is_pyi or Preview.dummy_implementations in self.mode
) and is_stub_suite(node):
yield from self.visit(node.children[2])
else:
yield from self.visit_default(node)
Expand All @@ -296,7 +298,9 @@ def visit_simple_stmt(self, node: Node) -> Iterator[Line]:

is_suite_like = node.parent and node.parent.type in STATEMENT
if is_suite_like:
if self.mode.is_pyi and is_stub_body(node):
if (
self.mode.is_pyi or Preview.dummy_implementations in self.mode
) and is_stub_body(node):
yield from self.visit_default(node)
else:
yield from self.line(+1)
Expand All @@ -305,7 +309,7 @@ def visit_simple_stmt(self, node: Node) -> Iterator[Line]:

else:
if (
not self.mode.is_pyi
not (self.mode.is_pyi or Preview.dummy_implementations in self.mode)
or not node.parent
or not is_stub_suite(node.parent)
):
Expand Down
1 change: 1 addition & 0 deletions src/black/mode.py
Expand Up @@ -182,6 +182,7 @@ class Preview(Enum):
skip_magic_trailing_comma_in_subscript = auto()
wrap_long_dict_values_in_parens = auto()
wrap_multiple_context_managers_in_parens = auto()
dummy_implementations = auto()


class Deprecated(UserWarning):
Expand Down

0 comments on commit 9a10436

Please sign in to comment.