mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-18 23:38:18 +00:00
Some more progress towards Python 3.
This commit is contained in:
@ -720,7 +720,7 @@ class _Client(node.Node, pollmixin.PollMixin):
|
|||||||
def get_long_nodeid(self):
|
def get_long_nodeid(self):
|
||||||
# this matches what IServer.get_longname() says about us elsewhere
|
# this matches what IServer.get_longname() says about us elsewhere
|
||||||
vk_string = ed25519.string_from_verifying_key(self._node_public_key)
|
vk_string = ed25519.string_from_verifying_key(self._node_public_key)
|
||||||
return remove_prefix(vk_string, "pub-")
|
return remove_prefix(vk_string, b"pub-")
|
||||||
|
|
||||||
def get_long_tubid(self):
|
def get_long_tubid(self):
|
||||||
return idlib.nodeid_b2a(self.nodeid)
|
return idlib.nodeid_b2a(self.nodeid)
|
||||||
|
@ -179,7 +179,7 @@ class Adder(object):
|
|||||||
def modify(self, old_contents, servermap, first_time):
|
def modify(self, old_contents, servermap, first_time):
|
||||||
children = self.node._unpack_contents(old_contents)
|
children = self.node._unpack_contents(old_contents)
|
||||||
now = time.time()
|
now = time.time()
|
||||||
for (namex, (child, new_metadata)) in self.entries.iteritems():
|
for (namex, (child, new_metadata)) in list(self.entries.items()):
|
||||||
name = normalize(namex)
|
name = normalize(namex)
|
||||||
precondition(IFilesystemNode.providedBy(child), child)
|
precondition(IFilesystemNode.providedBy(child), child)
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ def _encrypt_rw_uri(writekey, rw_uri):
|
|||||||
def pack_children(childrenx, writekey, deep_immutable=False):
|
def pack_children(childrenx, writekey, deep_immutable=False):
|
||||||
# initial_children must have metadata (i.e. {} instead of None)
|
# initial_children must have metadata (i.e. {} instead of None)
|
||||||
children = {}
|
children = {}
|
||||||
for (namex, (node, metadata)) in childrenx.iteritems():
|
for (namex, (node, metadata)) in list(childrenx.items()):
|
||||||
precondition(isinstance(metadata, dict),
|
precondition(isinstance(metadata, dict),
|
||||||
"directory creation requires metadata to be a dict, not None", metadata)
|
"directory creation requires metadata to be a dict, not None", metadata)
|
||||||
children[normalize(namex)] = (node, metadata)
|
children[normalize(namex)] = (node, metadata)
|
||||||
@ -245,7 +245,7 @@ def _pack_normalized_children(children, writekey, deep_immutable=False):
|
|||||||
If deep_immutable is True, I will require that all my children are deeply
|
If deep_immutable is True, I will require that all my children are deeply
|
||||||
immutable, and will raise a MustBeDeepImmutableError if not.
|
immutable, and will raise a MustBeDeepImmutableError if not.
|
||||||
"""
|
"""
|
||||||
precondition((writekey is None) or isinstance(writekey, str), writekey)
|
precondition((writekey is None) or isinstance(writekey, bytes), writekey)
|
||||||
|
|
||||||
has_aux = isinstance(children, AuxValueDict)
|
has_aux = isinstance(children, AuxValueDict)
|
||||||
entries = []
|
entries = []
|
||||||
|
@ -126,7 +126,7 @@ class NodeMaker(object):
|
|||||||
|
|
||||||
def create_new_mutable_directory(self, initial_children={}, version=None):
|
def create_new_mutable_directory(self, initial_children={}, version=None):
|
||||||
# initial_children must have metadata (i.e. {} instead of None)
|
# initial_children must have metadata (i.e. {} instead of None)
|
||||||
for (name, (node, metadata)) in initial_children.iteritems():
|
for (name, (node, metadata)) in initial_children.items():
|
||||||
precondition(isinstance(metadata, dict),
|
precondition(isinstance(metadata, dict),
|
||||||
"create_new_mutable_directory requires metadata to be a dict, not None", metadata)
|
"create_new_mutable_directory requires metadata to be a dict, not None", metadata)
|
||||||
node.raise_error()
|
node.raise_error()
|
||||||
|
@ -788,7 +788,7 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
|
|||||||
|
|
||||||
self.helper_furl = helper_furl
|
self.helper_furl = helper_furl
|
||||||
if self.numclients >= 4:
|
if self.numclients >= 4:
|
||||||
with open(os.path.join(basedirs[3], 'tahoe.cfg'), 'ab+') as f:
|
with open(os.path.join(basedirs[3], 'tahoe.cfg'), 'a+') as f:
|
||||||
f.write(
|
f.write(
|
||||||
"[client]\n"
|
"[client]\n"
|
||||||
"helper.furl = {}\n".format(helper_furl)
|
"helper.furl = {}\n".format(helper_furl)
|
||||||
@ -831,8 +831,6 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
|
|||||||
|
|
||||||
def setconf(config, which, section, feature, value):
|
def setconf(config, which, section, feature, value):
|
||||||
if which in feature_matrix.get((section, feature), {which}):
|
if which in feature_matrix.get((section, feature), {which}):
|
||||||
if isinstance(value, unicode):
|
|
||||||
value = value.encode("utf-8")
|
|
||||||
config.setdefault(section, {})[feature] = value
|
config.setdefault(section, {})[feature] = value
|
||||||
|
|
||||||
setclient = partial(setconf, config, which, "client")
|
setclient = partial(setconf, config, which, "client")
|
||||||
@ -1036,7 +1034,7 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
|
|||||||
all_peerids = c.get_storage_broker().get_all_serverids()
|
all_peerids = c.get_storage_broker().get_all_serverids()
|
||||||
self.failUnlessEqual(len(all_peerids), self.numclients)
|
self.failUnlessEqual(len(all_peerids), self.numclients)
|
||||||
sb = c.storage_broker
|
sb = c.storage_broker
|
||||||
permuted_peers = sb.get_servers_for_psi("a")
|
permuted_peers = sb.get_servers_for_psi(b"a")
|
||||||
self.failUnlessEqual(len(permuted_peers), self.numclients)
|
self.failUnlessEqual(len(permuted_peers), self.numclients)
|
||||||
d.addCallback(_check_connections)
|
d.addCallback(_check_connections)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user