Port to Python 3.

This commit is contained in:
Itamar Turner-Trauring 2021-06-03 09:34:42 -04:00
parent 58d6f9f6cf
commit cf68f55039
2 changed files with 10 additions and 2 deletions

View File

@ -1,7 +1,14 @@
"""
Ported to Python 3.
"""
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function from __future__ import print_function
from future.utils import PY2 from future.utils import PY2
from past.builtins import unicode 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 io import BytesIO from io import BytesIO
from urllib.parse import quote as url_quote from urllib.parse import quote as url_quote
@ -56,7 +63,7 @@ def put(options):
except UnknownAliasError as e: except UnknownAliasError as e:
e.display(stderr) e.display(stderr)
return 1 return 1
path = unicode(path, "utf-8") path = str(path, "utf-8")
if path.startswith("/"): if path.startswith("/"):
suggestion = to_file.replace(u"/", u"", 1) suggestion = to_file.replace(u"/", u"", 1)
print("Error: The remote filename must not start with a slash", file=stderr) print("Error: The remote filename must not start with a slash", file=stderr)

View File

@ -112,6 +112,7 @@ PORTED_MODULES = [
"allmydata.scripts.tahoe_manifest", "allmydata.scripts.tahoe_manifest",
"allmydata.scripts.tahoe_mkdir", "allmydata.scripts.tahoe_mkdir",
"allmydata.scripts.tahoe_mv", "allmydata.scripts.tahoe_mv",
"allmydata.scripts.tahoe_put",
"allmydata.scripts.types_", "allmydata.scripts.types_",
"allmydata.stats", "allmydata.stats",
"allmydata.storage_client", "allmydata.storage_client",