diff options
author | Georg Brandl <georg@python.org> | 2019-11-25 06:21:23 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2019-11-25 06:21:23 +0100 |
commit | 9ca90d60b125775a688f72b84d9a33e3f9141e3c (patch) | |
tree | 7b7aae1dff329d7296f24ccdd786f7281925c9c0 | |
parent | a0703effd093a09edcec0020210e0f151a2474ba (diff) | |
download | pygments-git-9ca90d60b125775a688f72b84d9a33e3f9141e3c.tar.gz |
formatters.other: style/import fixups
-rw-r--r-- | pygments/formatters/other.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pygments/formatters/other.py b/pygments/formatters/other.py index f0a3b87f..c09eff0c 100644 --- a/pygments/formatters/other.py +++ b/pygments/formatters/other.py @@ -10,7 +10,7 @@ """ from pygments.formatter import Formatter -from pygments.util import OptionError, get_choice_opt +from pygments.util import get_choice_opt from pygments.token import Token from pygments.console import colorize @@ -87,14 +87,17 @@ class RawTokenFormatter(Formatter): if self.compress == 'gz': import gzip outfile = gzip.GzipFile('', 'wb', 9, outfile) + def write(text): outfile.write(text.encode()) flush = outfile.flush elif self.compress == 'bz2': import bz2 compressor = bz2.BZ2Compressor(9) + def write(text): outfile.write(compressor.compress(text.encode())) + def flush(): outfile.write(compressor.flush()) outfile.flush() @@ -115,6 +118,7 @@ class RawTokenFormatter(Formatter): write("%s\t%r\n" % (ttype, value)) flush() + TESTCASE_BEFORE = u'''\ def testNeedsName(lexer): fragment = %r |