diff options
| author | Georg Brandl <georg@python.org> | 2020-02-29 15:45:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-29 15:45:08 +0100 |
| commit | 35544e2fc6eed0ce4a27ec7285aac71ff0ddc473 (patch) | |
| tree | 4390507bf0d4d5a4596cfc57c575da12f9da40f9 /pygments/formatters/html.py | |
| parent | 14fc057d300102d88a07eda5558f238d49dd23f6 (diff) | |
| download | pygments-git-35544e2fc6eed0ce4a27ec7285aac71ff0ddc473.tar.gz | |
Remove Python 2 compatibility (#1348)
* Remove Python 2 compatibility
* remove 2/3 shims in pygments.util
* update setup.py metadata
* Remove unneeded object inheritance.
* Remove unneeded future imports.
Diffstat (limited to 'pygments/formatters/html.py')
| -rw-r--r-- | pygments/formatters/html.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py index be9d8534..c5ae774d 100644 --- a/pygments/formatters/html.py +++ b/pygments/formatters/html.py @@ -9,16 +9,14 @@ :license: BSD, see LICENSE for details. """ -from __future__ import print_function - import os import sys import os.path +from io import StringIO from pygments.formatter import Formatter from pygments.token import Token, Text, STANDARD_TYPES -from pygments.util import get_bool_opt, get_int_opt, get_list_opt, \ - StringIO, string_types, iteritems +from pygments.util import get_bool_opt, get_int_opt, get_list_opt try: import ctags @@ -41,12 +39,14 @@ def escape_html(text, table=_escape_html_table): """Escape &, <, > as well as single and double quotes for HTML.""" return text.translate(table) + def webify(color): if color.startswith('calc') or color.startswith('var'): return color else: return '#' + color + def _get_ttype_class(ttype): fname = STANDARD_TYPES.get(ttype) if fname: @@ -497,7 +497,7 @@ class HtmlFormatter(Formatter): """ if arg is None: arg = ('cssclass' in self.options and '.'+self.cssclass or '') - if isinstance(arg, string_types): + if isinstance(arg, str): args = [arg] else: args = list(arg) @@ -511,7 +511,7 @@ class HtmlFormatter(Formatter): return ', '.join(tmp) styles = [(level, ttype, cls, style) - for cls, (style, ttype, level) in iteritems(self.class2style) + for cls, (style, ttype, level) in self.class2style.items() if cls and style] styles.sort() lines = ['%s { %s } /* %s */' % (prefix(cls), style, repr(ttype)[6:]) |
