mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-23 09:15:32 +00:00
Port to Python 3.
This commit is contained in:
@ -1,4 +1,15 @@
|
|||||||
"""Directory Node implementation."""
|
"""Directory Node implementation.
|
||||||
|
|
||||||
|
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 past.builtins import unicode
|
from past.builtins import unicode
|
||||||
|
|
||||||
import time
|
import time
|
||||||
@ -37,6 +48,8 @@ from eliot.twisted import (
|
|||||||
|
|
||||||
NAME = Field.for_types(
|
NAME = Field.for_types(
|
||||||
u"name",
|
u"name",
|
||||||
|
# Make sure this works on Python 2; with str, it gets Future str which
|
||||||
|
# breaks Eliot.
|
||||||
[unicode],
|
[unicode],
|
||||||
u"The name linking the parent to this node.",
|
u"The name linking the parent to this node.",
|
||||||
)
|
)
|
||||||
@ -250,7 +263,7 @@ def _pack_normalized_children(children, writekey, deep_immutable=False):
|
|||||||
has_aux = isinstance(children, AuxValueDict)
|
has_aux = isinstance(children, AuxValueDict)
|
||||||
entries = []
|
entries = []
|
||||||
for name in sorted(children.keys()):
|
for name in sorted(children.keys()):
|
||||||
assert isinstance(name, unicode)
|
assert isinstance(name, str)
|
||||||
entry = None
|
entry = None
|
||||||
(child, metadata) = children[name]
|
(child, metadata) = children[name]
|
||||||
child.raise_error()
|
child.raise_error()
|
||||||
@ -543,7 +556,7 @@ class DirectoryNode(object):
|
|||||||
else:
|
else:
|
||||||
pathx = pathx.split("/")
|
pathx = pathx.split("/")
|
||||||
for p in pathx:
|
for p in pathx:
|
||||||
assert isinstance(p, unicode), p
|
assert isinstance(p, str), p
|
||||||
childnamex = pathx[0]
|
childnamex = pathx[0]
|
||||||
remaining_pathx = pathx[1:]
|
remaining_pathx = pathx[1:]
|
||||||
if remaining_pathx:
|
if remaining_pathx:
|
||||||
@ -570,7 +583,7 @@ class DirectoryNode(object):
|
|||||||
a = Adder(self, overwrite=overwrite,
|
a = Adder(self, overwrite=overwrite,
|
||||||
create_readonly_node=self._create_readonly_node)
|
create_readonly_node=self._create_readonly_node)
|
||||||
for (namex, e) in entries.items():
|
for (namex, e) in entries.items():
|
||||||
assert isinstance(namex, unicode), namex
|
assert isinstance(namex, str), namex
|
||||||
if len(e) == 2:
|
if len(e) == 2:
|
||||||
writecap, readcap = e
|
writecap, readcap = e
|
||||||
metadata = None
|
metadata = None
|
||||||
|
@ -34,6 +34,7 @@ PORTED_MODULES = [
|
|||||||
"allmydata.crypto.error",
|
"allmydata.crypto.error",
|
||||||
"allmydata.crypto.rsa",
|
"allmydata.crypto.rsa",
|
||||||
"allmydata.crypto.util",
|
"allmydata.crypto.util",
|
||||||
|
"allmydata.dirnode",
|
||||||
"allmydata.hashtree",
|
"allmydata.hashtree",
|
||||||
"allmydata.immutable.downloader",
|
"allmydata.immutable.downloader",
|
||||||
"allmydata.immutable.downloader.common",
|
"allmydata.immutable.downloader.common",
|
||||||
|
Reference in New Issue
Block a user