Mercurial > hg-stable
changeset 27355:b479fc425a81
encoding: use absolute_import
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 12 Dec 2015 22:57:48 -0500 |
parents | bced7180db19 |
children | c2effd1ecebf |
files | mercurial/encoding.py tests/test-check-py3-compat.t |
diffstat | 2 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/encoding.py Sat Dec 12 22:20:29 2015 -0500 +++ b/mercurial/encoding.py Sat Dec 12 22:57:48 2015 -0500 @@ -5,8 +5,15 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import error -import unicodedata, locale, os +from __future__ import absolute_import + +import locale +import os +import unicodedata + +from . import ( + error, +) # These unicode characters are ignored by HFS+ (Apple Technote 1150, # "Unicode Subtleties"), so we need to ignore them in some places for @@ -194,7 +201,7 @@ 'ellipsis' is always placed at trimmed side. >>> ellipsis = '+++' - >>> from mercurial import encoding + >>> from . import encoding >>> encoding.encoding = 'utf-8' >>> t= '1234567890' >>> print trim(t, 12, ellipsis=ellipsis) @@ -290,7 +297,7 @@ def asciilower(s): # delay importing avoids cyclic dependency around "parsers" in # pure Python build (util => i18n => encoding => parsers => util) - import parsers + from . import parsers impl = getattr(parsers, 'asciilower', _asciilower) global asciilower asciilower = impl @@ -306,7 +313,7 @@ def asciiupper(s): # delay importing avoids cyclic dependency around "parsers" in # pure Python build (util => i18n => encoding => parsers => util) - import parsers + from . import parsers impl = getattr(parsers, 'asciiupper', _asciiupper) global asciiupper asciiupper = impl
--- a/tests/test-check-py3-compat.t Sat Dec 12 22:20:29 2015 -0500 +++ b/tests/test-check-py3-compat.t Sat Dec 12 22:57:48 2015 -0500 @@ -104,7 +104,6 @@ mercurial/context.py not using absolute_import mercurial/dirstate.py not using absolute_import mercurial/dispatch.py requires print_function - mercurial/encoding.py not using absolute_import mercurial/exchange.py not using absolute_import mercurial/help.py not using absolute_import mercurial/httpclient/__init__.py not using absolute_import