Change to use super() instead of the old py2 style everywhere
This commit is contained in:
parent
55237f20a7
commit
5859de7054
33 changed files with 69 additions and 70 deletions
|
|
@ -177,14 +177,14 @@ class Compressed(amp.String):
|
|||
Note: In Py3 this is really a byte stream.
|
||||
|
||||
"""
|
||||
return zlib.compress(super(Compressed, self).toString(inObject), 9)
|
||||
return zlib.compress(super().toString(inObject), 9)
|
||||
|
||||
def fromString(self, inString):
|
||||
"""
|
||||
Convert (decompress) from the string-representation on the wire to Python.
|
||||
|
||||
"""
|
||||
return super(Compressed, self).fromString(zlib.decompress(inString))
|
||||
return super().fromString(zlib.decompress(inString))
|
||||
|
||||
|
||||
class MsgLauncher2Portal(amp.Command):
|
||||
|
|
@ -313,7 +313,7 @@ class AMPMultiConnectionProtocol(amp.AMP):
|
|||
self.send_task = None
|
||||
self.multibatches = 0
|
||||
# later twisted amp has its own __init__
|
||||
super(AMPMultiConnectionProtocol, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def _commandReceived(self, box):
|
||||
"""
|
||||
|
|
@ -368,7 +368,7 @@ class AMPMultiConnectionProtocol(amp.AMP):
|
|||
# an incomplete AMP box means more batches are forthcoming.
|
||||
self.multibatches += 1
|
||||
try:
|
||||
super(AMPMultiConnectionProtocol, self).dataReceived(data)
|
||||
super().dataReceived(data)
|
||||
except KeyError:
|
||||
_get_logger().log_trace(
|
||||
"Discarded incoming partial (packed) data (len {})".format(len(data))
|
||||
|
|
@ -379,7 +379,7 @@ class AMPMultiConnectionProtocol(amp.AMP):
|
|||
# end of existing multibatch
|
||||
self.multibatches = max(0, self.multibatches - 1)
|
||||
try:
|
||||
super(AMPMultiConnectionProtocol, self).dataReceived(data)
|
||||
super().dataReceived(data)
|
||||
except KeyError:
|
||||
_get_logger().log_trace(
|
||||
"Discarded incoming multi-batch (packed) data (len {})".format(len(data))
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class AMPServerProtocol(amp.AMPMultiConnectionProtocol):
|
|||
|
||||
"""
|
||||
# wipe broadcast and data memory
|
||||
super(AMPServerProtocol, self).connectionLost(reason)
|
||||
super().connectionLost(reason)
|
||||
if self.factory.server_connection == self:
|
||||
self.factory.server_connection = None
|
||||
self.factory.portal.server_info_dict = {}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class SSLProtocol(TelnetProtocol):
|
|||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(SSLProtocol, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
self.protocol_key = "telnet/ssl"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class TestAMPServer(TwistedTestCase):
|
|||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(TestAMPServer, self).setUp()
|
||||
super().setUp()
|
||||
portal = Mock()
|
||||
factory = AMPServerFactory(portal)
|
||||
self.proto = factory.buildProtocol(("localhost", 0))
|
||||
|
|
@ -217,7 +217,7 @@ class TestIRC(TestCase):
|
|||
|
||||
class TestTelnet(TwistedTestCase):
|
||||
def setUp(self):
|
||||
super(TestTelnet, self).setUp()
|
||||
super().setUp()
|
||||
factory = TelnetServerFactory()
|
||||
factory.protocol = TelnetProtocol
|
||||
factory.sessionhandler = PORTAL_SESSIONS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue