← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:remove-six-moves into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:remove-six-moves into launchpad:master.

Commit message:
Remove remaining uses of six.moves

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/420613
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-six-moves into launchpad:master.
diff --git a/lib/lp/app/browser/stringformatter.py b/lib/lp/app/browser/stringformatter.py
index 500ae96..4ca97e1 100644
--- a/lib/lp/app/browser/stringformatter.py
+++ b/lib/lp/app/browser/stringformatter.py
@@ -16,6 +16,7 @@ __all__ = [
     ]
 
 from base64 import urlsafe_b64encode
+from itertools import zip_longest
 import re
 import sys
 
@@ -23,7 +24,6 @@ from breezy.patches import hunk_from_header
 from lxml import html
 import markdown
 import six
-from six.moves import zip_longest as izip_longest
 from zope.component import getUtility
 from zope.error.interfaces import IErrorReportingUtility
 from zope.interface import implementer
@@ -963,7 +963,7 @@ class FormattersAPI:
         result.append('</tr>')
 
     def _ssdiff_emit_queued_lines(self, result, queue_removed, queue_added):
-        for removed, added in izip_longest(queue_removed, queue_added):
+        for removed, added in zip_longest(queue_removed, queue_added):
             if removed:
                 removed_diff_row, removed_row, removed_line = removed
             else:
