From 180c6d75365b54a8a9afd3befec316221c262873 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Thu, 12 Nov 2020 11:00:54 -0500 Subject: [PATCH] Port to Python 3. --- src/allmydata/mutable/layout.py | 14 +++++++++++++- src/allmydata/util/_python3.py | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/allmydata/mutable/layout.py b/src/allmydata/mutable/layout.py index bf9a0483b..ce51a8833 100644 --- a/src/allmydata/mutable/layout.py +++ b/src/allmydata/mutable/layout.py @@ -1,3 +1,15 @@ +""" +Ported to Python 3. +""" +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from future.utils import PY2 +if PY2: + # Omit dict so Python 3 changes don't leak into API callers on Python 2. + from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, list, object, range, str, max, min # noqa: F401 from past.utils import old_div import struct @@ -1744,7 +1756,7 @@ class MDMFSlotReadProxy(object): def _read(self, readvs, force_remote=False): - unsatisfiable = list(filter(lambda x: x[0] + x[1] > len(self._data), readvs)) + unsatisfiable = [x for x in readvs if x[0] + x[1] > len(self._data)] # TODO: It's entirely possible to tweak this so that it just # fulfills the requests that it can, and not demand that all # requests are satisfiable before running it. diff --git a/src/allmydata/util/_python3.py b/src/allmydata/util/_python3.py index 7afefceed..acab5b146 100644 --- a/src/allmydata/util/_python3.py +++ b/src/allmydata/util/_python3.py @@ -56,6 +56,7 @@ PORTED_MODULES = [ "allmydata.mutable.checker", "allmydata.mutable.common", "allmydata.mutable.filenode", + "allmydata.mutable.layout", "allmydata.mutable.publish", "allmydata.node", "allmydata.storage_client",