Skip to content

Commit 7c24edf

Browse files
committed
Use parent's type instead of generic Token in formatter.
1 parent ce214d2 commit 7c24edf

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

bpython/formatter.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,9 @@ def format(self, tokensource, outfile):
105105
if text == '\n':
106106
continue
107107

108-
if token in self.f_strings:
109-
o += "%s\x03%s\x04" % (self.f_strings[token], text )
110-
else:
111-
o += "%s\x03%s\x04" % (self.f_strings[Token], text )
108+
while token not in self.f_strings:
109+
token = token.parent
110+
o += "%s\x03%s\x04" % (self.f_strings[token], text)
112111
outfile.write(o.rstrip())
113112

114113
# vim: sw=4 ts=4 sts=4 ai et

0 commit comments

Comments
 (0)