Ported to Python 3.

This commit is contained in:
Itamar Turner-Trauring 2020-11-12 11:17:17 -05:00
parent 679319baf4
commit 99f54223ab
2 changed files with 16 additions and 4 deletions

View File

@ -1,4 +1,15 @@
from past.builtins import unicode
"""
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:
# Don't import bytes and str, to prevent API leakage
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, dict, list, object, range, max, min # noqa: F401
import time
@ -749,9 +760,9 @@ class Retrieve(object):
blockhashes = dict(enumerate(blockhashes))
self.log("the reader gave me the following blockhashes: %s" % \
blockhashes.keys())
list(blockhashes.keys()))
self.log("the reader gave me the following sharehashes: %s" % \
sharehashes.keys())
list(sharehashes.keys()))
bht = self._block_hash_trees[reader.shnum]
if bht.needed_hashes(segnum, include_leaf=True):
@ -908,7 +919,7 @@ class Retrieve(object):
def notify_server_corruption(self, server, shnum, reason):
if isinstance(reason, unicode):
if isinstance(reason, str):
reason = reason.encode("utf-8")
storage_server = server.get_storage_server()
storage_server.advise_corrupt_share(

View File

@ -59,6 +59,7 @@ PORTED_MODULES = [
"allmydata.mutable.layout",
"allmydata.mutable.publish",
"allmydata.mutable.repairer",
"allmydata.mutable.retrieve",
"allmydata.node",
"allmydata.storage_client",
"allmydata.storage.common",