mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 13:33:09 +00:00
Port to Python 3.
This commit is contained in:
parent
1ef33d3d69
commit
8439f2820b
@ -115,6 +115,7 @@ PORTED_MODULES = [
|
||||
"allmydata.util.base62",
|
||||
"allmydata.util.configutil",
|
||||
"allmydata.util.connection_status",
|
||||
"allmydata.util.consumer",
|
||||
"allmydata.util.deferredutil",
|
||||
"allmydata.util.dictutil",
|
||||
"allmydata.util.eliotutil",
|
||||
|
@ -1,11 +1,22 @@
|
||||
|
||||
"""This file defines a basic download-to-memory consumer, suitable for use in
|
||||
a filenode's read() method. See download_to_data() for an example of its use.
|
||||
"""
|
||||
This file defines a basic download-to-memory consumer, suitable for use in
|
||||
a filenode's read() method. See download_to_data() for an example of its use.
|
||||
|
||||
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 zope.interface import implementer
|
||||
from twisted.internet.interfaces import IConsumer
|
||||
|
||||
|
||||
@implementer(IConsumer)
|
||||
class MemoryConsumer(object):
|
||||
|
||||
@ -28,6 +39,7 @@ class MemoryConsumer(object):
|
||||
def unregisterProducer(self):
|
||||
self.done = True
|
||||
|
||||
|
||||
def download_to_data(n, offset=0, size=None):
|
||||
"""
|
||||
Return Deferred that fires with results of reading from the given filenode.
|
||||
|
Loading…
Reference in New Issue
Block a user