[Pkg-privacy-commits] [txtorcon] 11/49: Changes required for using zope.interfaces in py3k.
Ximin Luo
infinity0 at debian.org
Mon Oct 19 13:49:50 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository txtorcon.
commit 6a909b3e804b6865e357eb7d8b58d6fed3c8d33c
Author: Isis Lovecruft <isis at torproject.org>
Date: Thu May 21 05:31:54 2015 +0000
Changes required for using zope.interfaces in py3k.
Specifically, we need to use the @implementer class decorator, rather
than implements(). See the "This entire approach is invalid under
Py3K." inline comments in zope.interface.declarations.implements() and
zope.interface.declarations.implementsOnly().
---
txtorcon/interface.py | 8 ++++----
txtorcon/torcontrolprotocol.py | 9 ++++-----
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/txtorcon/interface.py b/txtorcon/interface.py
index 1370448..6cacb1c 100644
--- a/txtorcon/interface.py
+++ b/txtorcon/interface.py
@@ -5,7 +5,8 @@ from __future__ import print_function
from __future__ import unicode_literals
from __future__ import with_statement
-from zope.interface import implements, Interface, Attribute
+from zope.interface import implementer
+from zope.interface import Interface, Attribute
class IStreamListener(Interface):
@@ -59,6 +60,7 @@ class IStreamListener(Interface):
"""
+ at implementer(IStreamListener)
class StreamListenerMixin(object):
"""
Implements all of :class:`txtorcon.IStreamListener` with no-op
@@ -66,8 +68,6 @@ class StreamListenerMixin(object):
of the notifications.
"""
- implements(IStreamListener)
-
def stream_new(self, stream):
pass
@@ -227,12 +227,12 @@ class ICircuitListener(Interface):
"""
+ at implementer(ICircuitListener)
class CircuitListenerMixin(object):
"""
Implements all of ICircuitListener with no-op methods. Subclass
from this if you don't care about most of the notifications.
"""
- implements(ICircuitListener)
def circuit_new(self, circuit):
pass
diff --git a/txtorcon/torcontrolprotocol.py b/txtorcon/torcontrolprotocol.py
index 4bf152b..f4cb522 100644
--- a/txtorcon/torcontrolprotocol.py
+++ b/txtorcon/torcontrolprotocol.py
@@ -9,7 +9,8 @@ from twisted.internet import defer
from twisted.internet.interfaces import IProtocolFactory
from twisted.internet.error import ConnectionDone
from twisted.protocols.basic import LineOnlyReceiver
-from zope.interface import implements
+
+from zope.interface import implementer
from txtorcon.util import hmac_sha256, compare_via_hash
from txtorcon.log import txtorlog
@@ -42,6 +43,7 @@ class TorProtocolError(RuntimeError):
return str(self.code) + ' ' + self.text
+ at implementer(IProtocolFactory)
class TorProtocolFactory(object):
"""
Builds TorControlProtocol objects. Implements IProtocolFactory for
@@ -51,8 +53,6 @@ class TorProtocolFactory(object):
you should supply a password callback.
"""
- implements(IProtocolFactory)
-
def __init__(self, password_function=lambda: None):
"""
Builds protocols to talk to a Tor client on the specified
@@ -176,6 +176,7 @@ def parse_keywords(lines, multiline_values=True):
return rtn
+ at implementer(ITorControlProtocol)
class TorControlProtocol(LineOnlyReceiver):
"""
This is the main class that talks to a Tor and implements the "raw"
@@ -195,8 +196,6 @@ class TorControlProtocol(LineOnlyReceiver):
wish to add your own stream or circuit listeners.
"""
- implements(ITorControlProtocol)
-
def __init__(self, password_function=None):
"""
:param password_function:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/txtorcon.git
More information about the Pkg-privacy-commits
mailing list