From 5c9294ebf1fdbe574bcacaba29d6659cea69d2b1 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Wed, 12 Aug 2020 15:45:21 -0400 Subject: [PATCH] Port to Python 3. --- src/allmydata/util/_python3.py | 1 + src/allmydata/util/encodingutil.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/allmydata/util/_python3.py b/src/allmydata/util/_python3.py index 581b48005..3799cdeb7 100644 --- a/src/allmydata/util/_python3.py +++ b/src/allmydata/util/_python3.py @@ -32,6 +32,7 @@ PORTED_MODULES = [ "allmydata.util.deferredutil", "allmydata.util.fileutil", "allmydata.util.dictutil", + "allmydata.util.encodingutil", "allmydata.util.gcutil", "allmydata.util.hashutil", "allmydata.util.humanreadable", diff --git a/src/allmydata/util/encodingutil.py b/src/allmydata/util/encodingutil.py index 7cca3f0b2..3e8ac7e2d 100644 --- a/src/allmydata/util/encodingutil.py +++ b/src/allmydata/util/encodingutil.py @@ -1,9 +1,21 @@ """ Functions used to convert inputs from whatever encoding used in the system to unicode and back. + +Ported to Python 3. + +Once Python 2 support is dropped, most of this module will obsolete, since +Unicode is the default everywhere in Python 3. """ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals from future.utils import PY2, PY3, native_str +if PY2: + # We omit str() because that seems too tricky to get right. + from builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, max, min # noqa: F401 from past.builtins import unicode