Enable two more

This commit is contained in:
Jelle Zijlstra 2023-11-20 22:29:44 -08:00
parent cc3780fd9f
commit bb31678201
4 changed files with 26 additions and 30 deletions

View File

@ -161,7 +161,6 @@ def visit_default(self, node: LN) -> Iterator[Line]:
def visit_test(self, node: Node) -> Iterator[Line]: def visit_test(self, node: Node) -> Iterator[Line]:
"""Visit an `x if y else z` test""" """Visit an `x if y else z` test"""
if Preview.parenthesize_conditional_expressions in self.mode:
already_parenthesized = ( already_parenthesized = (
node.prev_sibling and node.prev_sibling.type == token.LPAR node.prev_sibling and node.prev_sibling.type == token.LPAR
) )
@ -230,7 +229,6 @@ def visit_paramspec(self, node: Node) -> Iterator[Line]:
node.children[1].prefix = "" node.children[1].prefix = ""
def visit_dictsetmaker(self, node: Node) -> Iterator[Line]: def visit_dictsetmaker(self, node: Node) -> Iterator[Line]:
if Preview.wrap_long_dict_values_in_parens in self.mode:
for i, child in enumerate(node.children): for i, child in enumerate(node.children):
if i == 0: if i == 0:
continue continue

View File

@ -169,11 +169,7 @@ class Preview(Enum):
"""Individual preview style features.""" """Individual preview style features."""
hex_codes_in_unicode_sequences = auto() hex_codes_in_unicode_sequences = auto()
# NOTE: string_processing requires wrap_long_dict_values_in_parens
# for https://github.com/psf/black/issues/3117 to be fixed.
string_processing = auto() string_processing = auto()
parenthesize_conditional_expressions = auto()
wrap_long_dict_values_in_parens = auto()
hug_parens_with_braces_and_square_brackets = auto() hug_parens_with_braces_and_square_brackets = auto()

View File

@ -312,8 +312,8 @@ async def f():
if (1 if super_long_test_name else 2) if (1 if super_long_test_name else 2)
else (str or bytes or None) else (str or bytes or None)
) )
{"2.7": dead, "3.7": (long_live or die_hard)} {"2.7": dead, "3.7": long_live or die_hard}
{"2.7": dead, "3.7": (long_live or die_hard), **{"3.6": verygood}} {"2.7": dead, "3.7": long_live or die_hard, **{"3.6": verygood}}
{**a, **b, **c} {**a, **b, **c}
{"2.7", "3.6", "3.7", "3.8", "3.9", ("4.0" if gilectomy else "3.10")} {"2.7", "3.6", "3.7", "3.8", "3.9", ("4.0" if gilectomy else "3.10")}
({"a": "b"}, (True or False), (+value), "string", b"bytes") or None ({"a": "b"}, (True or False), (+value), "string", b"bytes") or None

View File

@ -43,8 +43,10 @@
% ( % (
"formatted", "formatted",
"string", "string",
): "This is a really really really long string that has to go inside of a dictionary. It is %s bad (#%d)." ): (
% ("soooo", 2), "This is a really really really long string that has to go inside of a dictionary. It is %s bad (#%d)."
% ("soooo", 2)
),
} }
func_with_keywords( func_with_keywords(