diff --git a/lib/lp/app/browser/vocabulary.py b/lib/lp/app/browser/vocabulary.py
index 5c1bdab..bf4cdd6 100644
--- a/lib/lp/app/browser/vocabulary.py
+++ b/lib/lp/app/browser/vocabulary.py
@@ -12,7 +12,6 @@ __all__ = [
 
 from lazr.restful.interfaces import IWebServiceClientRequest
 import simplejson
-from six.moves import zip as izip
 from zope.component import (
     adapter,
     getUtility,
@@ -158,7 +157,7 @@ class PersonPickerEntrySourceAdapter(DefaultPickerEntrySourceAdapter):
             # If a person is affiliated with the associated_object then we
             # can display a badge.
             badges = affiliated_context.getAffiliationBadges(term_values)
-            for picker_entry, badges in izip(picker_entries, badges):
+            for picker_entry, badges in zip(picker_entries, badges):
                 picker_entry.badges = []
                 for badge_info in badges:
                     picker_entry.badges.append(
@@ -166,7 +165,7 @@ class PersonPickerEntrySourceAdapter(DefaultPickerEntrySourceAdapter):
                              label=badge_info.label,
                              role=badge_info.role))
 
-        for person, picker_entry in izip(term_values, picker_entries):
+        for person, picker_entry in zip(term_values, picker_entries):
             picker_entry.details = []
 
             if person.preferredemail is not None:
@@ -213,7 +212,7 @@ class BranchPickerEntrySourceAdapter(DefaultPickerEntrySourceAdapter):
         """See `IPickerEntrySource`"""
         entries = (
             super().getPickerEntries(term_values, context_object, **kwarg))
-        for branch, picker_entry in izip(term_values, entries):
+        for branch, picker_entry in zip(term_values, entries):
             picker_entry.description = branch.bzr_identity
         return entries
 
@@ -239,7 +238,7 @@ class TargetPickerEntrySourceAdapter(DefaultPickerEntrySourceAdapter):
         """See `IPickerEntrySource`"""
         entries = (
             super().getPickerEntries(term_values, context_object, **kwarg))
-        for target, picker_entry in izip(term_values, entries):
+        for target, picker_entry in zip(term_values, entries):
             picker_entry.description = self.getDescription(target)
             picker_entry.details = []
             summary = picker_entry.description
@@ -281,7 +280,7 @@ class SourcePackageNamePickerEntrySourceAdapter(
         """See `IPickerEntrySource`"""
         entries = (
             super().getPickerEntries(term_values, context_object, **kwarg))
-        for sourcepackagename, picker_entry in izip(term_values, entries):
+        for sourcepackagename, picker_entry in zip(term_values, entries):
             descriptions = getSourcePackageDescriptions([sourcepackagename])
             picker_entry.description = descriptions.get(
                 sourcepackagename.name, "Not yet built")
@@ -390,7 +389,7 @@ class ArchivePickerEntrySourceAdapter(DefaultPickerEntrySourceAdapter):
         """See `IPickerEntrySource`"""
         entries = (
             super().getPickerEntries(term_values, context_object, **kwarg))
-        for archive, picker_entry in izip(term_values, entries):
+        for archive, picker_entry in zip(term_values, entries):
             picker_entry.description = archive.reference
         return entries
 
@@ -463,7 +462,7 @@ class HugeVocabularyJSONView:
             picker_entries = adapter_cache[adapter_class].getPickerEntries(
                 term_values,
                 self.context)
-            for term_value, picker_entry in izip(term_values, picker_entries):
+            for term_value, picker_entry in zip(term_values, picker_entries):
                 picker_term_entries[term_value] = picker_entry
 
         result = []
diff --git a/lib/lp/app/security.py b/lib/lp/app/security.py
index 2500a80..97c5580 100644
--- a/lib/lp/app/security.py
+++ b/lib/lp/app/security.py
@@ -11,7 +11,6 @@ __all__ = [
 
 from itertools import repeat
 
-from six.moves import zip as izip
 from zope.component import queryAdapter
 from zope.interface import implementer
 from zope.security.permission import checkPermission
@@ -115,7 +114,7 @@ class AnonymousAuthorization(AuthorizationBase):
         return True
 
 
-class non_boolean_izip(izip):
+class non_boolean_zip(zip):
 
     def __bool__(self):
         # XXX wgrant 2016-11-15: Guard against security adapters
@@ -148,8 +147,8 @@ class DelegatedAuthorization(AuthorizationBase):
 
     def checkAuthenticated(self, user):
         """See `IAuthorization`."""
-        return non_boolean_izip(self.iter_objects(), repeat(self.permission))
+        return non_boolean_zip(self.iter_objects(), repeat(self.permission))
 
     def checkUnauthenticated(self):
         """See `IAuthorization`."""
-        return non_boolean_izip(self.iter_objects(), repeat(self.permission))
+        return non_boolean_zip(self.iter_objects(), repeat(self.permission))
diff --git a/lib/lp/archivepublisher/domination.py b/lib/lp/archivepublisher/domination.py
index 22c8a59..5cc9422 100644
--- a/lib/lp/archivepublisher/domination.py
+++ b/lib/lp/archivepublisher/domination.py
@@ -53,16 +53,13 @@ __all__ = ['Dominator']
 from collections import defaultdict
 from datetime import timedelta
 from functools import cmp_to_key
+from itertools import filterfalse
 from operator import (
     attrgetter,
     itemgetter,
     )
 
 import apt_pkg
-from six.moves import (
-    filter as ifilter,
-    filterfalse as ifilterfalse,
-    )
 from storm.expr import (
     And,
     Count,
@@ -331,8 +328,8 @@ def find_live_binary_versions_pass_2(sorted_pubs, cache):
     sorted_pubs = list(sorted_pubs)
     latest = sorted_pubs.pop(0)
     is_arch_specific = attrgetter('architecture_specific')
-    arch_specific_pubs = list(ifilter(is_arch_specific, sorted_pubs))
-    arch_indep_pubs = list(ifilterfalse(is_arch_specific, sorted_pubs))
+    arch_specific_pubs = list(filter(is_arch_specific, sorted_pubs))
+    arch_indep_pubs = list(filterfalse(is_arch_specific, sorted_pubs))
 
     bpbs = load_related(
         BinaryPackageBuild,
diff --git a/lib/lp/archivepublisher/scripts/publishdistro.py b/lib/lp/archivepublisher/scripts/publishdistro.py
index 7f8ed62..0f4501b 100644
--- a/lib/lp/archivepublisher/scripts/publishdistro.py
+++ b/lib/lp/archivepublisher/scripts/publishdistro.py
@@ -9,7 +9,6 @@ __all__ = [
 
 from optparse import OptionValueError
 
-from six.moves import filter as ifilter
 from storm.store import Store
 from zope.component import getUtility
 
@@ -272,9 +271,9 @@ class PublishDistro(PublisherScript):
         if self.options.partner:
             return [distribution.getArchiveByComponent('partner')]
         elif self.options.ppa:
-            return ifilter(is_ppa_public, self.getPPAs(distribution))
+            return filter(is_ppa_public, self.getPPAs(distribution))
         elif self.options.private_ppa:
-            return ifilter(is_ppa_private, self.getPPAs(distribution))
+            return filter(is_ppa_private, self.getPPAs(distribution))
         elif self.options.copy_archive:
             return self.getCopyArchives(distribution)
         else:
diff --git a/lib/lp/bugs/model/bug.py b/lib/lp/bugs/model/bug.py
index 9ffc7e2..1d1891d 100644
--- a/lib/lp/bugs/model/bug.py
+++ b/lib/lp/bugs/model/bug.py
@@ -18,6 +18,10 @@ __all__ = [
     ]
 
 
+from collections.abc import (
+    Iterable,
+    Set,
+    )
 from email.utils import make_msgid
 from functools import wraps
 import http.client
@@ -30,10 +34,6 @@ from lazr.lifecycle.event import ObjectCreatedEvent
 from lazr.lifecycle.snapshot import Snapshot
 from lazr.restful.declarations import error_status
 import pytz
-from six.moves.collections_abc import (
-    Iterable,
-    Set,
-    )
 from storm.expr import (
     And,
     Coalesce,
diff --git a/lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py b/lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py
index 50f6020..ea7791b 100644
--- a/lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py
+++ b/lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py
@@ -3,9 +3,9 @@
 
 """Test `BugSubscriptionInfo`."""
 
+from collections.abc import Set
 from contextlib import contextmanager
 
-from six.moves.collections_abc import Set
 from storm.store import Store
 from testtools.matchers import Equals
 from zope.component import queryAdapter
diff --git a/lib/lp/bugs/scripts/bugimport.py b/lib/lp/bugs/scripts/bugimport.py
index c403883..0c4464b 100644
--- a/lib/lp/bugs/scripts/bugimport.py
+++ b/lib/lp/bugs/scripts/bugimport.py
@@ -17,12 +17,12 @@ import datetime
 import io
 import logging
 import os
+import pickle
 import time
 
 from defusedxml import cElementTree
 import pytz
 import six
-from six.moves import cPickle as pickle
 from storm.store import Store
 from zope.component import getUtility
 from zope.contenttype import guess_content_type
diff --git a/lib/lp/code/interfaces/branchlookup.py b/lib/lp/code/interfaces/branchlookup.py
index 3e91b69..d6ac2dd 100644
--- a/lib/lp/code/interfaces/branchlookup.py
+++ b/lib/lp/code/interfaces/branchlookup.py
@@ -10,10 +10,6 @@ __all__ = [
     'ILinkedBranchTraverser',
     ]
 
-from six.moves import (
-    filter as ifilter,
-    map as imap,
-    )
 from zope.interface import Interface
 
 from lp.code.interfaces.codehosting import (
@@ -202,8 +198,8 @@ def get_first_path_result(path, perform_lookup, failure_result):
     :return: The first successful lookup, or failure_result if there are
         no successes.
     """
-    sparse_results = imap(perform_lookup, path_lookups(path))
-    results = ifilter(lambda x: x != failure_result, sparse_results)
+    sparse_results = map(perform_lookup, path_lookups(path))
+    results = filter(lambda x: x != failure_result, sparse_results)
     for result in results:
         return result
     return failure_result
diff --git a/lib/lp/code/model/tests/test_diff.py b/lib/lp/code/model/tests/test_diff.py
index 794ffbe..3d74dcc 100644
--- a/lib/lp/code/model/tests/test_diff.py
+++ b/lib/lp/code/model/tests/test_diff.py
@@ -4,6 +4,7 @@
 """Tests for Diff, etc."""
 
 from difflib import unified_diff
+import importlib
 from io import BytesIO
 import logging
 from textwrap import dedent
@@ -15,7 +16,6 @@ from breezy.patches import (
     RemoveLine,
     )
 import six
-from six.moves import reload_module
 from testtools.matchers import (
     Equals,
     Is,
@@ -572,7 +572,7 @@ class TestPreviewDiff(DiffTestCase):
 
     def test_fromBranchMergeProposal_does_not_warn_on_conflicts(self):
         """PreviewDiff generation emits no conflict warnings."""
-        reload_module(trace)
+        importlib.reload(trace)
         bmp, source_rev_id, target_rev_id = self.createExampleBzrMerge()
         handler = RecordLister()
         logger = logging.getLogger('brz')
diff --git a/lib/lp/registry/scripts/teamparticipation.py b/lib/lp/registry/scripts/teamparticipation.py
index cb15dff..d912639 100644
--- a/lib/lp/registry/scripts/teamparticipation.py
+++ b/lib/lp/registry/scripts/teamparticipation.py
@@ -20,10 +20,6 @@ from itertools import (
     count,
     )
 
-from six.moves import (
-    map as imap,
-    zip as izip,
-    )
 import transaction
 
 from lp.registry.interfaces.teammembership import ACTIVE_STATES
@@ -70,7 +66,7 @@ def report_progress(log, interval, results, what):
     :param results: An iterable of things.
     :param what: A string descriping what the results are.
     """
-    for num, result in izip(count(1), results):
+    for num, result in zip(count(1), results):
         if num % interval == 0:
             log.debug("%d %s", num, what)
         yield result
@@ -141,7 +137,7 @@ def check_teamparticipation_consistency(log, info):
         member_people.add(team)  # Teams always participate in themselves.
         member_teams = team_memberships[team].intersection(teams_set)
         return member_people.union(
-            chain.from_iterable(imap(get_participants, member_teams)))
+            chain.from_iterable(map(get_participants, member_teams)))
 
     def check_participants(person, expected, observed):
         spurious = observed - expected
@@ -179,7 +175,7 @@ def check_teamparticipation_consistency(log, info):
         return "%s (%d)" % (name, id)
 
     for error in errors:
-        people_repr = ", ".join(imap(get_repr, error.people))
+        people_repr = ", ".join(map(get_repr, error.people))
         log.warning(
             "%s: %s TeamParticipation entries for %s.",
             get_repr(error.team), error.type, people_repr)
diff --git a/lib/lp/scripts/utilities/importpedant.py b/lib/lp/scripts/utilities/importpedant.py
index 03c5ebd..6498fa4 100644
--- a/lib/lp/scripts/utilities/importpedant.py
+++ b/lib/lp/scripts/utilities/importpedant.py
@@ -2,13 +2,12 @@
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 import atexit
+import builtins
 import itertools
 from operator import attrgetter
 import types
 import warnings
 
-from six.moves import builtins
-
 
 # Silence bogus warnings from Hardy's python-pkg-resources package.
 warnings.filterwarnings('ignore', category=UserWarning, append=True,
@@ -22,10 +21,10 @@ naughty_imports = set()
 # __all__. The following dict maps from such modules to a list of attributes
 # that are allowed to be imported, whether or not they are in __all__.
 valid_imports_not_in_all = {
+    'http.cookiejar': {'domain_match'},
     'importlib': {'resources'},
     'openid.fetchers': {'Urllib2Fetcher'},
     'openid.message': {'NamespaceAliasRegistrationError'},
-    'six.moves.http_cookiejar': {'domain_match'},
     'storm.database': {'STATE_DISCONNECTED'},
     'talisker': {'run_gunicorn'},
     'textwrap': {'dedent'},
diff --git a/lib/lp/services/config/doc/canonical-config.txt b/lib/lp/services/config/doc/canonical-config.txt
index c3f0ec2..db0733f 100644
--- a/lib/lp/services/config/doc/canonical-config.txt
+++ b/lib/lp/services/config/doc/canonical-config.txt
@@ -200,8 +200,8 @@ argument to the constructor.
 #    >>> os.environ[DEFAULT_SECTION] = 'default'
 
 #    # reload the LaunchpadConfig class object.
-#    >>> from six.moves import reload_module
-#    >>> config_module = reload_module(lp.services.config)
+#    >>> import importlib
+#    >>> config_module = importlib.reload(lp.services.config)
 #    >>> from lp.services.config import config
 #    >>> config.filename
 #    '.../configs/mailman-itests/launchpad-lazr.conf'
diff --git a/lib/lp/services/features/scopes.py b/lib/lp/services/features/scopes.py
index 7845b92..688284c 100644
--- a/lib/lp/services/features/scopes.py
+++ b/lib/lp/services/features/scopes.py
@@ -21,10 +21,9 @@ __all__ = [
     'undocumented_scopes',
     ]
 
+from itertools import zip_longest
 import re
 
-from six.moves import zip_longest as izip_longest
-
 from lp.registry.interfaces.person import IPerson
 import lp.services.config
 from lp.services.propertycache import cachedproperty
@@ -86,7 +85,7 @@ class PageScope(BaseScope):
         pageid_scope = scope_name[len('pageid:'):]
         scope_segments = self._pageid_to_namespace(pageid_scope)
         request_segments = self._request_pageid_namespace
-        for scope_segment, request_segment in izip_longest(
+        for scope_segment, request_segment in zip_longest(
                 scope_segments, request_segments):
             if scope_segment is None:
                 break
diff --git a/lib/lp/services/sitesearch/bingtestservice.py b/lib/lp/services/sitesearch/bingtestservice.py
index 9aae005..2bf6585 100755
--- a/lib/lp/services/sitesearch/bingtestservice.py
+++ b/lib/lp/services/sitesearch/bingtestservice.py
@@ -8,11 +8,10 @@ This script runs a simple HTTP server. The server returns JSON files
 when given certain user-configurable URLs.
 """
 
+from http.server import HTTPServer
 import logging
 import os
 
-from six.moves.BaseHTTPServer import HTTPServer
-
 from lp.services.config import config
 from lp.services.osutils import ensure_directory_exists
 from lp.services.pidfile import make_pidfile
diff --git a/lib/lp/services/sitesearch/testservice.py b/lib/lp/services/sitesearch/testservice.py
index cd70236..3383d2d 100644
--- a/lib/lp/services/sitesearch/testservice.py
+++ b/lib/lp/services/sitesearch/testservice.py
@@ -10,6 +10,7 @@ when given certain user-configurable URLs.
 
 
 import errno
+from http.server import BaseHTTPRequestHandler
 import os
 import signal
 import socket
@@ -17,7 +18,6 @@ import subprocess
 import time
 
 import six
-from six.moves.BaseHTTPServer import BaseHTTPRequestHandler
 
 from lp.services.osutils import remove_if_exists
 from lp.services.pidfile import (
diff --git a/lib/lp/services/testing/parallel.py b/lib/lp/services/testing/parallel.py
index e84b2ea..2269c7a 100644
--- a/lib/lp/services/testing/parallel.py
+++ b/lib/lp/services/testing/parallel.py
@@ -11,7 +11,6 @@ import sys
 import tempfile
 
 from breezy.osutils import local_concurrency
-from six.moves import zip as izip
 from subunit import ProtocolTestCase
 from subunit.run import SubunitTestRunner
 from testtools import (
@@ -139,7 +138,7 @@ def partition_tests(test_ids, count):
     # just one partition.  So the slowest partition shouldn't be much slower
     # than the fastest.
     partitions = [list() for i in range(count)]
-    for partition, test_id in izip(itertools.cycle(partitions), test_ids):
+    for partition, test_id in zip(itertools.cycle(partitions), test_ids):
         partition.append(test_id)
     return partitions
 
diff --git a/lib/lp/services/testing/profiled.py b/lib/lp/services/testing/profiled.py
index 54fbfbc..f09cfb5 100644
--- a/lib/lp/services/testing/profiled.py
+++ b/lib/lp/services/testing/profiled.py
@@ -7,11 +7,10 @@ __all__ = ['profiled', 'setup_profiling']
 
 import atexit
 import os
+import pickle
 import tempfile
 import time
 
-from six.moves import cPickle as pickle
-
 
 _profile_stats_filename = os.environ.get('lp_layer_profile_filename', None)
 _profiling_setup_time = None
diff --git a/lib/lp/services/utils.py b/lib/lp/services/utils.py
index c2017d1..f157397 100644
--- a/lib/lp/services/utils.py
+++ b/lib/lp/services/utils.py
@@ -37,6 +37,7 @@ from itertools import (
     tee,
     )
 import os
+import pickle
 import re
 import sys
 from textwrap import dedent
@@ -45,7 +46,6 @@ from types import FunctionType
 from lazr.enum import BaseItem
 import pytz
 import six
-from six.moves import cPickle as pickle
 from twisted.python.util import mergeFunctionMetadata
 from zope.security.proxy import isinstance as zope_isinstance
 
diff --git a/lib/lp/services/webapp/batching.py b/lib/lp/services/webapp/batching.py
index b4c3b2b..cc7fa52 100644
--- a/lib/lp/services/webapp/batching.py
+++ b/lib/lp/services/webapp/batching.py
@@ -1,6 +1,7 @@
 # Copyright 2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from collections.abc import Sequence
 from datetime import datetime
 from functools import reduce
 import re
@@ -12,7 +13,6 @@ from iso8601 import (
 import lazr.batchnavigator
 from lazr.batchnavigator.interfaces import IRangeFactory
 import simplejson
-from six.moves.collections_abc import Sequence
 from storm import Undef
 from storm.expr import (
     And,
diff --git a/lib/lp/services/webapp/pgsession.py b/lib/lp/services/webapp/pgsession.py
index c3141b1..b23ffbd 100644
--- a/lib/lp/services/webapp/pgsession.py
+++ b/lib/lp/services/webapp/pgsession.py
@@ -7,11 +7,11 @@ from collections.abc import MutableMapping
 from datetime import datetime
 import hashlib
 import io
+import pickle
 import time
 
 from lazr.restful.utils import get_current_browser_request
 import six
-from six.moves import cPickle as pickle
 from storm.zope.interfaces import IZStorm
 from zope.authentication.interfaces import IUnauthenticatedPrincipal
 from zope.component import getUtility
diff --git a/lib/lp/services/webapp/session.py b/lib/lp/services/webapp/session.py
index 4dce616..0e7eb3b 100644
--- a/lib/lp/services/webapp/session.py
+++ b/lib/lp/services/webapp/session.py
@@ -3,8 +3,9 @@
 
 """Support for browser-cookie sessions."""
 
+from http.cookiejar import domain_match
+
 from lazr.uri import URI
-from six.moves.http_cookiejar import domain_match
 from zope.session.http import CookieClientIdManager
 
 from lp.services.config import config
diff --git a/lib/lp/testing/factory.py b/lib/lp/testing/factory.py
index c78d4f2..6ae169e 100644
--- a/lib/lp/testing/factory.py
+++ b/lib/lp/testing/factory.py
@@ -15,6 +15,10 @@ __all__ = [
     ]
 
 import base64
+from collections.abc import (
+    Mapping,
+    Sequence,
+    )
 from datetime import (
     datetime,
     timedelta,
@@ -43,10 +47,6 @@ from lazr.jobrunner.jobrunner import SuspendJobException
 import pytz
 from pytz import UTC
 import six
-from six.moves.collections_abc import (
-    Mapping,
-    Sequence,
-    )
 from twisted.conch.ssh.common import (
     MP,
     NS,
diff --git a/lib/lp/testing/utilities/retest.py b/lib/lp/testing/utilities/retest.py
index 097df78..3774373 100755
--- a/lib/lp/testing/utilities/retest.py
+++ b/lib/lp/testing/utilities/retest.py
@@ -30,8 +30,6 @@ import re
 import sys
 import tempfile
 
-from six.moves import map as imap
-
 from lp.services.config import config
 
 
@@ -111,7 +109,7 @@ def run_tests(tests):
 
 
 def main():
-    lines = imap(decolorize, fileinput.input())
+    lines = map(decolorize, fileinput.input())
     tests = extract_tests(lines)
     if len(tests) >= 1:
         run_tests(tests)
diff --git a/lib/lp/testing/yuixhr.py b/lib/lp/testing/yuixhr.py
index e438e15..f35a655 100644
--- a/lib/lp/testing/yuixhr.py
+++ b/lib/lp/testing/yuixhr.py
@@ -11,6 +11,7 @@ __all__ = [
 ]
 
 from fnmatch import fnmatchcase
+import importlib
 import os
 import sys
 from textwrap import dedent
@@ -20,7 +21,6 @@ import unittest
 from lazr.restful import ResourceJSONEncoder
 from lazr.restful.utils import get_current_browser_request
 import simplejson
-from six.moves import reload_module
 from zope.component import getUtility
 from zope.exceptions.exceptionformatter import format_exception
 from zope.interface import implementer
@@ -382,7 +382,7 @@ class YUITestFixtureControllerView(LaunchpadView):
             module = sys.modules.get(self.module_name)
             if module is not None:
                 del module._fixtures_
-                reload_module(module)
+                importlib.reload(module)
         return self.page_template % dict(
             test_module='/+yuitest/%s.js' % self.traversed_path,
             test_namespace=self.traversed_path.replace('/', '.'),
diff --git a/utilities/paste b/utilities/paste
index fa461f0..5d857fb 100755
--- a/utilities/paste
+++ b/utilities/paste
@@ -5,6 +5,7 @@
 
 import _pythonpath  # noqa: F401
 
+from http.cookiejar import Cookie
 from optparse import OptionParser
 import os
 import pwd
@@ -13,7 +14,6 @@ from urllib.parse import urljoin
 import webbrowser
 
 from fixtures import MonkeyPatch
-from six.moves.http_cookiejar import Cookie
 from zope.testbrowser.browser import Browser