@@ -414,10 +414,9 @@ def foo(a: (int), b: (float) = 7): ...
414
414
yield from self .visit_default (node )
415
415
416
416
def visit_STRING (self , leaf : Leaf ) -> Iterator [Line ]:
417
- if Preview .hex_codes_in_unicode_sequences in self .mode :
418
- normalize_unicode_escape_sequences (leaf )
417
+ normalize_unicode_escape_sequences (leaf )
419
418
420
- if is_docstring (leaf , self . mode ) and not re .search (r"\\\s*\n" , leaf .value ):
419
+ if is_docstring (leaf ) and not re .search (r"\\\s*\n" , leaf .value ):
421
420
# We're ignoring docstrings with backslash newline escapes because changing
422
421
# indentation of those changes the AST representation of the code.
423
422
if self .mode .string_normalization :
@@ -488,10 +487,7 @@ def visit_STRING(self, leaf: Leaf) -> Iterator[Line]:
488
487
and len (indent ) + quote_len <= self .mode .line_length
489
488
and not has_trailing_backslash
490
489
):
491
- if (
492
- Preview .docstring_check_for_newline in self .mode
493
- and leaf .value [- 1 - quote_len ] == "\n "
494
- ):
490
+ if leaf .value [- 1 - quote_len ] == "\n " :
495
491
leaf .value = prefix + quote + docstring + quote
496
492
else :
497
493
leaf .value = prefix + quote + docstring + "\n " + indent + quote
@@ -511,10 +507,7 @@ def visit_NUMBER(self, leaf: Leaf) -> Iterator[Line]:
511
507
512
508
def visit_atom (self , node : Node ) -> Iterator [Line ]:
513
509
"""Visit any atom"""
514
- if (
515
- Preview .remove_lone_list_item_parens in self .mode
516
- and len (node .children ) == 3
517
- ):
510
+ if len (node .children ) == 3 :
518
511
first = node .children [0 ]
519
512
last = node .children [- 1 ]
520
513
if (first .type == token .LSQB and last .type == token .RSQB ) or (
@@ -602,8 +595,7 @@ def __post_init__(self) -> None:
602
595
# PEP 634
603
596
self .visit_match_stmt = self .visit_match_case
604
597
self .visit_case_block = self .visit_match_case
605
- if Preview .remove_redundant_guard_parens in self .mode :
606
- self .visit_guard = partial (v , keywords = Ø , parens = {"if" })
598
+ self .visit_guard = partial (v , keywords = Ø , parens = {"if" })
607
599
608
600
609
601
def _hugging_power_ops_line_to_string (
@@ -1132,12 +1124,7 @@ def _ensure_trailing_comma(
1132
1124
return False
1133
1125
# Don't add commas if we already have any commas
1134
1126
if any (
1135
- leaf .type == token .COMMA
1136
- and (
1137
- Preview .typed_params_trailing_comma not in original .mode
1138
- or not is_part_of_annotation (leaf )
1139
- )
1140
- for leaf in leaves
1127
+ leaf .type == token .COMMA and not is_part_of_annotation (leaf ) for leaf in leaves
1141
1128
):
1142
1129
return False
1143
1130
@@ -1418,11 +1405,7 @@ def normalize_invisible_parens( # noqa: C901
1418
1405
)
1419
1406
1420
1407
# Add parentheses around if guards in case blocks
1421
- if (
1422
- isinstance (child , Node )
1423
- and child .type == syms .guard
1424
- and Preview .parens_for_long_if_clauses_in_case_block in mode
1425
- ):
1408
+ if isinstance (child , Node ) and child .type == syms .guard :
1426
1409
normalize_invisible_parens (
1427
1410
child , parens_after = {"if" }, mode = mode , features = features
1428
1411
)
0 commit comments