[arvados] created: 2.7.0-6508-g873fcf181c

git repository hosting git at public.arvados.org
Mon Apr 29 17:21:30 UTC 2024


        at  873fcf181c037cc1e42419bfeaf5bb70c9d9e239 (commit)


commit 873fcf181c037cc1e42419bfeaf5bb70c9d9e239
Author: Brett Smith <brett.smith at curii.com>
Date:   Mon Apr 29 12:11:05 2024 -0400

    21356: Remove all Python 2/3 compatibility imports
    
    This includes noop imports from __future__ and builtins, as well as
    imports from the future and six compatibility libraries.
    
    Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith at curii.com>

diff --git a/sdk/cwl/arvados_cwl/__init__.py b/sdk/cwl/arvados_cwl/__init__.py
index 7e13488758..30d91b4094 100644
--- a/sdk/cwl/arvados_cwl/__init__.py
+++ b/sdk/cwl/arvados_cwl/__init__.py
@@ -6,9 +6,6 @@
 # Implement cwl-runner interface for submitting and running work on Arvados, using
 # the Crunch containers API.
 
-from future.utils import viewitems
-from builtins import str
-
 import argparse
 import importlib.metadata
 import importlib.resources
@@ -333,7 +330,7 @@ def main(args=sys.argv[1:],
 
     add_arv_hints()
 
-    for key, val in viewitems(cwltool.argparser.get_default_args()):
+    for key, val in cwltool.argparser.get_default_args().items():
         if not hasattr(arvargs, key):
             setattr(arvargs, key, val)
 
diff --git a/sdk/cwl/arvados_cwl/arvcontainer.py b/sdk/cwl/arvados_cwl/arvcontainer.py
index c3b914ba99..34b79d67b4 100644
--- a/sdk/cwl/arvados_cwl/arvcontainer.py
+++ b/sdk/cwl/arvados_cwl/arvcontainer.py
@@ -2,10 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from future import standard_library
-standard_library.install_aliases()
-from builtins import str
-
 import logging
 import json
 import os
diff --git a/sdk/cwl/arvados_cwl/arvworkflow.py b/sdk/cwl/arvados_cwl/arvworkflow.py
index c592b83dc7..dae68459bc 100644
--- a/sdk/cwl/arvados_cwl/arvworkflow.py
+++ b/sdk/cwl/arvados_cwl/arvworkflow.py
@@ -2,18 +2,15 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from past.builtins import basestring
-from future.utils import viewitems
-
 import os
 import json
 import copy
 import logging
 import urllib
-from io import StringIO
 import sys
 import re
 
+from io import StringIO
 from typing import (MutableSequence, MutableMapping)
 
 from ruamel.yaml import YAML
@@ -588,7 +585,7 @@ class ArvadosWorkflowStep(WorkflowStep):
         runtimeContext = runtimeContext.copy()
         runtimeContext.toplevel = True  # Preserve behavior for #13365
 
-        builder = make_builder({shortname(k): v for k,v in viewitems(joborder)}, self.hints, self.requirements,
+        builder = make_builder({shortname(k): v for k, v in joborder.items()}, self.hints, self.requirements,
                                runtimeContext, self.metadata)
         runtimeContext = set_cluster_target(self.tool, self.arvrunner, builder, runtimeContext)
         return super(ArvadosWorkflowStep, self).job(joborder, output_callback, runtimeContext)
@@ -655,7 +652,7 @@ class ArvadosWorkflow(Workflow):
                                 dyn = False
                                 for k in max_res_pars + sum_res_pars:
                                     if k in req:
-                                        if isinstance(req[k], basestring):
+                                        if isinstance(req[k], str):
                                             if item["id"] == "#main":
                                                 # only the top-level requirements/hints may contain expressions
                                                 self.dynamic_resource_req.append(req)
diff --git a/sdk/cwl/arvados_cwl/done.py b/sdk/cwl/arvados_cwl/done.py
index 5c12419765..98c9f3a5df 100644
--- a/sdk/cwl/arvados_cwl/done.py
+++ b/sdk/cwl/arvados_cwl/done.py
@@ -2,11 +2,10 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from future.utils import viewvalues
-
 import re
-from cwltool.errors import WorkflowException
+
 from collections import deque
+from cwltool.errors import WorkflowException
 
 def done(self, record, tmpdir, outdir, keepdir):
     cols = [
diff --git a/sdk/cwl/arvados_cwl/executor.py b/sdk/cwl/arvados_cwl/executor.py
index 432b380aab..240e014e5a 100644
--- a/sdk/cwl/arvados_cwl/executor.py
+++ b/sdk/cwl/arvados_cwl/executor.py
@@ -2,12 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import division
-from builtins import next
-from builtins import object
-from builtins import str
-from future.utils import viewvalues, viewitems
-
 import argparse
 import logging
 import os
@@ -421,7 +415,7 @@ The 'jobs' API is no longer supported.
             if obj.get("class") == "InplaceUpdateRequirement":
                 if obj["inplaceUpdate"] and parentfield == "requirements":
                     raise SourceLine(obj, "class", UnsupportedRequirement).makeError("InplaceUpdateRequirement not supported for keep collections.")
-            for k,v in viewitems(obj):
+            for k,v in obj.items():
                 self.check_features(v, parentfield=k)
         elif isinstance(obj, list):
             for i,v in enumerate(obj):
diff --git a/sdk/cwl/arvados_cwl/fsaccess.py b/sdk/cwl/arvados_cwl/fsaccess.py
index a5e9db0cfe..a88380b468 100644
--- a/sdk/cwl/arvados_cwl/fsaccess.py
+++ b/sdk/cwl/arvados_cwl/fsaccess.py
@@ -2,12 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from future import standard_library
-standard_library.install_aliases()
-from builtins import object
-from builtins import str
-from future.utils import viewvalues
-
 import fnmatch
 import os
 import errno
@@ -314,7 +308,7 @@ def collectionResolver(api_client, document_loader, uri, num_retries=4):
 
     if pipeline_template_uuid_pattern.match(uri):
         pt = api_client.pipeline_templates().get(uuid=uri).execute(num_retries=num_retries)
-        return u"keep:" + viewvalues(pt["components"])[0]["script_parameters"]["cwl:tool"]
+        return u"keep:" + next(pt["components"].values())["script_parameters"]["cwl:tool"]
 
     p = uri.split("/")
     if arvados.util.keep_locator_pattern.match(p[0]):
diff --git a/sdk/cwl/arvados_cwl/pathmapper.py b/sdk/cwl/arvados_cwl/pathmapper.py
index 448facf776..ac6df543ad 100644
--- a/sdk/cwl/arvados_cwl/pathmapper.py
+++ b/sdk/cwl/arvados_cwl/pathmapper.py
@@ -2,12 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from future import standard_library
-standard_library.install_aliases()
-from builtins import str
-from past.builtins import basestring
-from future.utils import viewitems
-
 import re
 import logging
 import uuid
@@ -72,7 +66,7 @@ class ArvPathMapper(PathMapper):
 
         debug = logger.isEnabledFor(logging.DEBUG)
 
-        if isinstance(src, basestring) and src.startswith("keep:"):
+        if isinstance(src, str) and src.startswith("keep:"):
             if collection_pdh_pattern.match(src):
                 self._pathmap[src] = MapperEnt(src, self.collection_pattern % urllib.parse.unquote(src[5:]), srcobj["class"], True)
 
@@ -346,7 +340,7 @@ class StagingPathMapper(PathMapper):
         # Overridden to maintain the use case of mapping by source (identifier) to
         # target regardless of how the map is structured interally.
         def getMapperEnt(src):
-            for k,v in viewitems(self._pathmap):
+            for k,v in self._pathmap.items():
                 if (v.type != "CreateFile" and v.resolved == src) or (v.type == "CreateFile" and k == src):
                     return v
 
@@ -365,7 +359,7 @@ class VwdPathMapper(StagingPathMapper):
         # with any secondary files.
         self.visitlisting(referenced_files, self.stagedir, basedir)
 
-        for path, (ab, tgt, type, staged) in viewitems(self._pathmap):
+        for path, (ab, tgt, type, staged) in self._pathmap.items():
             if type in ("File", "Directory") and ab.startswith("keep:"):
                 self._pathmap[path] = MapperEnt("$(task.keep)/%s" % ab[5:], tgt, type, staged)
 
diff --git a/sdk/cwl/arvados_cwl/perf.py b/sdk/cwl/arvados_cwl/perf.py
index cc3ea969df..39f475fe8d 100644
--- a/sdk/cwl/arvados_cwl/perf.py
+++ b/sdk/cwl/arvados_cwl/perf.py
@@ -2,8 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from builtins import object
-
 import time
 import uuid
 
diff --git a/sdk/cwl/arvados_cwl/runner.py b/sdk/cwl/arvados_cwl/runner.py
index 437aa39eb8..259294a36e 100644
--- a/sdk/cwl/arvados_cwl/runner.py
+++ b/sdk/cwl/arvados_cwl/runner.py
@@ -2,11 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from future import standard_library
-standard_library.install_aliases()
-from future.utils import  viewvalues, viewitems
-from past.builtins import basestring
-
 import os
 import sys
 import re
@@ -72,6 +67,7 @@ from . import done
 from . context import ArvRuntimeContext
 from .perf import Perf
 
+basestring = (bytes, str)
 logger = logging.getLogger('arvados.cwl-runner')
 metrics = logging.getLogger('arvados.cwl-runner.metrics')
 
@@ -103,7 +99,7 @@ def find_defaults(d, op):
         if "default" in d:
             op(d)
         else:
-            for i in viewvalues(d):
+            for i in d.values():
                 find_defaults(i, op)
 
 def make_builder(joborder, hints, requirements, runtimeContext, metadata):
@@ -567,7 +563,7 @@ def packed_workflow(arvrunner, tool, merged_map, runtimeContext, git_info):
                   rewrite_out=rewrites,
                   loader=tool.doc_loader)
 
-    rewrite_to_orig = {v: k for k,v in viewitems(rewrites)}
+    rewrite_to_orig = {v: k for k,v in rewrites.items()}
 
     def visit(v, cur_id):
         if isinstance(v, dict):
diff --git a/sdk/cwl/setup.py b/sdk/cwl/setup.py
index 829dbf0544..5d8486f64f 100644
--- a/sdk/cwl/setup.py
+++ b/sdk/cwl/setup.py
@@ -3,7 +3,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
 import os
 import sys
 
diff --git a/sdk/cwl/tests/federation/framework/check_exist.py b/sdk/cwl/tests/federation/framework/check_exist.py
index 1458772a3f..b3338939ed 100644
--- a/sdk/cwl/tests/federation/framework/check_exist.py
+++ b/sdk/cwl/tests/federation/framework/check_exist.py
@@ -2,7 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import print_function
 import arvados
 import json
 
diff --git a/sdk/cwl/tests/federation/framework/prepare.py b/sdk/cwl/tests/federation/framework/prepare.py
index 40bb843b29..6fe90813e7 100644
--- a/sdk/cwl/tests/federation/framework/prepare.py
+++ b/sdk/cwl/tests/federation/framework/prepare.py
@@ -2,7 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import print_function
 import arvados
 import json
 
diff --git a/sdk/cwl/tests/hw.py b/sdk/cwl/tests/hw.py
index e45bd72642..43c20dc03d 100644
--- a/sdk/cwl/tests/hw.py
+++ b/sdk/cwl/tests/hw.py
@@ -2,5 +2,4 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import print_function
 print("Hello world")
diff --git a/sdk/cwl/tests/matcher.py b/sdk/cwl/tests/matcher.py
index 04e67b7dbd..3c49b87a86 100644
--- a/sdk/cwl/tests/matcher.py
+++ b/sdk/cwl/tests/matcher.py
@@ -2,13 +2,10 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from builtins import object
-
 import difflib
 import json
 import re
 
-
 class JsonDiffMatcher(object):
     """Raise AssertionError with a readable JSON diff when not __eq__().
 
diff --git a/sdk/cwl/tests/test_container.py b/sdk/cwl/tests/test_container.py
index af8c0b014d..885ee165b0 100644
--- a/sdk/cwl/tests/test_container.py
+++ b/sdk/cwl/tests/test_container.py
@@ -2,9 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from builtins import str
-from builtins import object
-
 import arvados_cwl
 import arvados_cwl.context
 import arvados_cwl.util
diff --git a/sdk/cwl/tests/test_make_output.py b/sdk/cwl/tests/test_make_output.py
index 0a4fbdc60f..eb39d801fe 100644
--- a/sdk/cwl/tests/test_make_output.py
+++ b/sdk/cwl/tests/test_make_output.py
@@ -2,9 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from future import standard_library
-standard_library.install_aliases()
-
 import functools
 import json
 import logging
diff --git a/sdk/cwl/tests/test_submit.py b/sdk/cwl/tests/test_submit.py
index a137325a44..5f5fffb465 100644
--- a/sdk/cwl/tests/test_submit.py
+++ b/sdk/cwl/tests/test_submit.py
@@ -2,9 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from future import standard_library
-standard_library.install_aliases()
-
 import copy
 import io
 import itertools
diff --git a/sdk/cwl/tests/test_util.py b/sdk/cwl/tests/test_util.py
index e7159f4102..9e94ec42f9 100644
--- a/sdk/cwl/tests/test_util.py
+++ b/sdk/cwl/tests/test_util.py
@@ -2,11 +2,9 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from builtins import bytes
-
-import unittest
 import datetime
 import httplib2
+import unittest
 
 from unittest import mock
 
diff --git a/sdk/cwl/tests/wf/check_mem.py b/sdk/cwl/tests/wf/check_mem.py
index b4322a8093..8cc4d6fb91 100644
--- a/sdk/cwl/tests/wf/check_mem.py
+++ b/sdk/cwl/tests/wf/check_mem.py
@@ -2,9 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import print_function
-from __future__ import division
-
 import arvados
 import sys
 import os
diff --git a/sdk/python/arvados/_normalize_stream.py b/sdk/python/arvados/_normalize_stream.py
index c72b82be1c..81dd027f20 100644
--- a/sdk/python/arvados/_normalize_stream.py
+++ b/sdk/python/arvados/_normalize_stream.py
@@ -2,11 +2,10 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-from . import config
-
 import re
 
+from . import config
+
 def escape(path):
     return re.sub(r'[\\:\000-\040]', lambda m: "\\%03o" % ord(m.group(0)), path)
 
diff --git a/sdk/python/arvados/_ranges.py b/sdk/python/arvados/_ranges.py
index bb245ab2bf..75678457c9 100644
--- a/sdk/python/arvados/_ranges.py
+++ b/sdk/python/arvados/_ranges.py
@@ -2,8 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import division
-from builtins import object
 import logging
 
 _logger = logging.getLogger('arvados.ranges')
diff --git a/sdk/python/arvados/arvfile.py b/sdk/python/arvados/arvfile.py
index e0e972b5c1..de20254351 100644
--- a/sdk/python/arvados/arvfile.py
+++ b/sdk/python/arvados/arvfile.py
@@ -2,13 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-from __future__ import division
-from future import standard_library
-from future.utils import listitems, listvalues
-standard_library.install_aliases()
-from builtins import range
-from builtins import object
 import bz2
 import collections
 import copy
@@ -620,7 +613,7 @@ class _BlockManager(object):
         # A WRITABLE block with its owner.closed() implies that its
         # size is <= KEEP_BLOCK_SIZE/2.
         try:
-            small_blocks = [b for b in listvalues(self._bufferblocks)
+            small_blocks = [b for b in self._bufferblocks.values()
                             if b.state() == _BufferBlock.WRITABLE and b.owner.closed()]
         except AttributeError:
             # Writable blocks without owner shouldn't exist.
@@ -763,7 +756,7 @@ class _BlockManager(object):
         self.repack_small_blocks(force=True, sync=True)
 
         with self.lock:
-            items = listitems(self._bufferblocks)
+            items = list(self._bufferblocks.items())
 
         for k,v in items:
             if v.state() != _BufferBlock.COMMITTED and v.owner:
diff --git a/sdk/python/arvados/cache.py b/sdk/python/arvados/cache.py
index 85f2b89ea2..115547cf93 100644
--- a/sdk/python/arvados/cache.py
+++ b/sdk/python/arvados/cache.py
@@ -2,7 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from builtins import object
 import errno
 import hashlib
 import os
diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index 9e6bd06071..1050d4c093 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -12,11 +12,6 @@ cookbook for [an introduction to using the Collection class][cookbook].
 [cookbook]: https://doc.arvados.org/sdk/python/cookbook.html#working-with-collections
 """
 
-from __future__ import absolute_import
-from future.utils import listitems, listvalues, viewkeys
-from builtins import str
-from past.builtins import basestring
-from builtins import object
 import ciso8601
 import datetime
 import errno
@@ -419,7 +414,7 @@ class RichCollectionBase(CollectionBase):
         if value == self._committed:
             return
         if value:
-            for k,v in listitems(self._items):
+            for k,v in self._items.items():
                 v.set_committed(True)
             self._committed = True
         else:
@@ -434,7 +429,7 @@ class RichCollectionBase(CollectionBase):
         This method does not recurse. It only iterates the contents of this
         collection's corresponding stream.
         """
-        return iter(viewkeys(self._items))
+        return iter(self._items)
 
     @synchronized
     def __getitem__(self, k: str) -> CollectionItem:
@@ -492,7 +487,7 @@ class RichCollectionBase(CollectionBase):
         `arvados.arvfile.ArvadosFile` for every file, directly within this
         collection's stream.  This method does not recurse.
         """
-        return listvalues(self._items)
+        return list(self._items.values())
 
     @synchronized
     def items(self) -> List[Tuple[str, CollectionItem]]:
@@ -502,7 +497,7 @@ class RichCollectionBase(CollectionBase):
         `arvados.arvfile.ArvadosFile` for every file, directly within this
         collection's stream.  This method does not recurse.
         """
-        return listitems(self._items)
+        return list(self._items.items())
 
     def exists(self, path: str) -> bool:
         """Indicate whether this collection includes an item at `path`
@@ -548,7 +543,7 @@ class RichCollectionBase(CollectionBase):
             item.remove(pathcomponents[1], recursive=recursive)
 
     def _clonefrom(self, source):
-        for k,v in listitems(source):
+        for k,v in source.items():
             self._items[k] = v.clone(self, k)
 
     def clone(self):
@@ -612,7 +607,7 @@ class RichCollectionBase(CollectionBase):
             source_collection = self
 
         # Find the object
-        if isinstance(source, basestring):
+        if isinstance(source, str):
             source_obj = source_collection.find(source)
             if source_obj is None:
                 raise IOError(errno.ENOENT, "File not found", source)
@@ -1024,7 +1019,7 @@ class RichCollectionBase(CollectionBase):
     @synchronized
     def flush(self) -> None:
         """Upload any pending data to Keep"""
-        for e in listvalues(self):
+        for e in self.values():
             e.flush()
 
 
@@ -2258,7 +2253,7 @@ class ResumableCollectionWriter(CollectionWriter):
         return writer
 
     def check_dependencies(self):
-        for path, orig_stat in listitems(self._dependencies):
+        for path, orig_stat in self._dependencies.items():
             if not S_ISREG(orig_stat[ST_MODE]):
                 raise errors.StaleWriterStateError(u"{} not file".format(path))
             try:
diff --git a/sdk/python/arvados/commands/arv_copy.py b/sdk/python/arvados/commands/arv_copy.py
index 51251737cf..bf66037a1b 100755
--- a/sdk/python/arvados/commands/arv_copy.py
+++ b/sdk/python/arvados/commands/arv_copy.py
@@ -18,12 +18,6 @@
 # instances src and dst.  If either of these files is not found,
 # arv-copy will issue an error.
 
-from __future__ import division
-from future import standard_library
-from future.utils import listvalues
-standard_library.install_aliases()
-from past.builtins import basestring
-from builtins import object
 import argparse
 import contextlib
 import getpass
@@ -167,7 +161,7 @@ def main():
         exit(1)
 
     # Clean up any outstanding temp git repositories.
-    for d in listvalues(local_repo_dir):
+    for d in local_repo_dir.values():
         shutil.rmtree(d, ignore_errors=True)
 
     if not result:
@@ -257,10 +251,10 @@ def filter_iter(arg):
     Pass in a filter field that can either be a string or list.
     This will iterate elements as if the field had been written as a list.
     """
-    if isinstance(arg, basestring):
-        return iter((arg,))
+    if isinstance(arg, str):
+        yield arg
     else:
-        return iter(arg)
+        yield from arg
 
 def migrate_repository_filter(repo_filter, src_repository, dst_repository):
     """Update a single repository filter in-place for the destination.
@@ -408,7 +402,7 @@ def copy_collections(obj, src, dst, args):
                 collections_copied[src_id] = dst_col['uuid']
         return collections_copied[src_id]
 
-    if isinstance(obj, basestring):
+    if isinstance(obj, str):
         # Copy any collections identified in this string to dst, replacing
         # them with the dst uuids as necessary.
         obj = arvados.util.portable_data_hash_pattern.sub(copy_collection_fn, obj)
diff --git a/sdk/python/arvados/commands/ls.py b/sdk/python/arvados/commands/ls.py
index ac038f5040..d67f5cc453 100644
--- a/sdk/python/arvados/commands/ls.py
+++ b/sdk/python/arvados/commands/ls.py
@@ -2,9 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import print_function
-from __future__ import division
-
 import argparse
 import collections
 import logging
diff --git a/sdk/python/arvados/commands/migrate19.py b/sdk/python/arvados/commands/migrate19.py
index 2fef419ee8..24d6bc5045 100644
--- a/sdk/python/arvados/commands/migrate19.py
+++ b/sdk/python/arvados/commands/migrate19.py
@@ -2,8 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import print_function
-from __future__ import division
 import argparse
 import time
 import sys
diff --git a/sdk/python/arvados/commands/put.py b/sdk/python/arvados/commands/put.py
index 0e732eafde..d1961c8c8a 100644
--- a/sdk/python/arvados/commands/put.py
+++ b/sdk/python/arvados/commands/put.py
@@ -2,10 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import division
-from future.utils import listitems, listvalues
-from builtins import str
-from builtins import object
 import argparse
 import arvados
 import arvados.collection
@@ -696,7 +692,7 @@ class ArvPutUploadJob(object):
         Recursively get the total size of the collection
         """
         size = 0
-        for item in listvalues(collection):
+        for item in collection.values():
             if isinstance(item, arvados.collection.Collection) or isinstance(item, arvados.collection.Subcollection):
                 size += self._collection_size(item)
             else:
@@ -978,7 +974,7 @@ class ArvPutUploadJob(object):
     def collection_file_paths(self, col, path_prefix='.'):
         """Return a list of file paths by recursively go through the entire collection `col`"""
         file_paths = []
-        for name, item in listitems(col):
+        for name, item in col.items():
             if isinstance(item, arvados.arvfile.ArvadosFile):
                 file_paths.append(os.path.join(path_prefix, name))
             elif isinstance(item, arvados.collection.Subcollection):
@@ -1058,7 +1054,7 @@ class ArvPutUploadJob(object):
                     locators.append(loc)
                 return locators
         elif isinstance(item, arvados.collection.Collection):
-            l = [self._datablocks_on_item(x) for x in listvalues(item)]
+            l = [self._datablocks_on_item(x) for x in item.values()]
             # Fast list flattener method taken from:
             # http://stackoverflow.com/questions/952914/making-a-flat-list-out-of-list-of-lists-in-python
             return [loc for sublist in l for loc in sublist]
diff --git a/sdk/python/arvados/commands/run.py b/sdk/python/arvados/commands/run.py
index 0fe05da22b..474111d882 100644
--- a/sdk/python/arvados/commands/run.py
+++ b/sdk/python/arvados/commands/run.py
@@ -15,11 +15,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from __future__ import print_function
-from __future__ import absolute_import
-from builtins import range
-from past.builtins import basestring
-from builtins import object
 import arvados
 import arvados.commands.ws as ws
 import argparse
diff --git a/sdk/python/arvados/commands/ws.py b/sdk/python/arvados/commands/ws.py
index 04a90cf20b..3508682399 100644
--- a/sdk/python/arvados/commands/ws.py
+++ b/sdk/python/arvados/commands/ws.py
@@ -2,16 +2,16 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import print_function
-import sys
-import logging
 import argparse
-import arvados
 import json
+import logging
+import signal
+import sys
+
+import arvados
 from arvados.events import subscribe
 from arvados._version import __version__
 from . import _util as arv_cmd
-import signal
 
 def main(arguments=None):
     logger = logging.getLogger('arvados.arv-ws')
diff --git a/sdk/python/arvados/crunch.py b/sdk/python/arvados/crunch.py
index 6dd144c43b..57cf2e01ef 100644
--- a/sdk/python/arvados/crunch.py
+++ b/sdk/python/arvados/crunch.py
@@ -2,9 +2,9 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from builtins import object
 import json
 import os
+
 from . import util
 
 class TaskOutputDir(object):
diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index d1be6b931e..5501b84271 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -2,16 +2,7 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-from __future__ import division
 import copy
-from future import standard_library
-from future.utils import native_str
-standard_library.install_aliases()
-from builtins import next
-from builtins import str
-from builtins import range
-from builtins import object
 import collections
 import datetime
 import hashlib
@@ -28,15 +19,11 @@ import ssl
 import sys
 import threading
 import resource
-from . import timer
 import urllib.parse
 import traceback
 import weakref
 
-if sys.version_info >= (3, 0):
-    from io import BytesIO
-else:
-    from cStringIO import StringIO as BytesIO
+from io import BytesIO
 
 import arvados
 import arvados.config as config
@@ -45,11 +32,11 @@ import arvados.retry as retry
 import arvados.util
 import arvados.diskcache
 from arvados._pycurlhelper import PyCurlHelper
+from . import timer
 
 _logger = logging.getLogger('arvados.keep')
 global_client_object = None
 
-
 # Monkey patch TCP constants when not available (apple). Values sourced from:
 # http://www.opensource.apple.com/source/xnu/xnu-2422.115.4/bsd/netinet/tcp.h
 if sys.platform == 'darwin':
@@ -60,7 +47,6 @@ if sys.platform == 'darwin':
     if not hasattr(socket, 'TCP_KEEPCNT'):
         socket.TCP_KEEPCNT = 0x102
 
-
 class KeepLocator(object):
     EPOCH_DATETIME = datetime.datetime.utcfromtimestamp(0)
     HINT_RE = re.compile(r'^[A-Z][A-Za-z0-9 at _-]+$')
@@ -85,7 +71,7 @@ class KeepLocator(object):
 
     def __str__(self):
         return '+'.join(
-            native_str(s)
+            str(s)
             for s in [self.md5sum, self.size,
                       self.permission_hint()] + self.hints
             if s is not None)
diff --git a/sdk/python/arvados/stream.py b/sdk/python/arvados/stream.py
index 37cd5d7db8..ff541e5716 100644
--- a/sdk/python/arvados/stream.py
+++ b/sdk/python/arvados/stream.py
@@ -2,10 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import print_function
-from __future__ import absolute_import
-from future.utils import listvalues
-from builtins import object
 import collections
 import hashlib
 import os
@@ -70,7 +66,7 @@ class StreamReader(object):
         return self._files
 
     def all_files(self):
-        return listvalues(self._files)
+        return list(self._files.values())
 
     def size(self):
         n = self._data_locators[-1]
@@ -105,5 +101,5 @@ class StreamReader(object):
             manifest_text.extend([d.locator for d in self._data_locators])
         manifest_text.extend([' '.join(["{}:{}:{}".format(seg.locator, seg.range_size, f.name.replace(' ', '\\040'))
                                         for seg in f.segments])
-                              for f in listvalues(self._files)])
+                              for f in self._files.values()])
         return ' '.join(manifest_text) + '\n'
diff --git a/sdk/python/arvados/timer.py b/sdk/python/arvados/timer.py
index 97bc38add0..39dbc7874e 100644
--- a/sdk/python/arvados/timer.py
+++ b/sdk/python/arvados/timer.py
@@ -2,8 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import print_function
-from builtins import object
 import time
 
 class Timer(object):
diff --git a/sdk/python/setup.py b/sdk/python/setup.py
index a2ec703556..257968d89e 100644
--- a/sdk/python/setup.py
+++ b/sdk/python/setup.py
@@ -3,7 +3,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
 import os
 import sys
 import re
@@ -111,7 +110,6 @@ setup(name='arvados-python-client',
       install_requires=[
           *arvados_version.iter_dependencies(version),
           'ciso8601 >=2.0.0',
-          'future',
           'google-api-python-client >=2.1.0',
           'google-auth',
           'httplib2 >=0.9.2',
diff --git a/sdk/python/tests/arvados_testutil.py b/sdk/python/tests/arvados_testutil.py
index 6d58b23360..1f1f796a9c 100644
--- a/sdk/python/tests/arvados_testutil.py
+++ b/sdk/python/tests/arvados_testutil.py
@@ -2,8 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from future import standard_library
-standard_library.install_aliases()
 import arvados
 import contextlib
 import errno
diff --git a/sdk/python/tests/keepstub.py b/sdk/python/tests/keepstub.py
index 6be8d8b646..a4deb5384b 100644
--- a/sdk/python/tests/keepstub.py
+++ b/sdk/python/tests/keepstub.py
@@ -2,10 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import division
-from future import standard_library
-standard_library.install_aliases()
-from builtins import str
 import http.server
 import hashlib
 import os
@@ -20,9 +16,7 @@ from . import arvados_testutil as tutil
 
 _debug = os.environ.get('ARVADOS_DEBUG', None)
 
-
 class StubKeepServers(tutil.ApiClientMock):
-
     def setUp(self):
         super(StubKeepServers, self).setUp()
         sock = socket.socket()
diff --git a/sdk/python/tests/manifest_examples.py b/sdk/python/tests/manifest_examples.py
index 050d69093c..c1945d03d9 100644
--- a/sdk/python/tests/manifest_examples.py
+++ b/sdk/python/tests/manifest_examples.py
@@ -2,10 +2,8 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-from builtins import range
-from builtins import object
 import arvados
+
 from . import arvados_testutil as tutil
 
 class ManifestExamples(object):
diff --git a/sdk/python/tests/performance/test_a_sample.py b/sdk/python/tests/performance/test_a_sample.py
index 65015dc872..9e54b1f5d2 100644
--- a/sdk/python/tests/performance/test_a_sample.py
+++ b/sdk/python/tests/performance/test_a_sample.py
@@ -2,9 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import print_function
-from __future__ import absolute_import
-from builtins import range
 import unittest
 
 from .performance_profiler import profiled
diff --git a/sdk/python/tests/test_api.py b/sdk/python/tests/test_api.py
index 2768d2e7cf..a4e943f6f2 100644
--- a/sdk/python/tests/test_api.py
+++ b/sdk/python/tests/test_api.py
@@ -2,9 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-from builtins import str
-from builtins import range
 import arvados
 import collections
 import contextlib
diff --git a/sdk/python/tests/test_arv_copy.py b/sdk/python/tests/test_arv_copy.py
index b853b33043..1af5c68e6c 100644
--- a/sdk/python/tests/test_arv_copy.py
+++ b/sdk/python/tests/test_arv_copy.py
@@ -2,7 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
 import os
 import sys
 import tempfile
diff --git a/sdk/python/tests/test_arv_get.py b/sdk/python/tests/test_arv_get.py
index b66039dfe3..aefcbd7b22 100644
--- a/sdk/python/tests/test_arv_get.py
+++ b/sdk/python/tests/test_arv_get.py
@@ -2,8 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-from future.utils import listitems
 import io
 import logging
 import os
@@ -52,7 +50,7 @@ class ArvadosGetTestCase(run_test_server.TestCaseWithServers,
                               }):
         api = arvados.api()
         c = collection.Collection(api_client=api)
-        for path, data in listitems(contents):
+        for path, data in contents.items():
             with c.open(path, 'wb') as f:
                 f.write(data)
         c.save_new()
diff --git a/sdk/python/tests/test_arv_ls.py b/sdk/python/tests/test_arv_ls.py
index d48b94ffac..59441a74c2 100644
--- a/sdk/python/tests/test_arv_ls.py
+++ b/sdk/python/tests/test_arv_ls.py
@@ -2,9 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-from builtins import str
-from builtins import range
 import os
 import random
 import sys
diff --git a/sdk/python/tests/test_arv_put.py b/sdk/python/tests/test_arv_put.py
index 772a4f6b3e..e3f7c9d446 100644
--- a/sdk/python/tests/test_arv_put.py
+++ b/sdk/python/tests/test_arv_put.py
@@ -4,13 +4,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-from __future__ import division
-from future import standard_library
-standard_library.install_aliases()
-from builtins import str
-from builtins import range
-from functools import partial
 import apiclient
 import ciso8601
 import datetime
@@ -31,6 +24,7 @@ import time
 import unittest
 import uuid
 
+from functools import partial
 from unittest import mock
 
 import arvados
diff --git a/sdk/python/tests/test_arv_ws.py b/sdk/python/tests/test_arv_ws.py
index 521c46ee34..4e67db2184 100644
--- a/sdk/python/tests/test_arv_ws.py
+++ b/sdk/python/tests/test_arv_ws.py
@@ -2,7 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
 import os
 import sys
 import tempfile
diff --git a/sdk/python/tests/test_arvfile.py b/sdk/python/tests/test_arvfile.py
index b98e1e97d4..6bcba9a81d 100644
--- a/sdk/python/tests/test_arvfile.py
+++ b/sdk/python/tests/test_arvfile.py
@@ -2,15 +2,10 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-from builtins import hex
-from builtins import str
-from builtins import range
-from builtins import object
 import datetime
 import os
-import unittest
 import time
+import unittest
 
 from unittest import mock
 
diff --git a/sdk/python/tests/test_benchmark_collections.py b/sdk/python/tests/test_benchmark_collections.py
index fc062e791c..0014e94af2 100644
--- a/sdk/python/tests/test_benchmark_collections.py
+++ b/sdk/python/tests/test_benchmark_collections.py
@@ -2,7 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
 import arvados
 import sys
 
diff --git a/sdk/python/tests/test_cache.py b/sdk/python/tests/test_cache.py
index d86c7337e1..41984a5bf9 100644
--- a/sdk/python/tests/test_cache.py
+++ b/sdk/python/tests/test_cache.py
@@ -2,11 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import print_function
-from __future__ import absolute_import
-
-from builtins import str
-from builtins import range
 import hashlib
 import os
 import random
diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index 65b89056bb..5d574856dd 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -2,9 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-
-from builtins import object
 import arvados
 import copy
 import os
diff --git a/sdk/python/tests/test_errors.py b/sdk/python/tests/test_errors.py
index 4ee68ba285..02f316bf79 100644
--- a/sdk/python/tests/test_errors.py
+++ b/sdk/python/tests/test_errors.py
@@ -2,7 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
 import traceback
 import unittest
 
diff --git a/sdk/python/tests/test_http.py b/sdk/python/tests/test_http.py
index de63719453..476e2c88e9 100644
--- a/sdk/python/tests/test_http.py
+++ b/sdk/python/tests/test_http.py
@@ -2,9 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from future import standard_library
-standard_library.install_aliases()
-
 import copy
 import io
 import functools
diff --git a/sdk/python/tests/test_keep_client.py b/sdk/python/tests/test_keep_client.py
index 5a065b2ee1..2dc4363f0c 100644
--- a/sdk/python/tests/test_keep_client.py
+++ b/sdk/python/tests/test_keep_client.py
@@ -2,13 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-from __future__ import division
-from future import standard_library
-standard_library.install_aliases()
-from builtins import str
-from builtins import range
-from builtins import object
 import hashlib
 import os
 import errno
diff --git a/sdk/python/tests/test_keep_locator.py b/sdk/python/tests/test_keep_locator.py
index e47d64d337..bc93f403a0 100644
--- a/sdk/python/tests/test_keep_locator.py
+++ b/sdk/python/tests/test_keep_locator.py
@@ -2,10 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from builtins import next
-from builtins import zip
-from builtins import str
-from builtins import range
 import datetime
 import itertools
 import random
diff --git a/sdk/python/tests/test_retry.py b/sdk/python/tests/test_retry.py
index 3f0064f96f..c6e713244c 100644
--- a/sdk/python/tests/test_retry.py
+++ b/sdk/python/tests/test_retry.py
@@ -2,9 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from builtins import zip
-from builtins import range
-from builtins import object
 import itertools
 import unittest
 
diff --git a/sdk/python/tests/test_retry_job_helpers.py b/sdk/python/tests/test_retry_job_helpers.py
index f4e80e61fe..979ab57246 100644
--- a/sdk/python/tests/test_retry_job_helpers.py
+++ b/sdk/python/tests/test_retry_job_helpers.py
@@ -2,19 +2,18 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-from builtins import object
-import os
-import unittest
 import hashlib
-from . import run_test_server
 import json
-import arvados
-from . import arvados_testutil as tutil
-from apiclient import http as apiclient_http
+import os
+import unittest
 
+from apiclient import http as apiclient_http
 from unittest import mock
 
+import arvados
+from . import run_test_server
+from . import arvados_testutil as tutil
+
 @tutil.skip_sleep
 class ApiClientRetryTestMixin(object):
 
diff --git a/sdk/python/tests/test_stream.py b/sdk/python/tests/test_stream.py
index 374800c55b..a3f5d9ff63 100644
--- a/sdk/python/tests/test_stream.py
+++ b/sdk/python/tests/test_stream.py
@@ -2,8 +2,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-from builtins import object
 import bz2
 import gzip
 import io
diff --git a/services/dockercleaner/bin/arvados-docker-cleaner b/services/dockercleaner/bin/arvados-docker-cleaner
index b9dcd79500..abc723fcf3 100755
--- a/services/dockercleaner/bin/arvados-docker-cleaner
+++ b/services/dockercleaner/bin/arvados-docker-cleaner
@@ -3,7 +3,5 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import, print_function
-
 from arvados_docker.cleaner import main
 main()
diff --git a/services/dockercleaner/setup.py b/services/dockercleaner/setup.py
index 9c69879b45..b20b776ebf 100644
--- a/services/dockercleaner/setup.py
+++ b/services/dockercleaner/setup.py
@@ -3,7 +3,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
 import os
 import sys
 import re
diff --git a/services/fuse/arvados_fuse/__init__.py b/services/fuse/arvados_fuse/__init__.py
index d827aefab7..c29c2430dc 100644
--- a/services/fuse/arvados_fuse/__init__.py
+++ b/services/fuse/arvados_fuse/__init__.py
@@ -54,11 +54,6 @@ inode assigned to it and appears in the Inodes._entries dictionary.
 
 """
 
-from __future__ import absolute_import
-from __future__ import division
-from builtins import next
-from builtins import str
-from builtins import object
 import os
 import llfuse
 import errno
diff --git a/services/fuse/arvados_fuse/command.py b/services/fuse/arvados_fuse/command.py
index f52121d862..8004e8303f 100644
--- a/services/fuse/arvados_fuse/command.py
+++ b/services/fuse/arvados_fuse/command.py
@@ -2,9 +2,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from future.utils import native_str
-from builtins import range
-from builtins import object
 import argparse
 import arvados
 import daemon
@@ -410,7 +407,7 @@ class Mount(object):
         if self.args.replace:
             unmount(path=self.args.mountpoint,
                     timeout=self.args.unmount_timeout)
-        llfuse.init(self.operations, native_str(self.args.mountpoint), self._fuse_options())
+        llfuse.init(self.operations, str(self.args.mountpoint), self._fuse_options())
         if self.daemon:
             daemon.DaemonContext(
                 working_directory=os.path.dirname(self.args.mountpoint),
diff --git a/services/fuse/arvados_fuse/crunchstat.py b/services/fuse/arvados_fuse/crunchstat.py
index 0cb585a6ff..313c34971f 100644
--- a/services/fuse/arvados_fuse/crunchstat.py
+++ b/services/fuse/arvados_fuse/crunchstat.py
@@ -2,10 +2,9 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from builtins import str
-from builtins import object
 import sys
 import time
+
 from collections import namedtuple
 
 Stat = namedtuple("Stat", ['name', 'get'])
diff --git a/services/fuse/arvados_fuse/fresh.py b/services/fuse/arvados_fuse/fresh.py
index 508ee7fb73..ff548f29ee 100644
--- a/services/fuse/arvados_fuse/fresh.py
+++ b/services/fuse/arvados_fuse/fresh.py
@@ -2,11 +2,10 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from builtins import object
-import time
 import ciso8601
 import calendar
 import functools
+import time
 
 def convertTime(t):
     """Parse Arvados timestamp to unix time."""
diff --git a/services/fuse/arvados_fuse/fusefile.py b/services/fuse/arvados_fuse/fusefile.py
index 9279f7d99d..fce6c9b614 100644
--- a/services/fuse/arvados_fuse/fusefile.py
+++ b/services/fuse/arvados_fuse/fusefile.py
@@ -2,8 +2,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
-from builtins import bytes
 import json
 import llfuse
 import logging
diff --git a/services/fuse/setup.py b/services/fuse/setup.py
index 5a77174c62..002afc22c9 100644
--- a/services/fuse/setup.py
+++ b/services/fuse/setup.py
@@ -3,7 +3,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
 import os
 import sys
 import re
@@ -34,7 +33,6 @@ setup(name='arvados_fuse',
       install_requires=[
         *arvados_version.iter_dependencies(version),
         'arvados-llfuse >= 1.5.1',
-        'future',
         'python-daemon',
         'ciso8601 >= 2.0.0',
         'setuptools',
diff --git a/services/fuse/tests/fstest.py b/services/fuse/tests/fstest.py
index 51e3f311ab..296f23919c 100644
--- a/services/fuse/tests/fstest.py
+++ b/services/fuse/tests/fstest.py
@@ -2,14 +2,11 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import print_function
-from __future__ import absolute_import
-from builtins import str
-from builtins import range
-from multiprocessing import Process
 import os
 import subprocess
 import sys
+
+from multiprocessing import Process
 from . import prof
 
 def fn(n):
diff --git a/services/fuse/tests/integration_test.py b/services/fuse/tests/integration_test.py
index e80b6983a1..ae1b58ad47 100644
--- a/services/fuse/tests/integration_test.py
+++ b/services/fuse/tests/integration_test.py
@@ -2,7 +2,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
 import arvados
 import arvados_fuse
 import arvados_fuse.command
@@ -12,12 +11,13 @@ import inspect
 import logging
 import multiprocessing
 import os
-from . import run_test_server
 import signal
 import sys
 import tempfile
 import unittest
 
+from . import run_test_server
+
 @atexit.register
 def _pool_cleanup():
     if _pool is None:
diff --git a/services/fuse/tests/mount_test_base.py b/services/fuse/tests/mount_test_base.py
index 02f4009724..6e49390524 100644
--- a/services/fuse/tests/mount_test_base.py
+++ b/services/fuse/tests/mount_test_base.py
@@ -2,7 +2,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
 import arvados
 import arvados.keep
 import arvados_fuse as fuse
@@ -11,7 +10,6 @@ import llfuse
 import logging
 import multiprocessing
 import os
-from . import run_test_server
 import shutil
 import signal
 import subprocess
@@ -21,10 +19,11 @@ import threading
 import time
 import unittest
 
-logger = logging.getLogger('arvados.arv-mount')
-
+from . import run_test_server
 from .integration_test import workerPool
 
+logger = logging.getLogger('arvados.arv-mount')
+
 def make_block_cache(disk_cache):
     if disk_cache:
         disk_cache_dir = os.path.join(os.path.expanduser("~"), ".cache", "arvados", "keep")
diff --git a/services/fuse/tests/performance/test_collection_performance.py b/services/fuse/tests/performance/test_collection_performance.py
index 98bc98abd4..525a779ca4 100644
--- a/services/fuse/tests/performance/test_collection_performance.py
+++ b/services/fuse/tests/performance/test_collection_performance.py
@@ -2,10 +2,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
-from future.utils import viewitems
-from builtins import str
-from builtins import range
 import arvados
 import arvados_fuse as fuse
 import llfuse
@@ -13,6 +9,7 @@ import logging
 import os
 import sys
 import unittest
+
 from .. import run_test_server
 from ..mount_test_base import MountTestBase
 from ..slow_test import slow_test
@@ -334,7 +331,7 @@ class UsingMagicDir_CreateCollectionWithManyFilesAndMoveAndDeleteFile(MountTestB
         for j in range(0, files_per_stream):
             files[os.path.join(self.mounttmp, collection, 'file'+str(j)+'.txt')] = data
 
-        for k, v in viewItems(files):
+        for k, v in files.items():
             with open(os.path.join(self.mounttmp, collection, k)) as f:
                 self.assertEqual(v, f.read())
 
diff --git a/services/fuse/tests/prof.py b/services/fuse/tests/prof.py
index f9ce1881de..5bdb1b2e7b 100644
--- a/services/fuse/tests/prof.py
+++ b/services/fuse/tests/prof.py
@@ -2,8 +2,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import print_function
-from builtins import object
 import time
 
 class CountTime(object):
diff --git a/services/fuse/tests/test_cache.py b/services/fuse/tests/test_cache.py
index 46ed0be411..3f6b804b92 100644
--- a/services/fuse/tests/test_cache.py
+++ b/services/fuse/tests/test_cache.py
@@ -2,7 +2,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from builtins import range
 import arvados
 import arvados.collection
 import arvados_fuse
diff --git a/services/fuse/tests/test_command_args.py b/services/fuse/tests/test_command_args.py
index 90153d22d1..a6a387789d 100644
--- a/services/fuse/tests/test_command_args.py
+++ b/services/fuse/tests/test_command_args.py
@@ -2,9 +2,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
-from __future__ import print_function
-from six import assertRegex
 import arvados
 import arvados_fuse
 import arvados_fuse.command
@@ -15,7 +12,6 @@ import json
 import llfuse
 import logging
 import os
-from . import run_test_server
 import sys
 import tempfile
 import unittest
@@ -23,6 +19,8 @@ import resource
 
 from unittest import mock
 
+from . import run_test_server
+
 def noexit(func):
     """If argparse or arvados_fuse tries to exit, fail the test instead"""
     class SystemExitCaught(Exception):
@@ -85,13 +83,13 @@ class MountArgsTest(unittest.TestCase):
 
         e = self.check_ent_type(arvados_fuse.StringFile, 'README')
         readme = e.readfrom(0, -1).decode()
-        assertRegex(self, readme, r'active-user at arvados\.local')
-        assertRegex(self, readme, r'\n$')
+        self.assertRegex(readme, r'active-user at arvados\.local')
+        self.assertRegex(readme, r'\n$')
 
         e = self.check_ent_type(arvados_fuse.StringFile, 'by_id', 'README')
         txt = e.readfrom(0, -1).decode()
-        assertRegex(self, txt, r'portable data hash')
-        assertRegex(self, txt, r'\n$')
+        self.assertRegex(txt, r'portable data hash')
+        self.assertRegex(txt, r'\n$')
 
     @noexit
     def test_by_id(self):
@@ -200,7 +198,7 @@ class MountArgsTest(unittest.TestCase):
 
         with self.assertRaises(SystemExit):
             args = arvados_fuse.command.ArgumentParser().parse_args(['--version'])
-        assertRegex(self, sys.stdout.getvalue(), "[0-9]+\.[0-9]+\.[0-9]+")
+        self.assertRegex(sys.stdout.getvalue(), "[0-9]+\.[0-9]+\.[0-9]+")
         sys.stderr.close()
         sys.stderr = origerr
         sys.stdout = origout
diff --git a/services/fuse/tests/test_crunchstat.py b/services/fuse/tests/test_crunchstat.py
index 3cf15fe113..32272a83c4 100644
--- a/services/fuse/tests/test_crunchstat.py
+++ b/services/fuse/tests/test_crunchstat.py
@@ -2,12 +2,10 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
 import subprocess
 
 from .integration_test import IntegrationTest
 
-
 class CrunchstatTest(IntegrationTest):
     def test_crunchstat(self):
         output = subprocess.check_output(
diff --git a/services/fuse/tests/test_exec.py b/services/fuse/tests/test_exec.py
index f977990026..c67cc55f34 100644
--- a/services/fuse/tests/test_exec.py
+++ b/services/fuse/tests/test_exec.py
@@ -2,17 +2,15 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
-from six import assertRegex
 import arvados_fuse.command
 import json
 import multiprocessing
 import os
-from . import run_test_server
 import shlex
 import tempfile
 import unittest
 
+from . import run_test_server
 from .integration_test import workerPool
 
 def try_exec(mnt, cmd):
@@ -58,7 +56,4 @@ class ExecMode(unittest.TestCase):
                 shlex.quote(os.path.join(self.okfile)),
             )]))
         with open(self.okfile) as f:
-            assertRegex(
-                self,
-                json.load(f)['manifest_text'],
-                r' 0:3:foo.txt\n')
+            self.assertRegex(json.load(f)['manifest_text'], r' 0:3:foo.txt\n')
diff --git a/services/fuse/tests/test_mount.py b/services/fuse/tests/test_mount.py
index 2d775c0608..f5f61baeb3 100644
--- a/services/fuse/tests/test_mount.py
+++ b/services/fuse/tests/test_mount.py
@@ -2,12 +2,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
-from future.utils import viewitems
-from builtins import str
-from builtins import object
-from pathlib import Path
-from six import assertRegex
 import errno
 import json
 import llfuse
@@ -17,22 +11,23 @@ import subprocess
 import time
 import unittest
 import tempfile
-import parameterized
 
+from pathlib import Path
 from unittest import mock
 
 import arvados
 import arvados_fuse as fuse
+import parameterized
+
 from arvados_fuse import fusedir
-from . import run_test_server
 
+from . import run_test_server
 from .integration_test import IntegrationTest
 from .mount_test_base import MountTestBase
 from .test_tmp_collection import storage_classes_desired
 
 logger = logging.getLogger('arvados.arv-mount')
 
-
 class AssertWithTimeout(object):
     """Allow some time for an assertion to pass."""
 
@@ -125,7 +120,7 @@ class FuseMountTest(MountTestBase):
                  'dir2/dir3/thing7.txt': 'data 7',
                  'dir2/dir3/thing8.txt': 'data 8'}
 
-        for k, v in viewitems(files):
+        for k, v in files.items():
             with open(os.path.join(self.mounttmp, k), 'rb') as f:
                 self.assertEqual(v, f.read().decode())
 
@@ -190,7 +185,7 @@ class FuseMagicTest(MountTestBase):
         files = {}
         files[os.path.join(self.mounttmp, self.testcollection, 'thing1.txt')] = 'data 1'
 
-        for k, v in viewitems(files):
+        for k, v in files.items():
             with open(os.path.join(self.mounttmp, k), 'rb') as f:
                 self.assertEqual(v, f.read().decode())
 
@@ -313,7 +308,7 @@ class FuseHomeTest(MountTestBase):
             'anonymously_accessible_project']
         found_in = 0
         found_not_in = 0
-        for name, item in viewitems(run_test_server.fixture('collections')):
+        for name, item in run_test_server.fixture('collections').items():
             if 'name' not in item:
                 pass
             elif item['owner_uuid'] == public_project['uuid']:
@@ -452,7 +447,7 @@ class FuseCreateFileTest(MountTestBase):
         self.assertEqual(["file1.txt"], d1)
 
         collection2 = self.api.collections().get(uuid=collection.manifest_locator()).execute()
-        assertRegex(self, collection2["manifest_text"],
+        self.assertRegex(collection2["manifest_text"],
             r'\. d41d8cd98f00b204e9800998ecf8427e\+0\+A\S+ 0:0:file1\.txt$')
 
 
@@ -495,7 +490,7 @@ class FuseWriteFileTest(MountTestBase):
         self.assertEqual(12, self.operations.read_counter.get())
 
         collection2 = self.api.collections().get(uuid=collection.manifest_locator()).execute()
-        assertRegex(self, collection2["manifest_text"],
+        self.assertRegex(collection2["manifest_text"],
             r'\. 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file1\.txt$')
 
 
@@ -534,7 +529,7 @@ class FuseUpdateFileTest(MountTestBase):
         self.pool.apply(fuseUpdateFileTestHelper, (self.mounttmp,))
 
         collection2 = self.api.collections().get(uuid=collection.manifest_locator()).execute()
-        assertRegex(self, collection2["manifest_text"],
+        self.assertRegex(collection2["manifest_text"],
             r'\. daaef200ebb921e011e3ae922dd3266b\+11\+A\S+ 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:11:file1\.txt 22:1:file1\.txt$')
 
 
@@ -574,7 +569,7 @@ class FuseMkdirTest(MountTestBase):
         self.pool.apply(fuseMkdirTestHelper, (self.mounttmp,))
 
         collection2 = self.api.collections().get(uuid=collection.manifest_locator()).execute()
-        assertRegex(self, collection2["manifest_text"],
+        self.assertRegex(collection2["manifest_text"],
             r'\./testdir 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file1\.txt$')
 
 
@@ -641,13 +636,13 @@ class FuseRmTest(MountTestBase):
 
         # Starting manifest
         collection2 = self.api.collections().get(uuid=collection.manifest_locator()).execute()
-        assertRegex(self, collection2["manifest_text"],
+        self.assertRegex(collection2["manifest_text"],
             r'\./testdir 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file1\.txt$')
         self.pool.apply(fuseRmTestHelperDeleteFile, (self.mounttmp,))
 
         # Empty directories are represented by an empty file named "."
         collection2 = self.api.collections().get(uuid=collection.manifest_locator()).execute()
-        assertRegex(self, collection2["manifest_text"],
+        self.assertRegex(collection2["manifest_text"],
                                  r'./testdir d41d8cd98f00b204e9800998ecf8427e\+0\+A\S+ 0:0:\\056\n')
 
         self.pool.apply(fuseRmTestHelperRmdir, (self.mounttmp,))
@@ -698,13 +693,13 @@ class FuseMvFileTest(MountTestBase):
 
         # Starting manifest
         collection2 = self.api.collections().get(uuid=collection.manifest_locator()).execute()
-        assertRegex(self, collection2["manifest_text"],
+        self.assertRegex(collection2["manifest_text"],
             r'\./testdir 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file1\.txt$')
 
         self.pool.apply(fuseMvFileTestHelperMoveFile, (self.mounttmp,))
 
         collection2 = self.api.collections().get(uuid=collection.manifest_locator()).execute()
-        assertRegex(self, collection2["manifest_text"],
+        self.assertRegex(collection2["manifest_text"],
             r'\. 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file1\.txt\n\./testdir d41d8cd98f00b204e9800998ecf8427e\+0\+A\S+ 0:0:\\056\n')
 
 
@@ -732,7 +727,7 @@ class FuseRenameTest(MountTestBase):
 
         # Starting manifest
         collection2 = self.api.collections().get(uuid=collection.manifest_locator()).execute()
-        assertRegex(self, collection2["manifest_text"],
+        self.assertRegex(collection2["manifest_text"],
             r'\./testdir 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file1\.txt$')
 
         d1 = llfuse.listdir(os.path.join(self.mounttmp))
@@ -748,7 +743,7 @@ class FuseRenameTest(MountTestBase):
         self.assertEqual(["file1.txt"], d1)
 
         collection2 = self.api.collections().get(uuid=collection.manifest_locator()).execute()
-        assertRegex(self, collection2["manifest_text"],
+        self.assertRegex(collection2["manifest_text"],
             r'\./testdir2 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file1\.txt$')
 
 
@@ -819,7 +814,7 @@ def fuseFileConflictTestHelper(mounttmp, uuid, keeptmp, settings):
             with open(os.path.join(mounttmp, "file1.txt"), "r") as f:
                 self.assertEqual(f.read(), "bar")
 
-            assertRegex(self, d1[1],
+            self.assertRegex(d1[1],
                 r'file1\.txt~\d\d\d\d\d\d\d\d-\d\d\d\d\d\d~conflict~')
 
             with open(os.path.join(mounttmp, d1[1]), "r") as f:
@@ -924,7 +919,7 @@ class FuseMvFileBetweenCollectionsTest(MountTestBase):
         collection1.update()
         collection2.update()
 
-        assertRegex(self, collection1.manifest_text(), r"\. 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file1\.txt$")
+        self.assertRegex(collection1.manifest_text(), r"\. 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file1\.txt$")
         self.assertEqual(collection2.manifest_text(), "")
 
         self.pool.apply(fuseMvFileBetweenCollectionsTest2, (self.mounttmp,
@@ -935,7 +930,7 @@ class FuseMvFileBetweenCollectionsTest(MountTestBase):
         collection2.update()
 
         self.assertEqual(collection1.manifest_text(), "")
-        assertRegex(self, collection2.manifest_text(), r"\. 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file2\.txt$")
+        self.assertRegex(collection2.manifest_text(), r"\. 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file2\.txt$")
 
         collection1.stop_threads()
         collection2.stop_threads()
@@ -995,7 +990,7 @@ class FuseMvDirBetweenCollectionsTest(MountTestBase):
         collection1.update()
         collection2.update()
 
-        assertRegex(self, collection1.manifest_text(), r"\./testdir 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file1\.txt$")
+        self.assertRegex(collection1.manifest_text(), r"\./testdir 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file1\.txt$")
         self.assertEqual(collection2.manifest_text(), "")
 
         self.pool.apply(fuseMvDirBetweenCollectionsTest2, (self.mounttmp,
@@ -1006,7 +1001,7 @@ class FuseMvDirBetweenCollectionsTest(MountTestBase):
         collection2.update()
 
         self.assertEqual(collection1.manifest_text(), "")
-        assertRegex(self, collection2.manifest_text(), r"\./testdir2 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file1\.txt$")
+        self.assertRegex(collection2.manifest_text(), r"\./testdir2 86fb269d190d2c85f6e0468ceca42a20\+12\+A\S+ 0:12:file1\.txt$")
 
         collection1.stop_threads()
         collection2.stop_threads()
@@ -1201,7 +1196,7 @@ class FuseMagicTestPDHOnly(MountTestBase):
         files = {}
         files[os.path.join(self.mounttmp, self.testcollection, 'thing1.txt')] = 'data 1'
 
-        for k, v in viewitems(files):
+        for k, v in files.items():
             with open(os.path.join(self.mounttmp, k), 'rb') as f:
                 self.assertEqual(v, f.read().decode())
 
diff --git a/services/fuse/tests/test_retry.py b/services/fuse/tests/test_retry.py
index 92081de0a0..5bc8a0bd45 100644
--- a/services/fuse/tests/test_retry.py
+++ b/services/fuse/tests/test_retry.py
@@ -2,21 +2,18 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
-from future import standard_library
-standard_library.install_aliases()
 import arvados
 import arvados_fuse.command
 import json
 import os
 import pycurl
 import queue
-from . import run_test_server
 import tempfile
 import unittest
 
 from unittest import mock
 
+from . import run_test_server
 from .integration_test import IntegrationTest
 
 class KeepClientRetry(unittest.TestCase):
diff --git a/services/fuse/tests/test_tmp_collection.py b/services/fuse/tests/test_tmp_collection.py
index c59024267a..7ab6d52243 100644
--- a/services/fuse/tests/test_tmp_collection.py
+++ b/services/fuse/tests/test_tmp_collection.py
@@ -2,8 +2,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from builtins import range
-from six import assertRegex
 import arvados
 import arvados_fuse
 import arvados_fuse.command
@@ -18,7 +16,6 @@ from .mount_test_base import MountTestBase
 
 logger = logging.getLogger('arvados.arv-mount')
 
-
 class TmpCollectionArgsTest(unittest.TestCase):
     def setUp(self):
         self.tmpdir = tempfile.mkdtemp()
@@ -107,8 +104,7 @@ class TmpCollectionTest(IntegrationTest):
     def _test_tmp_onefile(self, tmpdir):
         with open(os.path.join(tmpdir, 'foo'), 'w') as f:
             f.write('foo')
-        assertRegex(
-            self,
+        self.assertRegex(
             current_manifest(tmpdir),
             r'^\. acbd18db4cc2f85cedef654fccc4a4d8\+3(\+\S+)? 0:3:foo\n$')
 
@@ -137,7 +133,7 @@ class TmpCollectionTest(IntegrationTest):
                 else:
                     with open(path, 'w') as f:
                         f.write(content)
-                assertRegex(self, current_manifest(tmpdir), expect)
+                self.assertRegex(current_manifest(tmpdir), expect)
 
     @IntegrationTest.mount(argv=mnt_args)
     def test_tmp_rewrite(self):
@@ -150,4 +146,4 @@ class TmpCollectionTest(IntegrationTest):
             f.write("b2")
         with open(os.path.join(tmpdir, "b1"), 'w') as f:
             f.write("1b")
-        assertRegex(self, current_manifest(tmpdir), "^\. ed4f3f67c70b02b29c50ce1ea26666bd\+4(\+\S+)? 0:2:b1 2:2:b2\n$")
+        self.assertRegex(current_manifest(tmpdir), "^\. ed4f3f67c70b02b29c50ce1ea26666bd\+4(\+\S+)? 0:2:b1 2:2:b2\n$")
diff --git a/services/fuse/tests/test_token_expiry.py b/services/fuse/tests/test_token_expiry.py
index ca2228c561..046a835893 100644
--- a/services/fuse/tests/test_token_expiry.py
+++ b/services/fuse/tests/test_token_expiry.py
@@ -2,7 +2,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from builtins import range
 import apiclient
 import arvados
 import arvados_fuse
diff --git a/services/fuse/tests/test_unmount.py b/services/fuse/tests/test_unmount.py
index 6a19b33454..3949fd5de4 100644
--- a/services/fuse/tests/test_unmount.py
+++ b/services/fuse/tests/test_unmount.py
@@ -2,8 +2,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
-from builtins import bytes
 import arvados_fuse.unmount
 import os
 import subprocess
diff --git a/tools/crunchstat-summary/bin/crunchstat-summary b/tools/crunchstat-summary/bin/crunchstat-summary
index 3c18829189..bfd85ec9e1 100755
--- a/tools/crunchstat-summary/bin/crunchstat-summary
+++ b/tools/crunchstat-summary/bin/crunchstat-summary
@@ -3,8 +3,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import print_function
-
 import crunchstat_summary.command
 import crunchstat_summary.summarizer
 import logging
diff --git a/tools/crunchstat-summary/setup.py b/tools/crunchstat-summary/setup.py
index 53af6455fb..95c534c90b 100755
--- a/tools/crunchstat-summary/setup.py
+++ b/tools/crunchstat-summary/setup.py
@@ -3,7 +3,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
 import os
 import sys
 import re
diff --git a/tools/keep-xref/keep-xref.py b/tools/keep-xref/keep-xref.py
index d77e593640..77e8bc5d91 100755
--- a/tools/keep-xref/keep-xref.py
+++ b/tools/keep-xref/keep-xref.py
@@ -5,7 +5,6 @@
 # SPDX-License-Identifier: AGPL-3.0
 #
 
-from __future__ import print_function, absolute_import
 import argparse
 import arvados
 import arvados.util
diff --git a/tools/user-activity/setup.py b/tools/user-activity/setup.py
index 8611fa47a1..a455a87fe7 100755
--- a/tools/user-activity/setup.py
+++ b/tools/user-activity/setup.py
@@ -3,7 +3,6 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-from __future__ import absolute_import
 import os
 import sys
 import re

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list