diff --git a/src/allmydata/_monkeypatch.py b/src/allmydata/_monkeypatch.py index b5f171224..cbd3ddd13 100644 --- a/src/allmydata/_monkeypatch.py +++ b/src/allmydata/_monkeypatch.py @@ -6,7 +6,6 @@ Ported to Python 3. from future.utils import PY2 -from warnings import catch_warnings def patch(): diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py index 168a7b8e4..96fccb958 100644 --- a/src/allmydata/interfaces.py +++ b/src/allmydata/interfaces.py @@ -6,7 +6,7 @@ Ported to Python 3. Note that for RemoteInterfaces, the __remote_name__ needs to be a native string because of https://github.com/warner/foolscap/blob/43f4485a42c9c28e2c79d655b3a9e24d4e6360ca/src/foolscap/remoteinterface.py#L67 """ -from future.utils import PY2, native_str +from future.utils import native_str from past.builtins import long from typing import Dict diff --git a/src/allmydata/introducer/interfaces.py b/src/allmydata/introducer/interfaces.py index 4667c7be0..13cd7c3da 100644 --- a/src/allmydata/introducer/interfaces.py +++ b/src/allmydata/introducer/interfaces.py @@ -3,7 +3,7 @@ Ported to Python 3. """ -from future.utils import PY2, native_str +from future.utils import native_str from zope.interface import Interface from foolscap.api import StringConstraint, SetOf, DictOf, Any, \ diff --git a/src/allmydata/scripts/runner.py b/src/allmydata/scripts/runner.py index 32c68ee57..73e2e4b59 100644 --- a/src/allmydata/scripts/runner.py +++ b/src/allmydata/scripts/runner.py @@ -1,6 +1,5 @@ import os, sys from io import StringIO -from past.builtins import unicode import six from twisted.python import usage @@ -106,7 +105,7 @@ def parse_options(argv, config=None): config = Options() try: config.parseOptions(argv) - except usage.error as e: + except usage.error: raise return config diff --git a/src/allmydata/scripts/slow_operation.py b/src/allmydata/scripts/slow_operation.py index e1a944ba7..236c2bf0b 100644 --- a/src/allmydata/scripts/slow_operation.py +++ b/src/allmydata/scripts/slow_operation.py @@ -2,7 +2,7 @@ Ported to Python 3. """ -from future.utils import PY2, PY3 +from future.utils import PY3 from six import ensure_str diff --git a/src/allmydata/scripts/tahoe_get.py b/src/allmydata/scripts/tahoe_get.py index 332529d04..f22d3d293 100644 --- a/src/allmydata/scripts/tahoe_get.py +++ b/src/allmydata/scripts/tahoe_get.py @@ -2,7 +2,7 @@ Ported to Python 3. """ -from future.utils import PY2, PY3 +from future.utils import PY3 from urllib.parse import quote as url_quote from allmydata.scripts.common import get_alias, DEFAULT_ALIAS, escape_path, \ diff --git a/src/allmydata/scripts/tahoe_manifest.py b/src/allmydata/scripts/tahoe_manifest.py index 1cc5ba591..0cd6100bf 100644 --- a/src/allmydata/scripts/tahoe_manifest.py +++ b/src/allmydata/scripts/tahoe_manifest.py @@ -2,7 +2,7 @@ Ported to Python 3. """ -from future.utils import PY2, PY3 +from future.utils import PY3 from six import ensure_str diff --git a/src/allmydata/storage/common.py b/src/allmydata/storage/common.py index a7b45ca0f..c0d77a6b7 100644 --- a/src/allmydata/storage/common.py +++ b/src/allmydata/storage/common.py @@ -2,7 +2,7 @@ Ported to Python 3. """ -from future.utils import PY2, PY3 +from future.utils import PY3 import os.path from allmydata.util import base32 diff --git a/src/allmydata/storage/immutable.py b/src/allmydata/storage/immutable.py index 90d6d4d2d..7a61a1e62 100644 --- a/src/allmydata/storage/immutable.py +++ b/src/allmydata/storage/immutable.py @@ -3,7 +3,7 @@ Ported to Python 3. """ -from future.utils import PY2, bytes_to_native_str +from future.utils import bytes_to_native_str import os, stat, struct, time diff --git a/src/allmydata/test/cli/test_backup.py b/src/allmydata/test/cli/test_backup.py index 744d40f78..c951e7ee3 100644 --- a/src/allmydata/test/cli/test_backup.py +++ b/src/allmydata/test/cli/test_backup.py @@ -14,7 +14,7 @@ from twisted.python.monkey import MonkeyPatcher from allmydata.util import fileutil from allmydata.util.fileutil import abspath_expanduser_unicode -from allmydata.util.encodingutil import get_io_encoding, unicode_to_argv +from allmydata.util.encodingutil import unicode_to_argv from allmydata.util.namespace import Namespace from allmydata.scripts import cli, backupdb from ..common_util import StallMixin diff --git a/src/allmydata/test/cli/test_cp.py b/src/allmydata/test/cli/test_cp.py index 2dbc6d37e..2751dc055 100644 --- a/src/allmydata/test/cli/test_cp.py +++ b/src/allmydata/test/cli/test_cp.py @@ -9,8 +9,7 @@ from twisted.internet import defer from allmydata.scripts import cli from allmydata.util import fileutil -from allmydata.util.encodingutil import (quote_output, get_io_encoding, - unicode_to_output, to_bytes) +from allmydata.util.encodingutil import (quote_output, unicode_to_output, to_bytes) from allmydata.util.assertutil import _assert from ..no_network import GridTestMixin from .common import CLITestMixin diff --git a/src/allmydata/test/cli/test_list.py b/src/allmydata/test/cli/test_list.py index 24af04ba9..55e1d7cc1 100644 --- a/src/allmydata/test/cli/test_list.py +++ b/src/allmydata/test/cli/test_list.py @@ -2,7 +2,7 @@ Ported to Python 3. """ -from future.utils import PY2, PY3 +from future.utils import PY3 from six import ensure_str from twisted.trial import unittest diff --git a/src/allmydata/test/mutable/util.py b/src/allmydata/test/mutable/util.py index 11696a83d..5a2a6a8f8 100644 --- a/src/allmydata/test/mutable/util.py +++ b/src/allmydata/test/mutable/util.py @@ -2,7 +2,7 @@ Ported to Python 3. """ -from future.utils import PY2, bchr +from future.utils import bchr from past.builtins import long diff --git a/src/allmydata/test/test_crawler.py b/src/allmydata/test/test_crawler.py index 7a28c1d35..71b0f3dee 100644 --- a/src/allmydata/test/test_crawler.py +++ b/src/allmydata/test/test_crawler.py @@ -5,7 +5,7 @@ Ported to Python 3. """ -from future.utils import PY2, PY3 +from future.utils import PY3 import time import os.path diff --git a/src/allmydata/test/test_log.py b/src/allmydata/test/test_log.py index ea03ba730..c3671f9b9 100644 --- a/src/allmydata/test/test_log.py +++ b/src/allmydata/test/test_log.py @@ -5,7 +5,7 @@ Ported to Python 3. """ -from future.utils import PY2, native_str +from future.utils import native_str from twisted.trial import unittest from twisted.python.failure import Failure diff --git a/src/allmydata/test/test_runner.py b/src/allmydata/test/test_runner.py index e7cb4b082..f62afd0b0 100644 --- a/src/allmydata/test/test_runner.py +++ b/src/allmydata/test/test_runner.py @@ -46,9 +46,6 @@ from allmydata.util.pid import ( ) from allmydata.test import common_util import allmydata -from allmydata.scripts.runner import ( - parse_options, -) from allmydata.scripts.tahoe_run import ( on_stdin_close, ) diff --git a/src/allmydata/util/encodingutil.py b/src/allmydata/util/encodingutil.py index 0625bfdec..cf8d83a42 100644 --- a/src/allmydata/util/encodingutil.py +++ b/src/allmydata/util/encodingutil.py @@ -8,7 +8,7 @@ Once Python 2 support is dropped, most of this module will obsolete, since Unicode is the default everywhere in Python 3. """ -from future.utils import PY2, PY3, native_str +from future.utils import PY3, native_str from future.builtins import str as future_str from past.builtins import unicode diff --git a/src/allmydata/util/jsonbytes.py b/src/allmydata/util/jsonbytes.py index 0762702f9..7415b4f02 100644 --- a/src/allmydata/util/jsonbytes.py +++ b/src/allmydata/util/jsonbytes.py @@ -5,7 +5,6 @@ Ported to Python 3. """ import json -import codecs def bytes_to_unicode(any_bytes, obj):