Use Python 3's new super() convention.
This commit is contained in:
parent
0cd979327b
commit
cd21fb2396
52 changed files with 164 additions and 164 deletions
|
|
@ -381,7 +381,7 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)):
|
||||||
self.attributes.clear()
|
self.attributes.clear()
|
||||||
self.nicks.clear()
|
self.nicks.clear()
|
||||||
self.aliases.clear()
|
self.aliases.clear()
|
||||||
super(DefaultAccount, self).delete(*args, **kwargs)
|
super().delete(*args, **kwargs)
|
||||||
# methods inherited from database model
|
# methods inherited from database model
|
||||||
|
|
||||||
def msg(self, text=None, from_obj=None, session=None, options=None, **kwargs):
|
def msg(self, text=None, from_obj=None, session=None, options=None, **kwargs):
|
||||||
|
|
@ -529,7 +529,7 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)):
|
||||||
result (bool): Result of access check.
|
result (bool): Result of access check.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
result = super(DefaultAccount, self).access(accessing_obj, access_type=access_type,
|
result = super().access(accessing_obj, access_type=access_type,
|
||||||
default=default, no_superuser_bypass=no_superuser_bypass)
|
default=default, no_superuser_bypass=no_superuser_bypass)
|
||||||
self.at_access(result, accessing_obj, access_type, **kwargs)
|
self.at_access(result, accessing_obj, access_type, **kwargs)
|
||||||
return result
|
return result
|
||||||
|
|
@ -979,7 +979,7 @@ class DefaultGuest(DefaultAccount):
|
||||||
We repeat the functionality of `at_disconnect()` here just to
|
We repeat the functionality of `at_disconnect()` here just to
|
||||||
be on the safe side.
|
be on the safe side.
|
||||||
"""
|
"""
|
||||||
super(DefaultGuest, self).at_server_shutdown()
|
super().at_server_shutdown()
|
||||||
characters = self.db._playable_characters
|
characters = self.db._playable_characters
|
||||||
for character in characters:
|
for character in characters:
|
||||||
if character:
|
if character:
|
||||||
|
|
@ -995,7 +995,7 @@ class DefaultGuest(DefaultAccount):
|
||||||
overriding the call (unused by default).
|
overriding the call (unused by default).
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(DefaultGuest, self).at_post_disconnect()
|
super().at_post_disconnect()
|
||||||
characters = self.db._playable_characters
|
characters = self.db._playable_characters
|
||||||
for character in characters:
|
for character in characters:
|
||||||
if character:
|
if character:
|
||||||
|
|
|
||||||
|
|
@ -118,14 +118,14 @@ class Bot(DefaultAccount):
|
||||||
Evennia -> outgoing protocol
|
Evennia -> outgoing protocol
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(Bot, self).msg(text=text, from_obj=from_obj, session=session, options=options, **kwargs)
|
super().msg(text=text, from_obj=from_obj, session=session, options=options, **kwargs)
|
||||||
|
|
||||||
def execute_cmd(self, raw_string, session=None):
|
def execute_cmd(self, raw_string, session=None):
|
||||||
"""
|
"""
|
||||||
Incoming protocol -> Evennia
|
Incoming protocol -> Evennia
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(Bot, self).msg(raw_string, session=session)
|
super().msg(raw_string, session=session)
|
||||||
|
|
||||||
def at_server_shutdown(self):
|
def at_server_shutdown(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -226,7 +226,7 @@ class IRCBot(Bot):
|
||||||
if not hasattr(self, "_nicklist_callers"):
|
if not hasattr(self, "_nicklist_callers"):
|
||||||
self._nicklist_callers = []
|
self._nicklist_callers = []
|
||||||
self._nicklist_callers.append(caller)
|
self._nicklist_callers.append(caller)
|
||||||
super(IRCBot, self).msg(request_nicklist="")
|
super().msg(request_nicklist="")
|
||||||
return
|
return
|
||||||
|
|
||||||
def ping(self, caller):
|
def ping(self, caller):
|
||||||
|
|
@ -240,7 +240,7 @@ class IRCBot(Bot):
|
||||||
if not hasattr(self, "_ping_callers"):
|
if not hasattr(self, "_ping_callers"):
|
||||||
self._ping_callers = []
|
self._ping_callers = []
|
||||||
self._ping_callers.append(caller)
|
self._ping_callers.append(caller)
|
||||||
super(IRCBot, self).msg(ping="")
|
super().msg(ping="")
|
||||||
|
|
||||||
def reconnect(self):
|
def reconnect(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -248,7 +248,7 @@ class IRCBot(Bot):
|
||||||
having to destroy/recreate the bot "account".
|
having to destroy/recreate the bot "account".
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(IRCBot, self).msg(reconnect="")
|
super().msg(reconnect="")
|
||||||
|
|
||||||
def msg(self, text=None, **kwargs):
|
def msg(self, text=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
@ -270,7 +270,7 @@ class IRCBot(Bot):
|
||||||
self.ndb.ev_channel = self.db.ev_channel
|
self.ndb.ev_channel = self.db.ev_channel
|
||||||
if "from_channel" in options and text and self.ndb.ev_channel.dbid == options["from_channel"]:
|
if "from_channel" in options and text and self.ndb.ev_channel.dbid == options["from_channel"]:
|
||||||
if not from_obj or from_obj != [self]:
|
if not from_obj or from_obj != [self]:
|
||||||
super(IRCBot, self).msg(channel=text)
|
super().msg(channel=text)
|
||||||
|
|
||||||
def execute_cmd(self, session=None, txt=None, **kwargs):
|
def execute_cmd(self, session=None, txt=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
@ -336,7 +336,7 @@ class IRCBot(Bot):
|
||||||
text = "This is an Evennia IRC bot connecting from '%s'." % settings.SERVERNAME
|
text = "This is an Evennia IRC bot connecting from '%s'." % settings.SERVERNAME
|
||||||
else:
|
else:
|
||||||
text = "I understand 'who' and 'about'."
|
text = "I understand 'who' and 'about'."
|
||||||
super(IRCBot, self).msg(privmsg=((text,), {"user": user}))
|
super().msg(privmsg=((text,), {"user": user}))
|
||||||
else:
|
else:
|
||||||
# something to send to the main channel
|
# something to send to the main channel
|
||||||
if kwargs["type"] == "action":
|
if kwargs["type"] == "action":
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class _CmdSetMeta(type):
|
||||||
if not isinstance(cls.key_mergetypes, dict):
|
if not isinstance(cls.key_mergetypes, dict):
|
||||||
cls.key_mergetypes = {}
|
cls.key_mergetypes = {}
|
||||||
|
|
||||||
super(_CmdSetMeta, cls).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class CmdSet(with_metaclass(_CmdSetMeta, object)):
|
class CmdSet(with_metaclass(_CmdSetMeta, object)):
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ class CommandMeta(type):
|
||||||
"""
|
"""
|
||||||
def __init__(cls, *args, **kwargs):
|
def __init__(cls, *args, **kwargs):
|
||||||
_init_command(cls, **kwargs)
|
_init_command(cls, **kwargs)
|
||||||
super(CommandMeta, cls).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
# The Command class is the basic unit of an Evennia command; when
|
# The Command class is the basic unit of an Evennia command; when
|
||||||
# defining new commands, the admin subclass this class and
|
# defining new commands, the admin subclass this class and
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class MuxAccountLookCommand(COMMAND_DEFAULT_CLASS):
|
||||||
def parse(self):
|
def parse(self):
|
||||||
"""Custom parsing"""
|
"""Custom parsing"""
|
||||||
|
|
||||||
super(MuxAccountLookCommand, self).parse()
|
super().parse()
|
||||||
|
|
||||||
if _MULTISESSION_MODE < 2:
|
if _MULTISESSION_MODE < 2:
|
||||||
# only one character allowed - not used in this mode
|
# only one character allowed - not used in this mode
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ class ObjManipCommand(COMMAND_DEFAULT_CLASS):
|
||||||
the cases, see the module doc.
|
the cases, see the module doc.
|
||||||
"""
|
"""
|
||||||
# get all the normal parsing done (switches etc)
|
# get all the normal parsing done (switches etc)
|
||||||
super(ObjManipCommand, self).parse()
|
super().parse()
|
||||||
|
|
||||||
obj_defs = ([], []) # stores left- and right-hand side of '='
|
obj_defs = ([], []) # stores left- and right-hand side of '='
|
||||||
obj_attrs = ([], []) # "
|
obj_attrs = ([], []) # "
|
||||||
|
|
@ -1079,7 +1079,7 @@ class CmdUnLink(CmdLink):
|
||||||
self.rhs = ""
|
self.rhs = ""
|
||||||
|
|
||||||
# call the @link functionality
|
# call the @link functionality
|
||||||
super(CmdUnLink, self).func()
|
super().func()
|
||||||
|
|
||||||
|
|
||||||
class CmdSetHome(CmdLink):
|
class CmdSetHome(CmdLink):
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class MuxCommand(Command):
|
||||||
We just show it here for completeness - we
|
We just show it here for completeness - we
|
||||||
are satisfied using the default check in Command.
|
are satisfied using the default check in Command.
|
||||||
"""
|
"""
|
||||||
return super(MuxCommand, self).has_perm(srcobj)
|
return super().has_perm(srcobj)
|
||||||
|
|
||||||
def at_pre_cmd(self):
|
def at_pre_cmd(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -197,7 +197,7 @@ class MuxAccountCommand(MuxCommand):
|
||||||
"""
|
"""
|
||||||
We run the parent parser as usual, then fix the result
|
We run the parent parser as usual, then fix the result
|
||||||
"""
|
"""
|
||||||
super(MuxAccountCommand, self).parse()
|
super().parse()
|
||||||
|
|
||||||
if utils.inherits_from(self.caller, "evennia.objects.objects.DefaultObject"):
|
if utils.inherits_from(self.caller, "evennia.objects.objects.DefaultObject"):
|
||||||
# caller is an Object/Character
|
# caller is an Object/Character
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,7 @@ class TestBuilding(CommandTest):
|
||||||
class TestComms(CommandTest):
|
class TestComms(CommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(CommandTest, self).setUp()
|
super().setUp()
|
||||||
self.call(comms.CmdChannelCreate(), "testchan;test=Test Channel", "Created channel testchan and connected to it.", receiver=self.account)
|
self.call(comms.CmdChannelCreate(), "testchan;test=Test Channel", "Created channel testchan and connected to it.", receiver=self.account)
|
||||||
|
|
||||||
def test_toggle_com(self):
|
def test_toggle_com(self):
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class _CmdA(Command):
|
||||||
key = "A"
|
key = "A"
|
||||||
|
|
||||||
def __init__(self, cmdset, *args, **kwargs):
|
def __init__(self, cmdset, *args, **kwargs):
|
||||||
super(_CmdA, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.from_cmdset = cmdset
|
self.from_cmdset = cmdset
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ class _CmdB(Command):
|
||||||
key = "B"
|
key = "B"
|
||||||
|
|
||||||
def __init__(self, cmdset, *args, **kwargs):
|
def __init__(self, cmdset, *args, **kwargs):
|
||||||
super(_CmdB, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.from_cmdset = cmdset
|
self.from_cmdset = cmdset
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ class _CmdC(Command):
|
||||||
key = "C"
|
key = "C"
|
||||||
|
|
||||||
def __init__(self, cmdset, *args, **kwargs):
|
def __init__(self, cmdset, *args, **kwargs):
|
||||||
super(_CmdC, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.from_cmdset = cmdset
|
self.from_cmdset = cmdset
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ class _CmdD(Command):
|
||||||
key = "D"
|
key = "D"
|
||||||
|
|
||||||
def __init__(self, cmdset, *args, **kwargs):
|
def __init__(self, cmdset, *args, **kwargs):
|
||||||
super(_CmdD, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.from_cmdset = cmdset
|
self.from_cmdset = cmdset
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ class TestCmdSetMergers(TestCase):
|
||||||
"Test merging of cmdsets"
|
"Test merging of cmdsets"
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCmdSetMergers, self).setUp()
|
super().setUp()
|
||||||
self.cmdset_a = _CmdSetA()
|
self.cmdset_a = _CmdSetA()
|
||||||
self.cmdset_b = _CmdSetB()
|
self.cmdset_b = _CmdSetB()
|
||||||
self.cmdset_c = _CmdSetC()
|
self.cmdset_c = _CmdSetC()
|
||||||
|
|
@ -272,7 +272,7 @@ class TestGetAndMergeCmdSets(TwistedTestCase, EvenniaTest):
|
||||||
"Test the cmdhandler.get_and_merge_cmdsets function."
|
"Test the cmdhandler.get_and_merge_cmdsets function."
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestGetAndMergeCmdSets, self).setUp()
|
super().setUp()
|
||||||
self.cmdset_a = _CmdSetA()
|
self.cmdset_a = _CmdSetA()
|
||||||
self.cmdset_b = _CmdSetB()
|
self.cmdset_b = _CmdSetB()
|
||||||
self.cmdset_c = _CmdSetC()
|
self.cmdset_c = _CmdSetC()
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class ChannelAdmin(admin.ModelAdmin):
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
return HttpResponseRedirect(reverse("admin:comms_channeldb_change", args=[obj.id]))
|
return HttpResponseRedirect(reverse("admin:comms_channeldb_change", args=[obj.id]))
|
||||||
return super(ChannelAdmin, self).response_add(request, obj, post_url_continue)
|
return super().response_add(request, obj, post_url_continue)
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(ChannelDB, ChannelAdmin)
|
admin.site.register(ChannelDB, ChannelAdmin)
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ class DefaultChannel(with_metaclass(TypeclassBase, ChannelDB)):
|
||||||
"""
|
"""
|
||||||
self.attributes.clear()
|
self.attributes.clear()
|
||||||
self.aliases.clear()
|
self.aliases.clear()
|
||||||
super(DefaultChannel, self).delete()
|
super().delete()
|
||||||
from evennia.comms.channelhandler import CHANNELHANDLER
|
from evennia.comms.channelhandler import CHANNELHANDLER
|
||||||
CHANNELHANDLER.update()
|
CHANNELHANDLER.update()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ class CmdOOCLook(default_cmds.CmdLook):
|
||||||
# not ooc mode - leave back to normal look
|
# not ooc mode - leave back to normal look
|
||||||
# we have to put this back for normal look to work.
|
# we have to put this back for normal look to work.
|
||||||
self.caller = self.character
|
self.caller = self.character
|
||||||
super(CmdOOCLook, self).func()
|
super().func()
|
||||||
|
|
||||||
|
|
||||||
class CmdOOCCharacterCreate(Command):
|
class CmdOOCCharacterCreate(Command):
|
||||||
|
|
|
||||||
|
|
@ -684,7 +684,7 @@ class ClothedCharacterCmdSet(default_cmds.CharacterCmdSet):
|
||||||
"""
|
"""
|
||||||
Populates the cmdset
|
Populates the cmdset
|
||||||
"""
|
"""
|
||||||
super(ClothedCharacterCmdSet, self).at_cmdset_creation()
|
super().at_cmdset_creation()
|
||||||
#
|
#
|
||||||
# any commands you add below will overload the default ones.
|
# any commands you add below will overload the default ones.
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class EvenniaGameIndexService(Service):
|
||||||
self.loop = LoopingCall(self.client.send_game_details)
|
self.loop = LoopingCall(self.client.send_game_details)
|
||||||
|
|
||||||
def startService(self):
|
def startService(self):
|
||||||
super(EvenniaGameIndexService, self).startService()
|
super().startService()
|
||||||
# TODO: Check to make sure that the client is configured.
|
# TODO: Check to make sure that the client is configured.
|
||||||
# Start the loop, but only after a short delay. This allows the
|
# Start the loop, but only after a short delay. This allows the
|
||||||
# portal and the server time to sync up as far as total player counts.
|
# portal and the server time to sync up as far as total player counts.
|
||||||
|
|
@ -38,7 +38,7 @@ class EvenniaGameIndexService(Service):
|
||||||
if self.running == 0:
|
if self.running == 0:
|
||||||
# @reload errors if we've stopped this service.
|
# @reload errors if we've stopped this service.
|
||||||
return
|
return
|
||||||
super(EvenniaGameIndexService, self).stopService()
|
super().stopService()
|
||||||
if self.loop.running:
|
if self.loop.running:
|
||||||
self.loop.stop()
|
self.loop.stop()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ class CmdUnconnectedCreate(MuxCommand):
|
||||||
name enclosed in quotes:
|
name enclosed in quotes:
|
||||||
connect "Long name with many words" my@myserv.com mypassw
|
connect "Long name with many words" my@myserv.com mypassw
|
||||||
"""
|
"""
|
||||||
super(CmdUnconnectedCreate, self).parse()
|
super().parse()
|
||||||
|
|
||||||
self.accountinfo = []
|
self.accountinfo = []
|
||||||
if len(self.arglist) < 3:
|
if len(self.arglist) < 3:
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,7 @@ class ExtendedRoom(DefaultRoom):
|
||||||
# and re-save the description again.
|
# and re-save the description again.
|
||||||
self.db.desc = self.replace_timeslots(self.db.raw_desc, curr_timeslot)
|
self.db.desc = self.replace_timeslots(self.db.raw_desc, curr_timeslot)
|
||||||
# run the normal return_appearance method, now that desc is updated.
|
# run the normal return_appearance method, now that desc is updated.
|
||||||
return super(ExtendedRoom, self).return_appearance(looker)
|
return super().return_appearance(looker)
|
||||||
|
|
||||||
|
|
||||||
# Custom Look command supporting Room details. Add this to
|
# Custom Look command supporting Room details. Add this to
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ class GenderCharacter(DefaultCharacter):
|
||||||
"""
|
"""
|
||||||
Called once when the object is created.
|
Called once when the object is created.
|
||||||
"""
|
"""
|
||||||
super(GenderCharacter, self).at_object_creation()
|
super().at_object_creation()
|
||||||
self.db.gender = "ambiguous"
|
self.db.gender = "ambiguous"
|
||||||
|
|
||||||
def _get_pronoun(self, regex_match):
|
def _get_pronoun(self, regex_match):
|
||||||
|
|
@ -139,4 +139,4 @@ class GenderCharacter(DefaultCharacter):
|
||||||
text = _RE_GENDER_PRONOUN.sub(self._get_pronoun, text)
|
text = _RE_GENDER_PRONOUN.sub(self._get_pronoun, text)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
super(GenderCharacter, self).msg(text, from_obj=from_obj, session=session, **kwargs)
|
super().msg(text, from_obj=from_obj, session=session, **kwargs)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class TestEventHandler(EvenniaTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Create the event handler."""
|
"""Create the event handler."""
|
||||||
super(TestEventHandler, self).setUp()
|
super().setUp()
|
||||||
self.handler = create_script(
|
self.handler = create_script(
|
||||||
"evennia.contrib.ingame_python.scripts.EventHandler")
|
"evennia.contrib.ingame_python.scripts.EventHandler")
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ class TestEventHandler(EvenniaTest):
|
||||||
OLD_EVENTS.update(self.handler.ndb.events)
|
OLD_EVENTS.update(self.handler.ndb.events)
|
||||||
self.handler.stop()
|
self.handler.stop()
|
||||||
CallbackHandler.script = None
|
CallbackHandler.script = None
|
||||||
super(TestEventHandler, self).tearDown()
|
super().tearDown()
|
||||||
|
|
||||||
def test_start(self):
|
def test_start(self):
|
||||||
"""Simply make sure the handler runs with proper initial values."""
|
"""Simply make sure the handler runs with proper initial values."""
|
||||||
|
|
@ -248,7 +248,7 @@ class TestCmdCallback(CommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Create the callback handler."""
|
"""Create the callback handler."""
|
||||||
super(TestCmdCallback, self).setUp()
|
super().setUp()
|
||||||
self.handler = create_script(
|
self.handler = create_script(
|
||||||
"evennia.contrib.ingame_python.scripts.EventHandler")
|
"evennia.contrib.ingame_python.scripts.EventHandler")
|
||||||
|
|
||||||
|
|
@ -273,7 +273,7 @@ class TestCmdCallback(CommandTest):
|
||||||
script.stop()
|
script.stop()
|
||||||
|
|
||||||
CallbackHandler.script = None
|
CallbackHandler.script = None
|
||||||
super(TestCmdCallback, self).tearDown()
|
super().tearDown()
|
||||||
|
|
||||||
def test_list(self):
|
def test_list(self):
|
||||||
"""Test listing callbacks with different rights."""
|
"""Test listing callbacks with different rights."""
|
||||||
|
|
@ -413,7 +413,7 @@ class TestDefaultCallbacks(CommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Create the callback handler."""
|
"""Create the callback handler."""
|
||||||
super(TestDefaultCallbacks, self).setUp()
|
super().setUp()
|
||||||
self.handler = create_script(
|
self.handler = create_script(
|
||||||
"evennia.contrib.ingame_python.scripts.EventHandler")
|
"evennia.contrib.ingame_python.scripts.EventHandler")
|
||||||
|
|
||||||
|
|
@ -434,7 +434,7 @@ class TestDefaultCallbacks(CommandTest):
|
||||||
OLD_EVENTS.update(self.handler.ndb.events)
|
OLD_EVENTS.update(self.handler.ndb.events)
|
||||||
self.handler.stop()
|
self.handler.stop()
|
||||||
CallbackHandler.script = None
|
CallbackHandler.script = None
|
||||||
super(TestDefaultCallbacks, self).tearDown()
|
super().tearDown()
|
||||||
|
|
||||||
def test_exit(self):
|
def test_exit(self):
|
||||||
"""Test the callbacks of an exit."""
|
"""Test the callbacks of an exit."""
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ class EventCharacter(DefaultCharacter):
|
||||||
if not string:
|
if not string:
|
||||||
return
|
return
|
||||||
|
|
||||||
super(EventCharacter, self).announce_move_from(destination, msg=string, mapping=mapping)
|
super().announce_move_from(destination, msg=string, mapping=mapping)
|
||||||
|
|
||||||
def announce_move_to(self, source_location, msg=None, mapping=None):
|
def announce_move_to(self, source_location, msg=None, mapping=None):
|
||||||
"""
|
"""
|
||||||
|
|
@ -278,7 +278,7 @@ class EventCharacter(DefaultCharacter):
|
||||||
if not string:
|
if not string:
|
||||||
return
|
return
|
||||||
|
|
||||||
super(EventCharacter, self).announce_move_to(source_location, msg=string, mapping=mapping)
|
super().announce_move_to(source_location, msg=string, mapping=mapping)
|
||||||
|
|
||||||
def at_before_move(self, destination):
|
def at_before_move(self, destination):
|
||||||
"""
|
"""
|
||||||
|
|
@ -328,7 +328,7 @@ class EventCharacter(DefaultCharacter):
|
||||||
source_location (Object): Wwhere we came from. This may be `None`.
|
source_location (Object): Wwhere we came from. This may be `None`.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(EventCharacter, self).at_after_move(source_location)
|
super().at_after_move(source_location)
|
||||||
|
|
||||||
origin = source_location
|
origin = source_location
|
||||||
destination = self.location
|
destination = self.location
|
||||||
|
|
@ -367,7 +367,7 @@ class EventCharacter(DefaultCharacter):
|
||||||
puppeting this Object.
|
puppeting this Object.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(EventCharacter, self).at_post_puppet()
|
super().at_post_puppet()
|
||||||
|
|
||||||
self.callbacks.call("puppeted", self)
|
self.callbacks.call("puppeted", self)
|
||||||
|
|
||||||
|
|
@ -395,7 +395,7 @@ class EventCharacter(DefaultCharacter):
|
||||||
if location and isinstance(location, DefaultRoom):
|
if location and isinstance(location, DefaultRoom):
|
||||||
location.callbacks.call("unpuppeted_in", self, location)
|
location.callbacks.call("unpuppeted_in", self, location)
|
||||||
|
|
||||||
super(EventCharacter, self).at_pre_unpuppet()
|
super().at_pre_unpuppet()
|
||||||
|
|
||||||
def at_before_say(self, message, **kwargs):
|
def at_before_say(self, message, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
@ -482,7 +482,7 @@ class EventCharacter(DefaultCharacter):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
super(EventCharacter, self).at_say(message, **kwargs)
|
super().at_say(message, **kwargs)
|
||||||
location = getattr(self, "location", None)
|
location = getattr(self, "location", None)
|
||||||
location = location if location and inherits_from(location, "evennia.objects.objects.DefaultRoom") else None
|
location = location if location and inherits_from(location, "evennia.objects.objects.DefaultRoom") else None
|
||||||
|
|
||||||
|
|
@ -624,7 +624,7 @@ class EventExit(DefaultExit):
|
||||||
if not allow:
|
if not allow:
|
||||||
return
|
return
|
||||||
|
|
||||||
super(EventExit, self).at_traverse(traversing_object, target_location)
|
super().at_traverse(traversing_object, target_location)
|
||||||
|
|
||||||
# After traversing
|
# After traversing
|
||||||
if is_character:
|
if is_character:
|
||||||
|
|
@ -703,7 +703,7 @@ class EventObject(DefaultObject):
|
||||||
permissions for that.
|
permissions for that.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(EventObject, self).at_get(getter)
|
super().at_get(getter)
|
||||||
self.callbacks.call("get", getter, self)
|
self.callbacks.call("get", getter, self)
|
||||||
|
|
||||||
def at_drop(self, dropper):
|
def at_drop(self, dropper):
|
||||||
|
|
@ -719,7 +719,7 @@ class EventObject(DefaultObject):
|
||||||
permissions from that.
|
permissions from that.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(EventObject, self).at_drop(dropper)
|
super().at_drop(dropper)
|
||||||
self.callbacks.call("drop", dropper, self)
|
self.callbacks.call("drop", dropper, self)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ Verbose Installation Instructions:
|
||||||
Change "class Character(DefaultCharacter):" to
|
Change "class Character(DefaultCharacter):" to
|
||||||
`class Character(ContribRPCharacter):`
|
`class Character(ContribRPCharacter):`
|
||||||
If you have any overriden calls in `at_object_creation(self)`:
|
If you have any overriden calls in `at_object_creation(self)`:
|
||||||
Add `super(Character,self).at_object_creation()` as the top line.
|
Add `super().at_object_creation()` as the top line.
|
||||||
2. In `typeclasses/rooms.py`:
|
2. In `typeclasses/rooms.py`:
|
||||||
Import the `ContribRPRoom` class:
|
Import the `ContribRPRoom` class:
|
||||||
`from evennia.contrib.rpsystem import ContribRPRoom`
|
`from evennia.contrib.rpsystem import ContribRPRoom`
|
||||||
|
|
@ -1139,7 +1139,7 @@ class ContribRPObject(DefaultObject):
|
||||||
"""
|
"""
|
||||||
Called at initial creation.
|
Called at initial creation.
|
||||||
"""
|
"""
|
||||||
super(ContribRPObject, self).at_object_creation
|
super().at_object_creation()
|
||||||
|
|
||||||
# emoting/recog data
|
# emoting/recog data
|
||||||
self.db.pose = ""
|
self.db.pose = ""
|
||||||
|
|
@ -1423,7 +1423,7 @@ class ContribRPCharacter(DefaultCharacter, ContribRPObject):
|
||||||
"""
|
"""
|
||||||
Called at initial creation.
|
Called at initial creation.
|
||||||
"""
|
"""
|
||||||
super(ContribRPCharacter, self).at_object_creation()
|
super().at_object_creation()
|
||||||
|
|
||||||
self.db._sdesc = ""
|
self.db._sdesc = ""
|
||||||
self.db._sdesc_regex = ""
|
self.db._sdesc_regex = ""
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,8 @@ class SimpleDoor(DefaultExit):
|
||||||
"""
|
"""
|
||||||
# we have to be careful to avoid a delete-loop.
|
# we have to be careful to avoid a delete-loop.
|
||||||
if self.db.return_exit:
|
if self.db.return_exit:
|
||||||
super(SimpleDoor, self.db.return_exit).delete()
|
super().delete()
|
||||||
super(SimpleDoor, self).delete()
|
super().delete()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def at_failed_traverse(self, traversing_object):
|
def at_failed_traverse(self, traversing_object):
|
||||||
|
|
@ -103,7 +103,7 @@ class CmdOpen(default_cmds.CmdOpen):
|
||||||
Simple wrapper for the default CmdOpen.create_exit
|
Simple wrapper for the default CmdOpen.create_exit
|
||||||
"""
|
"""
|
||||||
# create a new exit as normal
|
# create a new exit as normal
|
||||||
new_exit = super(CmdOpen, self).create_exit(exit_name, location, destination,
|
new_exit = super().create_exit(exit_name, location, destination,
|
||||||
exit_aliases=exit_aliases, typeclass=typeclass)
|
exit_aliases=exit_aliases, typeclass=typeclass)
|
||||||
if hasattr(self, "return_exit_already_created"):
|
if hasattr(self, "return_exit_already_created"):
|
||||||
# we don't create a return exit if it was already created (because
|
# we don't create a return exit if it was already created (because
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ text = "Automated testing is advantageous for a number of reasons:" \
|
||||||
|
|
||||||
class TestLanguage(EvenniaTest):
|
class TestLanguage(EvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestLanguage, self).setUp()
|
super().setUp()
|
||||||
rplanguage.add_language(key="testlang",
|
rplanguage.add_language(key="testlang",
|
||||||
word_length_variance=1,
|
word_length_variance=1,
|
||||||
noun_prefix="bara",
|
noun_prefix="bara",
|
||||||
|
|
@ -35,7 +35,7 @@ class TestLanguage(EvenniaTest):
|
||||||
force=True)
|
force=True)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(TestLanguage, self).tearDown()
|
super().tearDown()
|
||||||
rplanguage._LANGUAGE_HANDLER.delete()
|
rplanguage._LANGUAGE_HANDLER.delete()
|
||||||
rplanguage._LANGUAGE_HANDLER = None
|
rplanguage._LANGUAGE_HANDLER = None
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ emote = "With a flair, /me looks at /first and /colliding sdesc-guy. She says \"
|
||||||
|
|
||||||
class TestRPSystem(EvenniaTest):
|
class TestRPSystem(EvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestRPSystem, self).setUp()
|
super().setUp()
|
||||||
self.room = create_object(rpsystem.ContribRPRoom, key="Location")
|
self.room = create_object(rpsystem.ContribRPRoom, key="Location")
|
||||||
self.speaker = create_object(rpsystem.ContribRPCharacter, key="Sender", location=self.room)
|
self.speaker = create_object(rpsystem.ContribRPCharacter, key="Sender", location=self.room)
|
||||||
self.receiver1 = create_object(rpsystem.ContribRPCharacter, key="Receiver1", location=self.room)
|
self.receiver1 = create_object(rpsystem.ContribRPCharacter, key="Receiver1", location=self.room)
|
||||||
|
|
@ -197,7 +197,7 @@ class TestExtendedRoom(CommandTest):
|
||||||
settings.TIME_ZONE = "UTC"
|
settings.TIME_ZONE = "UTC"
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestExtendedRoom, self).setUp()
|
super().setUp()
|
||||||
self.room1.ndb.last_timeslot = "afternoon"
|
self.room1.ndb.last_timeslot = "afternoon"
|
||||||
self.room1.ndb.last_season = "winter"
|
self.room1.ndb.last_season = "winter"
|
||||||
self.room1.db.details = {'testdetail': self.DETAIL_DESC}
|
self.room1.db.details = {'testdetail': self.DETAIL_DESC}
|
||||||
|
|
@ -244,7 +244,7 @@ from evennia.contrib import barter
|
||||||
class TestBarter(CommandTest):
|
class TestBarter(CommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestBarter, self).setUp()
|
super().setUp()
|
||||||
self.tradeitem1 = create_object(key="TradeItem1", location=self.char1)
|
self.tradeitem1 = create_object(key="TradeItem1", location=self.char1)
|
||||||
self.tradeitem2 = create_object(key="TradeItem2", location=self.char1)
|
self.tradeitem2 = create_object(key="TradeItem2", location=self.char1)
|
||||||
self.tradeitem3 = create_object(key="TradeItem3", location=self.char2)
|
self.tradeitem3 = create_object(key="TradeItem3", location=self.char2)
|
||||||
|
|
@ -331,7 +331,7 @@ from evennia import DefaultCharacter
|
||||||
class TestWilderness(EvenniaTest):
|
class TestWilderness(EvenniaTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestWilderness, self).setUp()
|
super().setUp()
|
||||||
self.char1 = create_object(DefaultCharacter, key="char1")
|
self.char1 = create_object(DefaultCharacter, key="char1")
|
||||||
self.char2 = create_object(DefaultCharacter, key="char2")
|
self.char2 = create_object(DefaultCharacter, key="char2")
|
||||||
|
|
||||||
|
|
@ -564,7 +564,7 @@ def _testcallback():
|
||||||
|
|
||||||
class TestCustomGameTime(EvenniaTest):
|
class TestCustomGameTime(EvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCustomGameTime, self).setUp()
|
super().setUp()
|
||||||
gametime.gametime = Mock(return_value=2975000898.46) # does not seem to work
|
gametime.gametime = Mock(return_value=2975000898.46) # does not seem to work
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
|
|
||||||
|
|
@ -541,7 +541,7 @@ class CmdCombatHelp(CmdHelp):
|
||||||
"|wPass:|n Pass your turn without further action.|/" +
|
"|wPass:|n Pass your turn without further action.|/" +
|
||||||
"|wDisengage:|n End your turn and attempt to end combat.|/")
|
"|wDisengage:|n End your turn and attempt to end combat.|/")
|
||||||
else:
|
else:
|
||||||
super(CmdCombatHelp, self).func() # Call the default help command
|
super().func() # Call the default help command
|
||||||
|
|
||||||
|
|
||||||
class BattleCmdSet(default_cmds.CharacterCmdSet):
|
class BattleCmdSet(default_cmds.CharacterCmdSet):
|
||||||
|
|
|
||||||
|
|
@ -541,7 +541,7 @@ class CmdCombatHelp(CmdHelp):
|
||||||
"|wPass:|n Pass your turn without further action.|/" +
|
"|wPass:|n Pass your turn without further action.|/" +
|
||||||
"|wDisengage:|n End your turn and attempt to end combat.|/")
|
"|wDisengage:|n End your turn and attempt to end combat.|/")
|
||||||
else:
|
else:
|
||||||
super(CmdCombatHelp, self).func() # Call the default help command
|
super().func() # Call the default help command
|
||||||
|
|
||||||
|
|
||||||
class BattleCmdSet(default_cmds.CharacterCmdSet):
|
class BattleCmdSet(default_cmds.CharacterCmdSet):
|
||||||
|
|
|
||||||
|
|
@ -658,7 +658,7 @@ class CmdCombatHelp(CmdHelp):
|
||||||
"|wPass:|n Pass your turn without further action.|/" +
|
"|wPass:|n Pass your turn without further action.|/" +
|
||||||
"|wDisengage:|n End your turn and attempt to end combat.|/")
|
"|wDisengage:|n End your turn and attempt to end combat.|/")
|
||||||
else:
|
else:
|
||||||
super(CmdCombatHelp, self).func() # Call the default help command
|
super().func() # Call the default help command
|
||||||
|
|
||||||
class CmdWield(Command):
|
class CmdWield(Command):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ class TutorialObject(DefaultObject):
|
||||||
|
|
||||||
def at_object_creation(self):
|
def at_object_creation(self):
|
||||||
"""Called when the object is first created."""
|
"""Called when the object is first created."""
|
||||||
super(TutorialObject, self).at_object_creation()
|
super().at_object_creation()
|
||||||
self.db.tutorial_info = "No tutorial info is available for this object."
|
self.db.tutorial_info = "No tutorial info is available for this object."
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
|
|
@ -124,7 +124,7 @@ class Readable(TutorialObject):
|
||||||
Called when object is created. We make sure to set the needed
|
Called when object is created. We make sure to set the needed
|
||||||
Attribute and add the readable cmdset.
|
Attribute and add the readable cmdset.
|
||||||
"""
|
"""
|
||||||
super(Readable, self).at_object_creation()
|
super().at_object_creation()
|
||||||
self.db.tutorial_info = "This is an object with a 'read' command defined in a command set on itself."
|
self.db.tutorial_info = "This is an object with a 'read' command defined in a command set on itself."
|
||||||
self.db.readable_text = "There is no text written on %s." % self.key
|
self.db.readable_text = "There is no text written on %s." % self.key
|
||||||
# define a command on the object.
|
# define a command on the object.
|
||||||
|
|
@ -222,7 +222,7 @@ class Obelisk(TutorialObject):
|
||||||
|
|
||||||
def at_object_creation(self):
|
def at_object_creation(self):
|
||||||
"""Called when object is created."""
|
"""Called when object is created."""
|
||||||
super(Obelisk, self).at_object_creation()
|
super().at_object_creation()
|
||||||
self.db.tutorial_info = "This object changes its desc randomly, and makes sure to remember which one you saw."
|
self.db.tutorial_info = "This object changes its desc randomly, and makes sure to remember which one you saw."
|
||||||
self.db.puzzle_descs = ["You see a normal stone slab"]
|
self.db.puzzle_descs = ["You see a normal stone slab"]
|
||||||
# make sure this can never be picked up
|
# make sure this can never be picked up
|
||||||
|
|
@ -246,7 +246,7 @@ class Obelisk(TutorialObject):
|
||||||
caller.db.puzzle_clue = clueindex
|
caller.db.puzzle_clue = clueindex
|
||||||
# call the parent function as normal (this will use
|
# call the parent function as normal (this will use
|
||||||
# the new desc Attribute we just set)
|
# the new desc Attribute we just set)
|
||||||
return super(Obelisk, self).return_appearance(caller)
|
return super().return_appearance(caller)
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
|
|
@ -320,7 +320,7 @@ class LightSource(TutorialObject):
|
||||||
|
|
||||||
def at_object_creation(self):
|
def at_object_creation(self):
|
||||||
"""Called when object is first created."""
|
"""Called when object is first created."""
|
||||||
super(LightSource, self).at_object_creation()
|
super().at_object_creation()
|
||||||
self.db.tutorial_info = "This object can be lit to create light. It has a timeout for how long it burns."
|
self.db.tutorial_info = "This object can be lit to create light. It has a timeout for how long it burns."
|
||||||
self.db.is_giving_light = False
|
self.db.is_giving_light = False
|
||||||
self.db.burntime = 60 * 3 # 3 minutes
|
self.db.burntime = 60 * 3 # 3 minutes
|
||||||
|
|
@ -602,7 +602,7 @@ class CrumblingWall(TutorialObject, DefaultExit):
|
||||||
|
|
||||||
def at_object_creation(self):
|
def at_object_creation(self):
|
||||||
"""called when the object is first created."""
|
"""called when the object is first created."""
|
||||||
super(CrumblingWall, self).at_object_creation()
|
super().at_object_creation()
|
||||||
|
|
||||||
self.aliases.add(["secret passage", "passage",
|
self.aliases.add(["secret passage", "passage",
|
||||||
"crack", "opening", "secret door"])
|
"crack", "opening", "secret door"])
|
||||||
|
|
@ -694,7 +694,7 @@ class CrumblingWall(TutorialObject, DefaultExit):
|
||||||
self.db.desc = "".join(result)
|
self.db.desc = "".join(result)
|
||||||
|
|
||||||
# call the parent to continue execution (will use the desc we just set)
|
# call the parent to continue execution (will use the desc we just set)
|
||||||
return super(CrumblingWall, self).return_appearance(caller)
|
return super().return_appearance(caller)
|
||||||
|
|
||||||
def at_after_traverse(self, traverser, source_location):
|
def at_after_traverse(self, traverser, source_location):
|
||||||
"""
|
"""
|
||||||
|
|
@ -863,7 +863,7 @@ class Weapon(TutorialObject):
|
||||||
|
|
||||||
def at_object_creation(self):
|
def at_object_creation(self):
|
||||||
"""Called at first creation of the object"""
|
"""Called at first creation of the object"""
|
||||||
super(Weapon, self).at_object_creation()
|
super().at_object_creation()
|
||||||
self.db.hit = 0.4 # hit chance
|
self.db.hit = 0.4 # hit chance
|
||||||
self.db.parry = 0.8 # parry chance
|
self.db.parry = 0.8 # parry chance
|
||||||
self.db.damage = 1.0
|
self.db.damage = 1.0
|
||||||
|
|
|
||||||
|
|
@ -311,7 +311,7 @@ class WeatherRoom(TutorialRoom):
|
||||||
the ticking of the room; the TickerHandler works fine for
|
the ticking of the room; the TickerHandler works fine for
|
||||||
simple things like this though.
|
simple things like this though.
|
||||||
"""
|
"""
|
||||||
super(WeatherRoom, self).at_object_creation()
|
super().at_object_creation()
|
||||||
# subscribe ourselves to a ticker to repeatedly call the hook
|
# subscribe ourselves to a ticker to repeatedly call the hook
|
||||||
# "update_weather" on this object. The interval is randomized
|
# "update_weather" on this object. The interval is randomized
|
||||||
# so as to not have all weather rooms update at the same time.
|
# so as to not have all weather rooms update at the same time.
|
||||||
|
|
@ -362,7 +362,7 @@ class IntroRoom(TutorialRoom):
|
||||||
"""
|
"""
|
||||||
Called when the room is first created.
|
Called when the room is first created.
|
||||||
"""
|
"""
|
||||||
super(IntroRoom, self).at_object_creation()
|
super().at_object_creation()
|
||||||
self.db.tutorial_info = "The first room of the tutorial. " \
|
self.db.tutorial_info = "The first room of the tutorial. " \
|
||||||
"This assigns the health Attribute to "\
|
"This assigns the health Attribute to "\
|
||||||
"the account."
|
"the account."
|
||||||
|
|
@ -633,7 +633,7 @@ class BridgeRoom(WeatherRoom):
|
||||||
"""Setups the room"""
|
"""Setups the room"""
|
||||||
# this will start the weather room's ticker and tell
|
# this will start the weather room's ticker and tell
|
||||||
# it to call update_weather regularly.
|
# it to call update_weather regularly.
|
||||||
super(BridgeRoom, self).at_object_creation()
|
super().at_object_creation()
|
||||||
# this identifies the exits from the room (should be the command
|
# this identifies the exits from the room (should be the command
|
||||||
# needed to leave through that exit). These are defaults, but you
|
# needed to leave through that exit). These are defaults, but you
|
||||||
# could of course also change them after the room has been created.
|
# could of course also change them after the room has been created.
|
||||||
|
|
@ -836,7 +836,7 @@ class DarkRoom(TutorialRoom):
|
||||||
"""
|
"""
|
||||||
Called when object is first created.
|
Called when object is first created.
|
||||||
"""
|
"""
|
||||||
super(DarkRoom, self).at_object_creation()
|
super().at_object_creation()
|
||||||
self.db.tutorial_info = "This is a room with custom command sets on itself."
|
self.db.tutorial_info = "This is a room with custom command sets on itself."
|
||||||
# the room starts dark.
|
# the room starts dark.
|
||||||
self.db.is_lit = False
|
self.db.is_lit = False
|
||||||
|
|
@ -950,7 +950,7 @@ class TeleportRoom(TutorialRoom):
|
||||||
|
|
||||||
def at_object_creation(self):
|
def at_object_creation(self):
|
||||||
"""Called at first creation"""
|
"""Called at first creation"""
|
||||||
super(TeleportRoom, self).at_object_creation()
|
super().at_object_creation()
|
||||||
# what character.db.puzzle_clue must be set to, to avoid teleportation.
|
# what character.db.puzzle_clue must be set to, to avoid teleportation.
|
||||||
self.db.puzzle_value = 1
|
self.db.puzzle_value = 1
|
||||||
# target of successful teleportation. Can be a dbref or a
|
# target of successful teleportation. Can be a dbref or a
|
||||||
|
|
@ -1016,7 +1016,7 @@ class OutroRoom(TutorialRoom):
|
||||||
"""
|
"""
|
||||||
Called when the room is first created.
|
Called when the room is first created.
|
||||||
"""
|
"""
|
||||||
super(OutroRoom, self).at_object_creation()
|
super().at_object_creation()
|
||||||
self.db.tutorial_info = "The last room of the tutorial. " \
|
self.db.tutorial_info = "The last room of the tutorial. " \
|
||||||
"This cleans up all temporary Attributes " \
|
"This cleans up all temporary Attributes " \
|
||||||
"the tutorial may have assigned to the "\
|
"the tutorial may have assigned to the "\
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ class UnixCommandParser(argparse.ArgumentParser):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
prog = prog or command.key
|
prog = prog or command.key
|
||||||
super(UnixCommandParser, self).__init__(
|
super().__init__(
|
||||||
prog=prog, description=description,
|
prog=prog, description=description,
|
||||||
conflict_handler='resolve', add_help=False, **kwargs)
|
conflict_handler='resolve', add_help=False, **kwargs)
|
||||||
self.command = command
|
self.command = command
|
||||||
|
|
@ -133,7 +133,7 @@ class UnixCommandParser(argparse.ArgumentParser):
|
||||||
in order to avoid unintentional color codes.
|
in order to avoid unintentional color codes.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return raw(super(UnixCommandParser, self).format_usage())
|
return raw(super().format_usage())
|
||||||
|
|
||||||
def format_help(self):
|
def format_help(self):
|
||||||
"""Return the parser help, including its epilog.
|
"""Return the parser help, including its epilog.
|
||||||
|
|
@ -144,7 +144,7 @@ class UnixCommandParser(argparse.ArgumentParser):
|
||||||
in the epilog (the command docstring) are supported.
|
in the epilog (the command docstring) are supported.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
autohelp = raw(super(UnixCommandParser, self).format_help())
|
autohelp = raw(super().format_help())
|
||||||
return "\n" + autohelp + "\n" + self.post_help
|
return "\n" + autohelp + "\n" + self.post_help
|
||||||
|
|
||||||
def print_usage(self, file=None):
|
def print_usage(self, file=None):
|
||||||
|
|
@ -234,7 +234,7 @@ class UnixCommand(Command):
|
||||||
overloading evential same-named class properties.
|
overloading evential same-named class properties.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(UnixCommand, self).__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
# Create the empty UnixCommandParser, inheriting argparse.ArgumentParser
|
# Create the empty UnixCommandParser, inheriting argparse.ArgumentParser
|
||||||
lines = dedent(self.__doc__.strip("\n")).splitlines()
|
lines = dedent(self.__doc__.strip("\n")).splitlines()
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class Command(BaseCommand):
|
||||||
# We just show it here for completeness - we
|
# We just show it here for completeness - we
|
||||||
# are satisfied using the default check in Command.
|
# are satisfied using the default check in Command.
|
||||||
# """
|
# """
|
||||||
# return super(MuxCommand, self).has_perm(srcobj)
|
# return super().has_perm(srcobj)
|
||||||
#
|
#
|
||||||
# def at_pre_cmd(self):
|
# def at_pre_cmd(self):
|
||||||
# """
|
# """
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
||||||
"""
|
"""
|
||||||
Populates the cmdset
|
Populates the cmdset
|
||||||
"""
|
"""
|
||||||
super(CharacterCmdSet, self).at_cmdset_creation()
|
super().at_cmdset_creation()
|
||||||
#
|
#
|
||||||
# any commands you add below will overload the default ones.
|
# any commands you add below will overload the default ones.
|
||||||
#
|
#
|
||||||
|
|
@ -48,7 +48,7 @@ class AccountCmdSet(default_cmds.AccountCmdSet):
|
||||||
"""
|
"""
|
||||||
Populates the cmdset
|
Populates the cmdset
|
||||||
"""
|
"""
|
||||||
super(AccountCmdSet, self).at_cmdset_creation()
|
super().at_cmdset_creation()
|
||||||
#
|
#
|
||||||
# any commands you add below will overload the default ones.
|
# any commands you add below will overload the default ones.
|
||||||
#
|
#
|
||||||
|
|
@ -65,7 +65,7 @@ class UnloggedinCmdSet(default_cmds.UnloggedinCmdSet):
|
||||||
"""
|
"""
|
||||||
Populates the cmdset
|
Populates the cmdset
|
||||||
"""
|
"""
|
||||||
super(UnloggedinCmdSet, self).at_cmdset_creation()
|
super().at_cmdset_creation()
|
||||||
#
|
#
|
||||||
# any commands you add below will overload the default ones.
|
# any commands you add below will overload the default ones.
|
||||||
#
|
#
|
||||||
|
|
@ -86,7 +86,7 @@ class SessionCmdSet(default_cmds.SessionCmdSet):
|
||||||
As and example we just add the empty base `Command` object.
|
As and example we just add the empty base `Command` object.
|
||||||
It prints some info.
|
It prints some info.
|
||||||
"""
|
"""
|
||||||
super(SessionCmdSet, self).at_cmdset_creation()
|
super().at_cmdset_creation()
|
||||||
#
|
#
|
||||||
# any commands you add below will overload the default ones.
|
# any commands you add below will overload the default ones.
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ class ObjectDBAdmin(admin.ModelAdmin):
|
||||||
"""
|
"""
|
||||||
if not obj:
|
if not obj:
|
||||||
return self.add_fieldsets
|
return self.add_fieldsets
|
||||||
return super(ObjectDBAdmin, self).get_fieldsets(request, obj)
|
return super().get_fieldsets(request, obj)
|
||||||
|
|
||||||
def get_form(self, request, obj=None, **kwargs):
|
def get_form(self, request, obj=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
@ -138,7 +138,7 @@ class ObjectDBAdmin(admin.ModelAdmin):
|
||||||
'fields': flatten_fieldsets(self.add_fieldsets),
|
'fields': flatten_fieldsets(self.add_fieldsets),
|
||||||
})
|
})
|
||||||
defaults.update(kwargs)
|
defaults.update(kwargs)
|
||||||
return super(ObjectDBAdmin, self).get_form(request, obj, **defaults)
|
return super().get_form(request, obj, **defaults)
|
||||||
|
|
||||||
def save_model(self, request, obj, form, change):
|
def save_model(self, request, obj, form, change):
|
||||||
"""
|
"""
|
||||||
|
|
@ -166,7 +166,7 @@ class ObjectDBAdmin(admin.ModelAdmin):
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
return HttpResponseRedirect(reverse("admin:objects_objectdb_change", args=[obj.id]))
|
return HttpResponseRedirect(reverse("admin:objects_objectdb_change", args=[obj.id]))
|
||||||
return super(ObjectDBAdmin, self).response_add(request, obj, post_url_continue)
|
return super().response_add(request, obj, post_url_continue)
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(ObjectDB, ObjectDBAdmin)
|
admin.site.register(ObjectDB, ObjectDBAdmin)
|
||||||
|
|
|
||||||
|
|
@ -877,7 +877,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
|
||||||
self.location = None # this updates contents_cache for our location
|
self.location = None # this updates contents_cache for our location
|
||||||
|
|
||||||
# Perform the deletion of the object
|
# Perform the deletion of the object
|
||||||
super(DefaultObject, self).delete()
|
super().delete()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def access(self, accessing_obj, access_type='read', default=False, no_superuser_bypass=False, **kwargs):
|
def access(self, accessing_obj, access_type='read', default=False, no_superuser_bypass=False, **kwargs):
|
||||||
|
|
@ -896,7 +896,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
|
||||||
Passed on to the at_access hook along with the result of the access check.
|
Passed on to the at_access hook along with the result of the access check.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
result = super(DefaultObject, self).access(accessing_obj, access_type=access_type,
|
result = super().access(accessing_obj, access_type=access_type,
|
||||||
default=default, no_superuser_bypass=no_superuser_bypass)
|
default=default, no_superuser_bypass=no_superuser_bypass)
|
||||||
self.at_access(result, accessing_obj, access_type, **kwargs)
|
self.at_access(result, accessing_obj, access_type, **kwargs)
|
||||||
return result
|
return result
|
||||||
|
|
@ -1760,7 +1760,7 @@ class DefaultCharacter(DefaultObject):
|
||||||
Character object works).
|
Character object works).
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(DefaultCharacter, self).basetype_setup()
|
super().basetype_setup()
|
||||||
self.locks.add(";".join(["get:false()", # noone can pick up the character
|
self.locks.add(";".join(["get:false()", # noone can pick up the character
|
||||||
"call:false()"])) # no commands can be called on character from outside
|
"call:false()"])) # no commands can be called on character from outside
|
||||||
# add the default cmdset
|
# add the default cmdset
|
||||||
|
|
@ -1874,7 +1874,7 @@ class DefaultRoom(DefaultObject):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
super(DefaultRoom, self).basetype_setup()
|
super().basetype_setup()
|
||||||
self.locks.add(";".join(["get:false()",
|
self.locks.add(";".join(["get:false()",
|
||||||
"puppet:false()"])) # would be weird to puppet a room ...
|
"puppet:false()"])) # would be weird to puppet a room ...
|
||||||
self.location = None
|
self.location = None
|
||||||
|
|
@ -1990,7 +1990,7 @@ class DefaultExit(DefaultObject):
|
||||||
sure you include all the functionality in this method.
|
sure you include all the functionality in this method.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(DefaultExit, self).basetype_setup()
|
super().basetype_setup()
|
||||||
|
|
||||||
# setting default locks (overload these in at_object_creation()
|
# setting default locks (overload these in at_object_creation()
|
||||||
self.locks.add(";".join(["puppet:false()", # would be weird to puppet an exit ...
|
self.locks.add(";".join(["puppet:false()", # would be weird to puppet an exit ...
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class PortalSessionHandler(SessionHandler):
|
||||||
Init the handler
|
Init the handler
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(PortalSessionHandler, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.portal = None
|
self.portal = None
|
||||||
self.latest_sessid = 0
|
self.latest_sessid = 0
|
||||||
self.uptime = time.time()
|
self.uptime = time.time()
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ class AccountDBPasswordChecker(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.factory = factory
|
self.factory = factory
|
||||||
super(AccountDBPasswordChecker, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
def requestAvatarId(self, c):
|
def requestAvatarId(self, c):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class SSLProtocol(TelnetProtocol):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(SSLProtocol, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.protocol_name = "ssl"
|
self.protocol_name = "ssl"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.protocol_name = "telnet"
|
self.protocol_name = "telnet"
|
||||||
super(TelnetProtocol, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def connectionMade(self):
|
def connectionMade(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -169,7 +169,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
self.mccp.no_mccp(option)
|
self.mccp.no_mccp(option)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return super(TelnetProtocol, self).disableLocal(option)
|
return super().disableLocal(option)
|
||||||
|
|
||||||
def connectionLost(self, reason):
|
def connectionLost(self, reason):
|
||||||
"""
|
"""
|
||||||
|
|
@ -220,7 +220,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
def _write(self, data):
|
def _write(self, data):
|
||||||
"""hook overloading the one used in plain telnet"""
|
"""hook overloading the one used in plain telnet"""
|
||||||
data = data.replace(b'\n', b'\r\n').replace(b'\r\r\n', b'\r\n')
|
data = data.replace(b'\n', b'\r\n').replace(b'\r\r\n', b'\r\n')
|
||||||
super(TelnetProtocol, self)._write(mccp_compress(self, data))
|
super()._write(mccp_compress(self, data))
|
||||||
|
|
||||||
def sendLine(self, line):
|
def sendLine(self, line):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class LazyEncoder(json.JSONEncoder):
|
||||||
def default(self, obj):
|
def default(self, obj):
|
||||||
if isinstance(obj, Promise):
|
if isinstance(obj, Promise):
|
||||||
return str(obj)
|
return str(obj)
|
||||||
return super(LazyEncoder, self).default(obj)
|
return super().default(obj)
|
||||||
|
|
||||||
|
|
||||||
def jsonify(obj):
|
def jsonify(obj):
|
||||||
|
|
@ -298,7 +298,7 @@ class AjaxWebClientSession(session.Session):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.protocol_name = "ajax/comet"
|
self.protocol_name = "ajax/comet"
|
||||||
super(AjaxWebClientSession, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def get_client_session(self):
|
def get_client_session(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -104,22 +104,22 @@ class SessionHandler(dict):
|
||||||
"Clean out None-sessions automatically."
|
"Clean out None-sessions automatically."
|
||||||
if None in self:
|
if None in self:
|
||||||
del self[None]
|
del self[None]
|
||||||
return super(SessionHandler, self).__getitem__(key)
|
return super().__getitem__(key)
|
||||||
|
|
||||||
def get(self, key, default=None):
|
def get(self, key, default=None):
|
||||||
"Clean out None-sessions automatically."
|
"Clean out None-sessions automatically."
|
||||||
if None in self:
|
if None in self:
|
||||||
del self[None]
|
del self[None]
|
||||||
return super(SessionHandler, self).get(key, default)
|
return super().get(key, default)
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
"Don't assign None sessions"
|
"Don't assign None sessions"
|
||||||
if key is not None:
|
if key is not None:
|
||||||
super(SessionHandler, self).__setitem__(key, value)
|
super().__setitem__(key, value)
|
||||||
|
|
||||||
def __contains__(self, key):
|
def __contains__(self, key):
|
||||||
"None-keys are not accepted."
|
"None-keys are not accepted."
|
||||||
return False if key is None else super(SessionHandler, self).__contains__(key)
|
return False if key is None else super().__contains__(key)
|
||||||
|
|
||||||
def get_sessions(self, include_unloggedin=False):
|
def get_sessions(self, include_unloggedin=False):
|
||||||
"""
|
"""
|
||||||
|
|
@ -267,7 +267,7 @@ class ServerSessionHandler(SessionHandler):
|
||||||
Init the handler.
|
Init the handler.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(ServerSessionHandler, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.server = None
|
self.server = None
|
||||||
self.server_data = {"servername": _SERVERNAME}
|
self.server_data = {"servername": _SERVERNAME}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,4 +45,4 @@ class EvenniaTestSuiteRunner(DiscoverRunner):
|
||||||
"""
|
"""
|
||||||
import evennia
|
import evennia
|
||||||
evennia._init()
|
evennia._init()
|
||||||
return super(EvenniaTestSuiteRunner, self).build_suite(test_labels, extra_tests=extra_tests, **kwargs)
|
return super().build_suite(test_labels, extra_tests=extra_tests, **kwargs)
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class TagForm(forms.ModelForm):
|
||||||
the corresponding tag fields. The initial data of the form fields will similarly be
|
the corresponding tag fields. The initial data of the form fields will similarly be
|
||||||
populated.
|
populated.
|
||||||
"""
|
"""
|
||||||
super(TagForm, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
tagkey = None
|
tagkey = None
|
||||||
tagcategory = None
|
tagcategory = None
|
||||||
tagtype = None
|
tagtype = None
|
||||||
|
|
@ -75,7 +75,7 @@ class TagForm(forms.ModelForm):
|
||||||
we'll try to make sure that empty form fields will be None, rather than ''.
|
we'll try to make sure that empty form fields will be None, rather than ''.
|
||||||
"""
|
"""
|
||||||
# we are spoofing a tag for the Handler that will be called
|
# we are spoofing a tag for the Handler that will be called
|
||||||
# instance = super(TagForm, self).save(commit=False)
|
# instance = super().save(commit=False)
|
||||||
instance = self.instance
|
instance = self.instance
|
||||||
instance.tag_key = self.cleaned_data['tag_key']
|
instance.tag_key = self.cleaned_data['tag_key']
|
||||||
instance.tag_category = self.cleaned_data['tag_category'] or None
|
instance.tag_category = self.cleaned_data['tag_category'] or None
|
||||||
|
|
@ -109,7 +109,7 @@ class TagFormSet(forms.BaseInlineFormSet):
|
||||||
else:
|
else:
|
||||||
handler_name = "tags"
|
handler_name = "tags"
|
||||||
return getattr(related, handler_name)
|
return getattr(related, handler_name)
|
||||||
instances = super(TagFormSet, self).save(commit=False)
|
instances = super().save(commit=False)
|
||||||
# self.deleted_objects is a list created when super of save is called, we'll remove those
|
# self.deleted_objects is a list created when super of save is called, we'll remove those
|
||||||
for obj in self.deleted_objects:
|
for obj in self.deleted_objects:
|
||||||
handler = get_handler(obj)
|
handler = get_handler(obj)
|
||||||
|
|
@ -143,7 +143,7 @@ class TagInline(admin.TabularInline):
|
||||||
a proxy isn't threadsafe, since it'd be the base class and would change if multiple
|
a proxy isn't threadsafe, since it'd be the base class and would change if multiple
|
||||||
people used the admin at the same time
|
people used the admin at the same time
|
||||||
"""
|
"""
|
||||||
formset = super(TagInline, self).get_formset(request, obj, **kwargs)
|
formset = super().get_formset(request, obj, **kwargs)
|
||||||
|
|
||||||
class ProxyFormset(formset):
|
class ProxyFormset(formset):
|
||||||
pass
|
pass
|
||||||
|
|
@ -190,7 +190,7 @@ class AttributeForm(forms.ModelForm):
|
||||||
similarly be populated.
|
similarly be populated.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(AttributeForm, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
attr_key = None
|
attr_key = None
|
||||||
attr_category = None
|
attr_category = None
|
||||||
attr_value = None
|
attr_value = None
|
||||||
|
|
@ -255,7 +255,7 @@ class AttributeFormSet(forms.BaseInlineFormSet):
|
||||||
else:
|
else:
|
||||||
handler_name = "attributes"
|
handler_name = "attributes"
|
||||||
return getattr(related, handler_name)
|
return getattr(related, handler_name)
|
||||||
instances = super(AttributeFormSet, self).save(commit=False)
|
instances = super().save(commit=False)
|
||||||
# self.deleted_objects is a list created when super of save is called, we'll remove those
|
# self.deleted_objects is a list created when super of save is called, we'll remove those
|
||||||
for obj in self.deleted_objects:
|
for obj in self.deleted_objects:
|
||||||
handler = get_handler(obj)
|
handler = get_handler(obj)
|
||||||
|
|
@ -297,7 +297,7 @@ class AttributeInline(admin.TabularInline):
|
||||||
a proxy isn't threadsafe, since it'd be the base class and would change if multiple
|
a proxy isn't threadsafe, since it'd be the base class and would change if multiple
|
||||||
people used the admin at the same time
|
people used the admin at the same time
|
||||||
"""
|
"""
|
||||||
formset = super(AttributeInline, self).get_formset(request, obj, **kwargs)
|
formset = super().get_formset(request, obj, **kwargs)
|
||||||
|
|
||||||
class ProxyFormset(formset):
|
class ProxyFormset(formset):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -800,7 +800,7 @@ class NickHandler(AttributeHandler):
|
||||||
_attrtype = "nick"
|
_attrtype = "nick"
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(NickHandler, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self._regex_cache = {}
|
self._regex_cache = {}
|
||||||
|
|
||||||
def has(self, key, category="inputline"):
|
def has(self, key, category="inputline"):
|
||||||
|
|
@ -816,7 +816,7 @@ class NickHandler(AttributeHandler):
|
||||||
is a list of booleans.
|
is a list of booleans.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return super(NickHandler, self).has(key, category=category)
|
return super().has(key, category=category)
|
||||||
|
|
||||||
def get(self, key=None, category="inputline", return_tuple=False, **kwargs):
|
def get(self, key=None, category="inputline", return_tuple=False, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
@ -836,9 +836,9 @@ class NickHandler(AttributeHandler):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if return_tuple or "return_obj" in kwargs:
|
if return_tuple or "return_obj" in kwargs:
|
||||||
return super(NickHandler, self).get(key=key, category=category, **kwargs)
|
return super().get(key=key, category=category, **kwargs)
|
||||||
else:
|
else:
|
||||||
retval = super(NickHandler, self).get(key=key, category=category, **kwargs)
|
retval = super().get(key=key, category=category, **kwargs)
|
||||||
if retval:
|
if retval:
|
||||||
return retval[3] if isinstance(retval, tuple) else \
|
return retval[3] if isinstance(retval, tuple) else \
|
||||||
[tup[3] for tup in make_iter(retval)]
|
[tup[3] for tup in make_iter(retval)]
|
||||||
|
|
@ -861,7 +861,7 @@ class NickHandler(AttributeHandler):
|
||||||
nick_regex, nick_template = initialize_nick_templates(key + " $1", replacement + " $1")
|
nick_regex, nick_template = initialize_nick_templates(key + " $1", replacement + " $1")
|
||||||
else:
|
else:
|
||||||
nick_regex, nick_template = initialize_nick_templates(key, replacement)
|
nick_regex, nick_template = initialize_nick_templates(key, replacement)
|
||||||
super(NickHandler, self).add(key, (nick_regex, nick_template, key, replacement),
|
super().add(key, (nick_regex, nick_template, key, replacement),
|
||||||
category=category, **kwargs)
|
category=category, **kwargs)
|
||||||
|
|
||||||
def remove(self, key, category="inputline", **kwargs):
|
def remove(self, key, category="inputline", **kwargs):
|
||||||
|
|
@ -876,7 +876,7 @@ class NickHandler(AttributeHandler):
|
||||||
kwargs (any, optional): These are passed on to `AttributeHandler.get`.
|
kwargs (any, optional): These are passed on to `AttributeHandler.get`.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(NickHandler, self).remove(key, category=category, **kwargs)
|
super().remove(key, category=category, **kwargs)
|
||||||
|
|
||||||
def nickreplace(self, raw_string, categories=("inputline", "channel"), include_account=True):
|
def nickreplace(self, raw_string, categories=("inputline", "channel"), include_account=True):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -390,7 +390,7 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager):
|
||||||
the given dbref ranges.
|
the given dbref ranges.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
retval = super(TypedObjectManager, self).all()
|
retval = super().all()
|
||||||
if min_dbref is not None:
|
if min_dbref is not None:
|
||||||
retval = retval.filter(id__gte=self.dbref(min_dbref, reqhash=False))
|
retval = retval.filter(id__gte=self.dbref(min_dbref, reqhash=False))
|
||||||
if max_dbref is not None:
|
if max_dbref is not None:
|
||||||
|
|
@ -545,7 +545,7 @@ class TypeclassManager(TypedObjectManager):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
kwargs.update({"db_typeclass_path": self.model.path})
|
kwargs.update({"db_typeclass_path": self.model.path})
|
||||||
return super(TypeclassManager, self).get(**kwargs)
|
return super().get(**kwargs)
|
||||||
|
|
||||||
def filter(self, *args, **kwargs):
|
def filter(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
@ -563,7 +563,7 @@ class TypeclassManager(TypedObjectManager):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
kwargs.update({"db_typeclass_path": self.model.path})
|
kwargs.update({"db_typeclass_path": self.model.path})
|
||||||
return super(TypeclassManager, self).filter(*args, **kwargs)
|
return super().filter(*args, **kwargs)
|
||||||
|
|
||||||
def all(self):
|
def all(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -573,7 +573,7 @@ class TypeclassManager(TypedObjectManager):
|
||||||
objects (queryset): The objects found.
|
objects (queryset): The objects found.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return super(TypeclassManager, self).all().filter(db_typeclass_path=self.model.path)
|
return super().all().filter(db_typeclass_path=self.model.path)
|
||||||
|
|
||||||
def first(self):
|
def first(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -587,7 +587,7 @@ class TypeclassManager(TypedObjectManager):
|
||||||
on the model base used.
|
on the model base used.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return super(TypeclassManager, self).filter(db_typeclass_path=self.model.path).first()
|
return super().filter(db_typeclass_path=self.model.path).first()
|
||||||
|
|
||||||
def last(self):
|
def last(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -601,7 +601,7 @@ class TypeclassManager(TypedObjectManager):
|
||||||
on the model base used.
|
on the model base used.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return super(TypeclassManager, self).filter(db_typeclass_path=self.model.path).last()
|
return super().filter(db_typeclass_path=self.model.path).last()
|
||||||
|
|
||||||
def count(self):
|
def count(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -611,7 +611,7 @@ class TypeclassManager(TypedObjectManager):
|
||||||
integer : Number of objects found.
|
integer : Number of objects found.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return super(TypeclassManager, self).filter(db_typeclass_path=self.model.path).count()
|
return super().filter(db_typeclass_path=self.model.path).count()
|
||||||
|
|
||||||
def _get_subclasses(self, cls):
|
def _get_subclasses(self, cls):
|
||||||
"""
|
"""
|
||||||
|
|
@ -644,7 +644,7 @@ class TypeclassManager(TypedObjectManager):
|
||||||
paths = [self.model.path] + ["%s.%s" % (cls.__module__, cls.__name__)
|
paths = [self.model.path] + ["%s.%s" % (cls.__module__, cls.__name__)
|
||||||
for cls in self._get_subclasses(self.model)]
|
for cls in self._get_subclasses(self.model)]
|
||||||
kwargs.update({"db_typeclass_path__in": paths})
|
kwargs.update({"db_typeclass_path__in": paths})
|
||||||
return super(TypeclassManager, self).get(**kwargs)
|
return super().get(**kwargs)
|
||||||
|
|
||||||
def filter_family(self, *args, **kwargs):
|
def filter_family(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
@ -665,7 +665,7 @@ class TypeclassManager(TypedObjectManager):
|
||||||
paths = [self.model.path] + ["%s.%s" % (cls.__module__, cls.__name__)
|
paths = [self.model.path] + ["%s.%s" % (cls.__module__, cls.__name__)
|
||||||
for cls in self._get_subclasses(self.model)]
|
for cls in self._get_subclasses(self.model)]
|
||||||
kwargs.update({"db_typeclass_path__in": paths})
|
kwargs.update({"db_typeclass_path__in": paths})
|
||||||
return super(TypeclassManager, self).filter(*args, **kwargs)
|
return super().filter(*args, **kwargs)
|
||||||
|
|
||||||
def all_family(self):
|
def all_family(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -678,4 +678,4 @@ class TypeclassManager(TypedObjectManager):
|
||||||
"""
|
"""
|
||||||
paths = [self.model.path] + ["%s.%s" % (cls.__module__, cls.__name__)
|
paths = [self.model.path] + ["%s.%s" % (cls.__module__, cls.__name__)
|
||||||
for cls in self._get_subclasses(self.model)]
|
for cls in self._get_subclasses(self.model)]
|
||||||
return super(TypeclassManager, self).all().filter(db_typeclass_path__in=paths)
|
return super().all().filter(db_typeclass_path__in=paths)
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,7 @@ class TypedObject(SharedMemoryModel):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
typeclass_path = kwargs.pop("typeclass", None)
|
typeclass_path = kwargs.pop("typeclass", None)
|
||||||
super(TypedObject, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.set_class_from_typeclass(typeclass_path=typeclass_path)
|
self.set_class_from_typeclass(typeclass_path=typeclass_path)
|
||||||
|
|
||||||
# initialize all handlers in a lazy fashion
|
# initialize all handlers in a lazy fashion
|
||||||
|
|
@ -604,7 +604,7 @@ class TypedObject(SharedMemoryModel):
|
||||||
self.nicks.clear()
|
self.nicks.clear()
|
||||||
# scrambling properties
|
# scrambling properties
|
||||||
self.delete = self._deleted
|
self.delete = self._deleted
|
||||||
super(TypedObject, self).delete()
|
super().delete()
|
||||||
|
|
||||||
#
|
#
|
||||||
# Attribute storage
|
# Attribute storage
|
||||||
|
|
|
||||||
|
|
@ -630,7 +630,7 @@ class ANSIMeta(type):
|
||||||
for func_name in [
|
for func_name in [
|
||||||
'capitalize', 'translate', 'lower', 'upper', 'swapcase']:
|
'capitalize', 'translate', 'lower', 'upper', 'swapcase']:
|
||||||
setattr(cls, func_name, _transform(func_name))
|
setattr(cls, func_name, _transform(func_name))
|
||||||
super(ANSIMeta, cls).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class ANSIString(with_metaclass(ANSIMeta, str)):
|
class ANSIString(with_metaclass(ANSIMeta, str)):
|
||||||
|
|
@ -708,7 +708,7 @@ class ANSIString(with_metaclass(ANSIMeta, str)):
|
||||||
if not isinstance(string, str):
|
if not isinstance(string, str):
|
||||||
string = string.decode('utf-8')
|
string = string.decode('utf-8')
|
||||||
|
|
||||||
ansi_string = super(ANSIString, cls).__new__(ANSIString, to_str(clean_string))
|
ansi_string = super().__new__(ANSIString, to_str(clean_string))
|
||||||
ansi_string._raw_string = string
|
ansi_string._raw_string = string
|
||||||
ansi_string._clean_string = clean_string
|
ansi_string._clean_string = clean_string
|
||||||
ansi_string._code_indexes = code_indexes
|
ansi_string._code_indexes = code_indexes
|
||||||
|
|
@ -764,7 +764,7 @@ class ANSIString(with_metaclass(ANSIMeta, str)):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.parser = kwargs.pop('parser', ANSI_PARSER)
|
self.parser = kwargs.pop('parser', ANSI_PARSER)
|
||||||
super(ANSIString, self).__init__()
|
super().__init__()
|
||||||
if self._code_indexes is None:
|
if self._code_indexes is None:
|
||||||
self._code_indexes, self._char_indexes = self._get_indexes()
|
self._code_indexes, self._char_indexes = self._get_indexes()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ class _SaverList(_SaverMutable, MutableSequence):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(_SaverList, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self._data = list()
|
self._data = list()
|
||||||
|
|
||||||
@_save
|
@_save
|
||||||
|
|
@ -268,7 +268,7 @@ class _SaverDict(_SaverMutable, MutableMapping):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(_SaverDict, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self._data = dict()
|
self._data = dict()
|
||||||
|
|
||||||
def has_key(self, key):
|
def has_key(self, key):
|
||||||
|
|
@ -281,7 +281,7 @@ class _SaverSet(_SaverMutable, MutableSet):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(_SaverSet, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self._data = set()
|
self._data = set()
|
||||||
|
|
||||||
def __contains__(self, value):
|
def __contains__(self, value):
|
||||||
|
|
@ -302,7 +302,7 @@ class _SaverOrderedDict(_SaverMutable, MutableMapping):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(_SaverOrderedDict, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self._data = OrderedDict()
|
self._data = OrderedDict()
|
||||||
|
|
||||||
def has_key(self, key):
|
def has_key(self, key):
|
||||||
|
|
@ -315,7 +315,7 @@ class _SaverDeque(_SaverMutable):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(_SaverDeque, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self._data = deque()
|
self._data = deque()
|
||||||
|
|
||||||
@_save
|
@_save
|
||||||
|
|
|
||||||
|
|
@ -33,5 +33,5 @@ class SharedMemoryManager(Manager):
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
if inst is None:
|
if inst is None:
|
||||||
inst = super(SharedMemoryManager, self).get(*args, **kwargs)
|
inst = super().get(*args, **kwargs)
|
||||||
return inst
|
return inst
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ class SharedMemoryModelBase(ModelBase):
|
||||||
if not hasattr(dbmodel, "__instance_cache__"):
|
if not hasattr(dbmodel, "__instance_cache__"):
|
||||||
# we store __instance_cache__ only on the dbmodel base
|
# we store __instance_cache__ only on the dbmodel base
|
||||||
dbmodel.__instance_cache__ = {}
|
dbmodel.__instance_cache__ = {}
|
||||||
super(SharedMemoryModelBase, cls)._prepare()
|
super()._prepare()
|
||||||
|
|
||||||
def __new__(cls, name, bases, attrs):
|
def __new__(cls, name, bases, attrs):
|
||||||
"""
|
"""
|
||||||
|
|
@ -203,7 +203,7 @@ class SharedMemoryModelBase(ModelBase):
|
||||||
# makes sure not to overload manually created wrappers on the model
|
# makes sure not to overload manually created wrappers on the model
|
||||||
create_wrapper(cls, fieldname, wrappername, editable=field.editable, foreignkey=foreignkey)
|
create_wrapper(cls, fieldname, wrappername, editable=field.editable, foreignkey=foreignkey)
|
||||||
|
|
||||||
return super(SharedMemoryModelBase, cls).__new__(cls, name, bases, attrs)
|
return super().__new__(cls, name, bases, attrs)
|
||||||
|
|
||||||
|
|
||||||
class SharedMemoryModel(with_metaclass(SharedMemoryModelBase, Model)):
|
class SharedMemoryModel(with_metaclass(SharedMemoryModelBase, Model)):
|
||||||
|
|
@ -364,7 +364,7 @@ class SharedMemoryModel(with_metaclass(SharedMemoryModelBase, Model)):
|
||||||
"""
|
"""
|
||||||
self.flush_from_cache()
|
self.flush_from_cache()
|
||||||
self._is_deleted = True
|
self._is_deleted = True
|
||||||
super(SharedMemoryModel, self).delete(*args, **kwargs)
|
super().delete(*args, **kwargs)
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
@ -390,11 +390,11 @@ class SharedMemoryModel(with_metaclass(SharedMemoryModelBase, Model)):
|
||||||
|
|
||||||
if _IS_MAIN_THREAD:
|
if _IS_MAIN_THREAD:
|
||||||
# in main thread - normal operation
|
# in main thread - normal operation
|
||||||
super(SharedMemoryModel, self).save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
else:
|
else:
|
||||||
# in another thread; make sure to save in reactor thread
|
# in another thread; make sure to save in reactor thread
|
||||||
def _save_callback(cls, *args, **kwargs):
|
def _save_callback(cls, *args, **kwargs):
|
||||||
super(SharedMemoryModel, cls).save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
callFromThread(_save_callback, self, *args, **kwargs)
|
callFromThread(_save_callback, self, *args, **kwargs)
|
||||||
|
|
||||||
# update field-update hooks and eventual OOB watchers
|
# update field-update hooks and eventual OOB watchers
|
||||||
|
|
@ -429,7 +429,7 @@ class WeakSharedMemoryModelBase(SharedMemoryModelBase):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def _prepare(cls):
|
def _prepare(cls):
|
||||||
super(WeakSharedMemoryModelBase, cls)._prepare()
|
super()._prepare()
|
||||||
cls.__dbclass__.__instance_cache__ = WeakValueDictionary()
|
cls.__dbclass__.__instance_cache__ = WeakValueDictionary()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class SharedMemorysTest(TestCase):
|
||||||
# TODO: test for cross model relation (singleton to regular)
|
# TODO: test for cross model relation (singleton to regular)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(SharedMemorysTest, self).setUp()
|
super().setUp()
|
||||||
n = 0
|
n = 0
|
||||||
category = Category.objects.create(name="Category %d" % (n,))
|
category = Category.objects.create(name="Category %d" % (n,))
|
||||||
regcategory = RegularCategory.objects.create(name="Category %d" % (n,))
|
regcategory = RegularCategory.objects.create(name="Category %d" % (n,))
|
||||||
|
|
|
||||||
|
|
@ -224,14 +224,14 @@ class ParseStack(list):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(ParseStack, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
# always start stack with the empty string
|
# always start stack with the empty string
|
||||||
list.append(self, "")
|
list.append(self, "")
|
||||||
# indicates if the top of the stack is a string or not
|
# indicates if the top of the stack is a string or not
|
||||||
self._string_last = True
|
self._string_last = True
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return (super(ParseStack).__eq__(other) and
|
return (super().__eq__(other) and
|
||||||
hasattr(other, "_string_last") and self._string_last == other._string_last)
|
hasattr(other, "_string_last") and self._string_last == other._string_last)
|
||||||
|
|
||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ class PickledFormField(CharField):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
# This needs to fall through to literal_eval.
|
# This needs to fall through to literal_eval.
|
||||||
kwargs['required'] = False
|
kwargs['required'] = False
|
||||||
super(PickledFormField, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def clean(self, value):
|
def clean(self, value):
|
||||||
try:
|
try:
|
||||||
|
|
@ -184,7 +184,7 @@ class PickledObjectField(models.Field):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.compress = kwargs.pop('compress', False)
|
self.compress = kwargs.pop('compress', False)
|
||||||
self.protocol = kwargs.pop('protocol', DEFAULT_PROTOCOL)
|
self.protocol = kwargs.pop('protocol', DEFAULT_PROTOCOL)
|
||||||
super(PickledObjectField, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def get_default(self):
|
def get_default(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -203,7 +203,7 @@ class PickledObjectField(models.Field):
|
||||||
return self.default()
|
return self.default()
|
||||||
return self.default
|
return self.default
|
||||||
# If the field doesn't have a default, then we punt to models.Field.
|
# If the field doesn't have a default, then we punt to models.Field.
|
||||||
return super(PickledObjectField, self).get_default()
|
return super().get_default()
|
||||||
|
|
||||||
# def to_python(self, value):
|
# def to_python(self, value):
|
||||||
def from_db_value(self, value, *args):
|
def from_db_value(self, value, *args):
|
||||||
|
|
@ -233,7 +233,7 @@ class PickledObjectField(models.Field):
|
||||||
return PickledFormField(**kwargs)
|
return PickledFormField(**kwargs)
|
||||||
|
|
||||||
def pre_save(self, model_instance, add):
|
def pre_save(self, model_instance, add):
|
||||||
value = super(PickledObjectField, self).pre_save(model_instance, add)
|
value = super().pre_save(model_instance, add)
|
||||||
return wrap_conflictual_object(value)
|
return wrap_conflictual_object(value)
|
||||||
|
|
||||||
def get_db_prep_value(self, value, connection=None, prepared=False):
|
def get_db_prep_value(self, value, connection=None, prepared=False):
|
||||||
|
|
@ -269,5 +269,5 @@ class PickledObjectField(models.Field):
|
||||||
raise TypeError('Lookup type %s is not supported.' % lookup_type)
|
raise TypeError('Lookup type %s is not supported.' % lookup_type)
|
||||||
# The Field model already calls get_db_prep_value before doing the
|
# The Field model already calls get_db_prep_value before doing the
|
||||||
# actual lookup, so all we need to do is limit the lookup types.
|
# actual lookup, so all we need to do is limit the lookup types.
|
||||||
return super(PickledObjectField, self).get_db_prep_lookup(
|
return super().get_db_prep_lookup(
|
||||||
lookup_type, value, connection=connection, prepared=prepared)
|
lookup_type, value, connection=connection, prepared=prepared)
|
||||||
|
|
|
||||||
|
|
@ -65,4 +65,4 @@ class EvenniaTest(TestCase):
|
||||||
del SESSIONS[self.session.sessid]
|
del SESSIONS[self.session.sessid]
|
||||||
self.account.delete()
|
self.account.delete()
|
||||||
self.account2.delete()
|
self.account2.delete()
|
||||||
super(EvenniaTest, self).tearDown()
|
super().tearDown()
|
||||||
|
|
|
||||||
|
|
@ -1807,13 +1807,13 @@ class LimitedSizeOrderedDict(OrderedDict):
|
||||||
in FIFO order. If `False`, remove in FILO order.
|
in FIFO order. If `False`, remove in FILO order.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(LimitedSizeOrderedDict, self).__init__()
|
super().__init__()
|
||||||
self.size_limit = kwargs.get("size_limit", None)
|
self.size_limit = kwargs.get("size_limit", None)
|
||||||
self.filo = not kwargs.get("fifo", True) # FIFO inverse of FILO
|
self.filo = not kwargs.get("fifo", True) # FIFO inverse of FILO
|
||||||
self._check_size()
|
self._check_size()
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
ret = super(LimitedSizeOrderedDict, self).__eq__(other)
|
ret = super().__eq__(other)
|
||||||
if ret:
|
if ret:
|
||||||
return (ret and
|
return (ret and
|
||||||
hasattr(other, 'size_limit') and self.size_limit == other.size_limit and
|
hasattr(other, 'size_limit') and self.size_limit == other.size_limit and
|
||||||
|
|
@ -1830,11 +1830,11 @@ class LimitedSizeOrderedDict(OrderedDict):
|
||||||
self.popitem(last=filo)
|
self.popitem(last=filo)
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
super(LimitedSizeOrderedDict, self).__setitem__(key, value)
|
super().__setitem__(key, value)
|
||||||
self._check_size()
|
self._check_size()
|
||||||
|
|
||||||
def update(self, *args, **kwargs):
|
def update(self, *args, **kwargs):
|
||||||
super(LimitedSizeOrderedDict, self).update(*args, **kwargs)
|
super().update(*args, **kwargs)
|
||||||
self._check_size()
|
self._check_size()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue