Skip to content

Commit b2630fc

Browse files
committed
Make BPythonFormatter.f_strings an instance (not class) attribute.
Having this as a class attribute means you can only use one color_scheme per session, which could be considered a bug.
1 parent 6b41e85 commit b2630fc

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

bpython/formatter.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,14 @@ class BPythonFormatter(Formatter):
8383
See the Pygments source for more info; it's pretty
8484
straightforward."""
8585

86-
f_strings = {}
87-
8886
def __init__(self, color_scheme, **options):
89-
if not self.f_strings:
90-
for k, v in theme_map.iteritems():
91-
self.f_strings[k] = '\x01%s' % (color_scheme[v],)
92-
if k is Parenthesis:
93-
# FIXME: Find a way to make this the inverse of the current
94-
# background colour
95-
self.f_strings[k] += 'I'
87+
self.f_strings = {}
88+
for k, v in theme_map.iteritems():
89+
self.f_strings[k] = '\x01%s' % (color_scheme[v],)
90+
if k is Parenthesis:
91+
# FIXME: Find a way to make this the inverse of the current
92+
# background colour
93+
self.f_strings[k] += 'I'
9694
Formatter.__init__(self, **options)
9795

9896
def format(self, tokensource, outfile):

0 commit comments

Comments
 (0)