Merge pull request #838 from tahoe-lafs/3452.immutable-downloader-more-python-3

Port more of allmydata.immutable.downloader to Python 3

Fixes ticket:3452
This commit is contained in:
Itamar Turner-Trauring 2020-09-30 13:15:06 -04:00 committed by GitHub
commit 6fcec69435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 3 deletions

0
newsfragments/3452.minor Normal file
View File

View File

@ -0,0 +1,13 @@
"""
Ported to Python 3.
"""
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
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

View File

@ -1,3 +1,15 @@
"""
Ported to Python 3.
"""
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
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
(AVAILABLE, PENDING, OVERDUE, COMPLETE, CORRUPT, DEAD, BADSEGNUM) = \
("AVAILABLE", "PENDING", "OVERDUE", "COMPLETE", "CORRUPT", "DEAD", "BADSEGNUM")

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
import time
now = time.time

View File

@ -1,3 +1,14 @@
"""
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 itertools
from zope.interface import implementer
@ -9,8 +20,8 @@ class ReadEvent(object):
self._ev = ev
self._ds = ds
def update(self, bytes, decrypttime, pausetime):
self._ev["bytes_returned"] += bytes
def update(self, bytes_returned, decrypttime, pausetime):
self._ev["bytes_returned"] += bytes_returned
self._ev["decrypt_time"] += decrypttime
self._ev["paused_time"] += pausetime
@ -257,7 +268,7 @@ class DownloadStatus(object):
# else ignore completed requests
if not total_outstanding:
return 1.0
return 1.0 * total_received / total_outstanding
return total_received / total_outstanding
def using_helper(self):
return False

View File

@ -32,9 +32,13 @@ PORTED_MODULES = [
"allmydata.crypto.rsa",
"allmydata.crypto.util",
"allmydata.hashtree",
"allmydata.immutable.downloader",
"allmydata.immutable.downloader.common",
"allmydata.immutable.downloader.fetcher",
"allmydata.immutable.downloader.finder",
"allmydata.immutable.downloader.node",
"allmydata.immutable.downloader.segmentation",
"allmydata.immutable.downloader.status",
"allmydata.immutable.happiness_upload",
"allmydata.immutable.literal",
"allmydata.interfaces",