mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-23 09:15:32 +00:00
Enough changes to make allmydata.test.test_storage run on Python 3.
Still lots of failures, of course.
This commit is contained in:
@ -1,4 +1,6 @@
|
|||||||
"""Directory Node implementation."""
|
"""Directory Node implementation."""
|
||||||
|
from past.builtins import unicode
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from zope.interface import implementer
|
from zope.interface import implementer
|
||||||
@ -227,7 +229,7 @@ def pack_children(childrenx, writekey, deep_immutable=False):
|
|||||||
return _pack_normalized_children(children, writekey=writekey, deep_immutable=deep_immutable)
|
return _pack_normalized_children(children, writekey=writekey, deep_immutable=deep_immutable)
|
||||||
|
|
||||||
|
|
||||||
ZERO_LEN_NETSTR=netstring('')
|
ZERO_LEN_NETSTR=netstring(b'')
|
||||||
def _pack_normalized_children(children, writekey, deep_immutable=False):
|
def _pack_normalized_children(children, writekey, deep_immutable=False):
|
||||||
"""Take a dict that maps:
|
"""Take a dict that maps:
|
||||||
children[unicode_nfc_name] = (IFileSystemNode, metadata_dict)
|
children[unicode_nfc_name] = (IFileSystemNode, metadata_dict)
|
||||||
|
@ -4,7 +4,7 @@ from foolscap.api import eventually
|
|||||||
from allmydata.interfaces import NotEnoughSharesError, NoSharesError
|
from allmydata.interfaces import NotEnoughSharesError, NoSharesError
|
||||||
from allmydata.util import log
|
from allmydata.util import log
|
||||||
from allmydata.util.dictutil import DictOfSets
|
from allmydata.util.dictutil import DictOfSets
|
||||||
from common import OVERDUE, COMPLETE, CORRUPT, DEAD, BADSEGNUM, \
|
from .common import OVERDUE, COMPLETE, CORRUPT, DEAD, BADSEGNUM, \
|
||||||
BadSegmentNumberError
|
BadSegmentNumberError
|
||||||
|
|
||||||
class SegmentFetcher(object):
|
class SegmentFetcher(object):
|
||||||
|
@ -5,7 +5,7 @@ from foolscap.api import eventually
|
|||||||
from allmydata.util import base32, log
|
from allmydata.util import base32, log
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
|
||||||
from share import Share, CommonShare
|
from .share import Share, CommonShare
|
||||||
|
|
||||||
def incidentally(res, f, *args, **kwargs):
|
def incidentally(res, f, *args, **kwargs):
|
||||||
"""Add me to a Deferred chain like this:
|
"""Add me to a Deferred chain like this:
|
||||||
|
@ -13,10 +13,10 @@ from allmydata.hashtree import IncompleteHashTree, BadHashError, \
|
|||||||
NotEnoughHashesError
|
NotEnoughHashesError
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from finder import ShareFinder
|
from .finder import ShareFinder
|
||||||
from fetcher import SegmentFetcher
|
from .fetcher import SegmentFetcher
|
||||||
from segmentation import Segmentation
|
from .segmentation import Segmentation
|
||||||
from common import BadCiphertextHashError
|
from .common import BadCiphertextHashError
|
||||||
|
|
||||||
class IDownloadStatusHandlingConsumer(Interface):
|
class IDownloadStatusHandlingConsumer(Interface):
|
||||||
def set_download_status_read_event(read_ev):
|
def set_download_status_read_event(read_ev):
|
||||||
|
@ -9,7 +9,7 @@ from allmydata.util import log
|
|||||||
from allmydata.util.spans import overlap
|
from allmydata.util.spans import overlap
|
||||||
from allmydata.interfaces import DownloadStopped
|
from allmydata.interfaces import DownloadStopped
|
||||||
|
|
||||||
from common import BadSegmentNumberError, WrongSegmentError
|
from .common import BadSegmentNumberError, WrongSegmentError
|
||||||
|
|
||||||
@implementer(IPushProducer)
|
@implementer(IPushProducer)
|
||||||
class Segmentation(object):
|
class Segmentation(object):
|
||||||
|
@ -13,7 +13,7 @@ from allmydata.hashtree import IncompleteHashTree, BadHashError, \
|
|||||||
|
|
||||||
from allmydata.immutable.layout import make_write_bucket_proxy
|
from allmydata.immutable.layout import make_write_bucket_proxy
|
||||||
from allmydata.util.observer import EventStreamObserver
|
from allmydata.util.observer import EventStreamObserver
|
||||||
from common import COMPLETE, CORRUPT, DEAD, BADSEGNUM
|
from .common import COMPLETE, CORRUPT, DEAD, BADSEGNUM
|
||||||
|
|
||||||
|
|
||||||
class LayoutInvalid(Exception):
|
class LayoutInvalid(Exception):
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
This module contains classes and functions to implement and manage
|
This module contains classes and functions to implement and manage
|
||||||
a node for Tahoe-LAFS.
|
a node for Tahoe-LAFS.
|
||||||
"""
|
"""
|
||||||
|
from past.builtins import unicode
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
@ -70,7 +72,7 @@ def _common_valid_config():
|
|||||||
|
|
||||||
# Add our application versions to the data that Foolscap's LogPublisher
|
# Add our application versions to the data that Foolscap's LogPublisher
|
||||||
# reports.
|
# reports.
|
||||||
for thing, things_version in get_package_versions().iteritems():
|
for thing, things_version in get_package_versions().items():
|
||||||
app_versions.add_version(thing, str(things_version))
|
app_versions.add_version(thing, str(things_version))
|
||||||
|
|
||||||
# group 1 will be addr (dotted quad string), group 3 if any will be portnum (string)
|
# group 1 will be addr (dotted quad string), group 3 if any will be portnum (string)
|
||||||
@ -275,7 +277,10 @@ class _Config(object):
|
|||||||
self.config = configparser
|
self.config = configparser
|
||||||
|
|
||||||
nickname_utf8 = self.get_config("node", "nickname", "<unspecified>")
|
nickname_utf8 = self.get_config("node", "nickname", "<unspecified>")
|
||||||
self.nickname = nickname_utf8.decode("utf-8")
|
if isinstance(nickname_utf8, bytes): # Python 2
|
||||||
|
self.nickname = nickname_utf8.decode("utf-8")
|
||||||
|
else:
|
||||||
|
self.nickname = nickname_utf8
|
||||||
assert type(self.nickname) is unicode
|
assert type(self.nickname) is unicode
|
||||||
|
|
||||||
def validate(self, valid_config_sections):
|
def validate(self, valid_config_sections):
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
Tools aimed at the interaction between tests and Eliot.
|
Tools aimed at the interaction between tests and Eliot.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from past.builtins import unicode
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"RUN_TEST",
|
"RUN_TEST",
|
||||||
"EliotLoggedRunTest",
|
"EliotLoggedRunTest",
|
||||||
|
Reference in New Issue
Block a user