mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-18 15:28:12 +00:00
Port to Python 3.
This commit is contained in:
@ -1,4 +1,14 @@
|
||||
from past.builtins import unicode
|
||||
"""
|
||||
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 os, stat, time, weakref
|
||||
from base64 import urlsafe_b64encode
|
||||
@ -460,7 +470,7 @@ def create_introducer_clients(config, main_tub, _introducer_factory=None):
|
||||
|
||||
introducers = config.get_introducer_configuration()
|
||||
|
||||
for petname, (furl, cache_path) in introducers.items():
|
||||
for petname, (furl, cache_path) in list(introducers.items()):
|
||||
ic = _introducer_factory(
|
||||
main_tub,
|
||||
furl.encode("ascii"),
|
||||
@ -679,7 +689,7 @@ class _Client(node.Node, pollmixin.PollMixin):
|
||||
def init_secrets(self):
|
||||
# configs are always unicode
|
||||
def _unicode_make_secret():
|
||||
return unicode(_make_secret(), "ascii")
|
||||
return str(_make_secret(), "ascii")
|
||||
lease_s = self.config.get_or_create_private_config(
|
||||
"secret", _unicode_make_secret).encode("utf-8")
|
||||
lease_secret = base32.a2b(lease_s)
|
||||
@ -694,7 +704,7 @@ class _Client(node.Node, pollmixin.PollMixin):
|
||||
def _make_key():
|
||||
private_key, _ = ed25519.create_signing_keypair()
|
||||
# Config values are always unicode:
|
||||
return unicode(ed25519.string_from_signing_key(private_key) + b"\n", "utf-8")
|
||||
return str(ed25519.string_from_signing_key(private_key) + b"\n", "utf-8")
|
||||
|
||||
private_key_str = self.config.get_or_create_private_config(
|
||||
"node.privkey", _make_key).encode("utf-8")
|
||||
|
Reference in New Issue
Block a user