Skip to content

Commit a0c1bb6

Browse files
committed
Remove _ast_unparse t/f implicit concat helper code
1 parent b17b7c9 commit a0c1bb6

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

Lib/_ast_unparse.py

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -626,35 +626,11 @@ def _write_ftstring(self, values, prefix):
626626
)
627627
self._ftstring_helper(fstring_parts)
628628

629-
def _tstring_helper(self, node):
630-
if not node.values:
631-
self._write_ftstring([], "t")
632-
return
633-
last_idx = 0
634-
for i, value in enumerate(node.values):
635-
# This can happen if we have an implicit concat of a t-string
636-
# with an f-string
637-
if isinstance(value, FormattedValue):
638-
if i > last_idx:
639-
# Write t-string until here
640-
self._write_ftstring(node.values[last_idx:i], "t")
641-
self.write(" ")
642-
# Write f-string with the current formatted value
643-
self._write_ftstring([node.values[i]], "f")
644-
if i + 1 < len(node.values):
645-
# Only add a space if there are more values after this
646-
self.write(" ")
647-
last_idx = i + 1
648-
649-
if last_idx < len(node.values):
650-
# Write t-string from last_idx to end
651-
self._write_ftstring(node.values[last_idx:], "t")
652-
653629
def visit_JoinedStr(self, node):
654630
self._write_ftstring(node.values, "f")
655631

656632
def visit_TemplateStr(self, node):
657-
self._tstring_helper(node)
633+
self._write_ftstring(node.values, "t")
658634

659635
def _write_ftstring_inner(self, node, is_format_spec=False):
660636
if isinstance(node, JoinedStr):

0 commit comments

Comments
 (0)