Skip to content

Commit 82da555

Browse files
committed
Upgrade internal pygments to 2.1.3
1 parent 95c4fa1 commit 82da555

File tree

180 files changed

+64592
-20991
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+64592
-20991
lines changed

python/ext-libs/pygments/__init__.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
.. _Pygments tip:
2323
http://bitbucket.org/birkenfeld/pygments-main/get/tip.zip#egg=Pygments-dev
2424
25-
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
25+
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
2626
:license: BSD, see LICENSE for details.
2727
"""
2828

29-
__version__ = '1.6'
29+
__version__ = '2.1.3'
3030
__docformat__ = 'restructuredtext'
3131

3232
__all__ = ['lex', 'format', 'highlight']
@@ -43,15 +43,16 @@ def lex(code, lexer):
4343
"""
4444
try:
4545
return lexer.get_tokens(code)
46-
except TypeError, err:
46+
except TypeError as err:
4747
if isinstance(err.args[0], str) and \
48-
'unbound method get_tokens' in err.args[0]:
48+
('unbound method get_tokens' in err.args[0] or
49+
'missing 1 required positional argument' in err.args[0]):
4950
raise TypeError('lex() argument must be a lexer instance, '
5051
'not a class')
5152
raise
5253

5354

54-
def format(tokens, formatter, outfile=None):
55+
def format(tokens, formatter, outfile=None): # pylint: disable=redefined-builtin
5556
"""
5657
Format a tokenlist ``tokens`` with the formatter ``formatter``.
5758
@@ -61,15 +62,15 @@ def format(tokens, formatter, outfile=None):
6162
"""
6263
try:
6364
if not outfile:
64-
#print formatter, 'using', formatter.encoding
65-
realoutfile = formatter.encoding and BytesIO() or StringIO()
65+
realoutfile = getattr(formatter, 'encoding', None) and BytesIO() or StringIO()
6666
formatter.format(tokens, realoutfile)
6767
return realoutfile.getvalue()
6868
else:
6969
formatter.format(tokens, outfile)
70-
except TypeError, err:
70+
except TypeError as err:
7171
if isinstance(err.args[0], str) and \
72-
'unbound method format' in err.args[0]:
72+
('unbound method format' in err.args[0] or
73+
'missing 1 required positional argument' in err.args[0]):
7374
raise TypeError('format() argument must be a formatter instance, '
7475
'not a class')
7576
raise
@@ -86,6 +87,6 @@ def highlight(code, lexer, formatter, outfile=None):
8687
return format(lex(code, lexer), formatter, outfile)
8788

8889

89-
if __name__ == '__main__':
90+
if __name__ == '__main__': # pragma: no cover
9091
from pygments.cmdline import main
9192
sys.exit(main(sys.argv))

0 commit comments

Comments
 (0)