Ticket #6833: amp-py3.patch

File amp-py3.patch, 5.3 KB (added by Thijs Triemstra, 4 years ago)
  • twisted/protocols/amp.py

     
    175175
    176176import types, warnings
    177177
    178 from cStringIO import StringIO
    179178from struct import pack
    180179import decimal, datetime
    181180from itertools import count
    182181
    183 from zope.interface import Interface, implements
     182from zope.interface import Interface, implementer
    184183
    185184from twisted.python.reflect import accumulateClassDict
    186185from twisted.python.failure import Failure
     
    191190from twisted.python import log, filepath
    192191
    193192from twisted.internet.interfaces import IFileDescriptorReceiver
     193from twisted.python.compat import NativeStringIO as StringIO
    194194from twisted.internet.main import CONNECTION_LOST
    195195from twisted.internet.error import PeerVerifyError, ConnectionLost
    196196from twisted.internet.error import ConnectionClosed
     
    703703
    704704
    705705
     706@implementer(IBoxReceiver)
    706707class BoxDispatcher:
    707708    """
    708709    A L{BoxDispatcher} dispatches '_ask', '_answer', and '_error' L{AmpBox}es,
     
    728729    @type boxSender: L{IBoxSender}
    729730    """
    730731
    731     implements(IBoxReceiver)
    732 
    733732    _failAllReason = None
    734733    _outstandingRequests = None
    735     _counter = 0L
     734    _counter = 0
    736735    boxSender = None
    737736
    738737    def __init__(self, locator):
     
    10121011
    10131012
    10141013
     1014@implementer(IResponderLocator)
    10151015class CommandLocator:
    10161016    """
    10171017    A L{CommandLocator} is a collection of responders to AMP L{Command}s, with
     
    10591059            return subcls
    10601060
    10611061
    1062     implements(IResponderLocator)
    1063 
    1064 
    10651062    def _wrapWithSerialization(self, aCallable, command):
    10661063        """
    10671064        Wrap aCallable with its command's argument de-serialization
     
    11371134
    11381135
    11391136
     1137@implementer(IResponderLocator)
    11401138class SimpleStringLocator(object):
    11411139    """
    11421140    Implement the L{locateResponder} method to do simple, string-based
    11431141    dispatch.
    11441142    """
    11451143
    1146     implements(IResponderLocator)
    1147 
    11481144    baseDispatchPrefix = 'amp_'
    11491145
    11501146    def locateResponder(self, name):
     
    12001196
    12011197
    12021198
     1199@implementer(IArgumentType)
    12031200class Argument:
    12041201    """
    12051202    Base-class of all objects that take values from Amp packets and convert
     
    12101207    which will be used to define the behavior of L{IArgumentType.toBox} and
    12111208    L{IArgumentType.fromBox}, respectively.
    12121209    """
    1213     implements(IArgumentType)
    12141210
    12151211    optional = False
    12161212
     
    20622058
    20632059
    20642060
     2061@implementer(IFileDescriptorReceiver)
    20652062class _DescriptorExchanger(object):
    20662063    """
    20672064    L{_DescriptorExchanger} is a mixin for L{BinaryBoxProtocol} which adds
     
    20842081        ordinals, starting from 0.  This is used to construct values for
    20852082        C{fileDescriptorReceived}.
    20862083    """
    2087     implements(IFileDescriptorReceiver)
    20882084
    20892085    def __init__(self):
    20902086        self._descriptors = {}
     
    21132109
    21142110
    21152111
     2112@implementer(IBoxSender)
    21162113class BinaryBoxProtocol(StatefulStringProtocol, Int16StringReceiver,
    21172114                        _DescriptorExchanger):
    21182115    """
     
    21462143    method will be invoked for each L{AmpBox} that is received.
    21472144    """
    21482145
    2149     implements(IBoxSender)
    2150 
    21512146    _justStartedTLS = False
    21522147    _startingTLSBuffer = None
    21532148    _locked = False
  • twisted/python/dist3.py

     
    138138    "twisted.positioning.ipositioning",
    139139    "twisted.positioning.nmea",
    140140    "twisted.protocols",
     141    "twisted.protocols.amp",
    141142    "twisted.protocols.basic",
    142143    "twisted.protocols.policies",
    143144    "twisted.protocols.test",
     
    310311    "twisted.python.test.test_versions",
    311312    "twisted.python.test.test_zippath",
    312313    "twisted.test.test_abstract",
     314    "twisted.test.test_amp",
    313315    "twisted.test.test_application",
    314316    "twisted.test.test_compat",
    315317    "twisted.test.test_context",
  • twisted/test/test_amp.py

     
    99import datetime
    1010import decimal
    1111
    12 from zope.interface import implements
     12from zope.interface import implementer
    1313from zope.interface.verify import verifyClass, verifyObject
    1414
    1515from twisted.python import filepath
     
    16821682        if spuriousTraffic:
    16831683            self.assertRaises(amp.ProtocolSwitched, c.sendHello, 'world')
    16841684
    1685         def cbConnsLost(((serverSuccess, serverData),
    1686                          (clientSuccess, clientData))):
     1685        def cbConnsLost(data):
     1686            ((serverSuccess, serverData), (clientSuccess, clientData)) = data
    16871687            self.failUnless(serverSuccess)
    16881688            self.failUnless(clientSuccess)
    16891689            self.assertEqual(''.join(serverData), SWITCH_CLIENT_DATA)
     
    29382938        self.assertEqual(objects, {'omitted': None})
    29392939
    29402940
    2941 
     2941@implementer(interfaces.IUNIXTransport)
    29422942class UNIXStringTransport(object):
    29432943    """
    29442944    An in-memory implementation of L{interfaces.IUNIXTransport} which collects
     
    29482948        eg via C{write} or C{sendFileDescriptor}.  Elements are two-tuples of a
    29492949        string (identifying the destination of the data) and the data itself.
    29502950    """
    2951     implements(interfaces.IUNIXTransport)
    29522951
    29532952    def __init__(self, descriptorFuzz):
    29542953        """