mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-02 17:20:50 +00:00
Port to Python 3.
This commit is contained in:
parent
243d02ecb1
commit
a08cde9a4d
@ -1,3 +1,4 @@
|
||||
from past.builtins import long
|
||||
|
||||
from zope.interface import Interface, Attribute
|
||||
from twisted.plugin import (
|
||||
|
@ -28,6 +28,7 @@ PORTED_MODULES = [
|
||||
"allmydata.util.assertutil",
|
||||
"allmydata.util.base32",
|
||||
"allmydata.util.base62",
|
||||
"allmydata.util.connection_status",
|
||||
"allmydata.util.deferredutil",
|
||||
"allmydata.util.dictutil",
|
||||
"allmydata.util.gcutil",
|
||||
|
@ -1,3 +1,18 @@
|
||||
"""
|
||||
Parse connection status from Foolscap.
|
||||
|
||||
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 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 time
|
||||
from zope.interface import implementer
|
||||
from ..interfaces import IConnectionStatus
|
||||
@ -37,9 +52,12 @@ def _hint_statuses(which, handlers, statuses):
|
||||
|
||||
def from_foolscap_reconnector(rc, last_received):
|
||||
ri = rc.getReconnectionInfo()
|
||||
# See foolscap/reconnector.py, ReconnectionInfo, for details about
|
||||
# possible states.
|
||||
# See foolscap/reconnector.py, ReconnectionInfo, for details about possible
|
||||
# states. The returned result is a native string, it seems, so convert to
|
||||
# unicode.
|
||||
state = ri.state
|
||||
if isinstance(state, bytes): # Python 2
|
||||
state = str(state, "ascii")
|
||||
if state == "unstarted":
|
||||
return ConnectionStatus.unstarted()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user