Mercurial > public > mercurial-scm > hg-stable
diff hgext/highlight/highlight.py @ 29485:6a98f9408a50
py3: make files use absolute_import and print_function
This patch includes addition of absolute_import and print_function to the
files where they are missing. The modern importing conventions are also followed.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 03 Jul 2016 22:28:24 +0530 |
parents | ead25aa27a43 |
children | 661025fd3e1c |
line wrap: on
line diff
--- a/hgext/highlight/highlight.py Fri Jul 01 19:17:45 2016 -0700 +++ b/hgext/highlight/highlight.py Sun Jul 03 22:28:24 2016 +0530 @@ -8,14 +8,27 @@ # The original module was split in an interface and an implementation # file to defer pygments loading and speedup extension setup. +from __future__ import absolute_import + +import pygments +import pygments.formatters +import pygments.lexers +import pygments.util + from mercurial import demandimport demandimport.ignore.extend(['pkgutil', 'pkg_resources', '__main__']) -from mercurial import util, encoding + +from mercurial import ( + encoding, + util, +) -from pygments import highlight -from pygments.util import ClassNotFound -from pygments.lexers import guess_lexer, guess_lexer_for_filename, TextLexer -from pygments.formatters import HtmlFormatter +highlight = pygments.highlight +ClassNotFound = pygments.util.ClassNotFound +guess_lexer = pygments.lexers.guess_lexer +guess_lexer_for_filename = pygments.lexers.guess_lexer_for_filename +TextLexer = pygments.lexers.TextLexer +HtmlFormatter = pygments.formatters.HtmlFormatter SYNTAX_CSS = ('\n<link rel="stylesheet" href="{url}highlightcss" ' 'type="text/css" />')