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
|
|
@ -108,7 +108,7 @@ class AMPServerClientProtocol(amp.AMPMultiConnectionProtocol):
|
|||
"""
|
||||
# print("AMPClient new connection {}".format(self))
|
||||
info_dict = self.factory.server.get_info_dict()
|
||||
super(AMPServerClientProtocol, self).connectionMade()
|
||||
super().connectionMade()
|
||||
# first thing we do is to request the Portal to sync all sessions
|
||||
# back with the Server side. We also need the startup mode (reload, reset, shutdown)
|
||||
self.send_AdminServer2Portal(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class ServerSession(_BASE_SESSION_CLASS):
|
|||
if not _ObjectDB:
|
||||
from evennia.objects.models import ObjectDB as _ObjectDB
|
||||
|
||||
super(ServerSession, self).at_sync()
|
||||
super().at_sync()
|
||||
if not self.logged_in:
|
||||
# assign the unloggedin-command set.
|
||||
self.cmdset_storage = settings.CMDSET_UNLOGGEDIN
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ DelayedCall.debug = True
|
|||
# MagicMock(return_value=create.account("TestAMPAccount", "test@test.com", "testpassword")))
|
||||
class _TestAMP(TwistedTestCase):
|
||||
def setUp(self):
|
||||
super(_TestAMP, self).setUp()
|
||||
super().setUp()
|
||||
self.account = mommy.make("accounts.AccountDB", id=1)
|
||||
self.server = server.Evennia(MagicMock())
|
||||
self.server.sessions.data_in = MagicMock()
|
||||
|
|
@ -47,7 +47,7 @@ class _TestAMP(TwistedTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.account.delete()
|
||||
super(_TestAMP, self).tearDown()
|
||||
super().tearDown()
|
||||
|
||||
def _connect_client(self, mocktransport):
|
||||
"Setup client to send data for testing"
|
||||
|
|
|
|||
|
|
@ -32,6 +32,6 @@ class EvenniaTestSuiteRunner(DiscoverRunner):
|
|||
import evennia
|
||||
|
||||
evennia._init()
|
||||
return super(EvenniaTestSuiteRunner, self).build_suite(
|
||||
return super().build_suite(
|
||||
test_labels, extra_tests=extra_tests, **kwargs
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue