Merge pull request #894 from tahoe-lafs/3501.mutable-python-3-part-1

Port allmydata.mutable to Python 3, part 1

Fixes ticket:3501
This commit is contained in:
Itamar Turner-Trauring 2020-11-12 16:12:36 -05:00 committed by GitHub
commit dc611bf9b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 3 deletions

0
newsfragments/3501.minor Normal file
View File

View File

@ -1,3 +1,14 @@
"""
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:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
from allmydata.uri import from_string
from allmydata.util import base32, log, dictutil

View File

@ -1,3 +1,14 @@
"""
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:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
MODE_CHECK = "MODE_CHECK" # query all peers
MODE_ANYTHING = "MODE_ANYTHING" # one recoverable version

View File

@ -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:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
import random
from zope.interface import implementer
@ -1141,7 +1153,7 @@ class MutableFileVersion(object):
start_segments = {} # shnum -> start segment
end_segments = {} # shnum -> end segment
blockhashes = {} # shnum -> blockhash tree
for (shnum, original_data) in update_data.items():
for (shnum, original_data) in list(update_data.items()):
data = [d[1] for d in original_data if d[0] == self._version]
# data is [(blockhashes,start,end)..]

View File

@ -1,3 +1,15 @@
"""
Ported to Python 3.
"""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from future.utils import PY2
if PY2:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
import os, time
from io import BytesIO
from itertools import count
@ -446,7 +458,7 @@ class Publish(object):
# then we add in all the shares that were bad (corrupted, bad
# signatures, etc). We want to replace these.
for key, old_checkstring in self._servermap.get_bad_shares().items():
for key, old_checkstring in list(self._servermap.get_bad_shares().items()):
(server, shnum) = key
self.goal.add( (server,shnum) )
self.bad_share_checkstrings[(server,shnum)] = old_checkstring
@ -1105,7 +1117,7 @@ class Publish(object):
self.bad_servers.add(server) # don't ask them again
# use the checkstring to add information to the log message
unknown_format = False
for (shnum,readv) in read_data.items():
for (shnum,readv) in list(read_data.items()):
checkstring = readv[0]
version = get_version_from_checkstring(checkstring)
if version == MDMF_VERSION:

View File

@ -53,6 +53,10 @@ PORTED_MODULES = [
"allmydata.interfaces",
"allmydata.introducer.interfaces",
"allmydata.monitor",
"allmydata.mutable.checker",
"allmydata.mutable.common",
"allmydata.mutable.filenode",
"allmydata.mutable.publish",
"allmydata.node",
"allmydata.storage_client",
"allmydata.storage.common",