diff --git a/evennia/accounts/accounts.py b/evennia/accounts/accounts.py index aa6852438..277cd6457 100644 --- a/evennia/accounts/accounts.py +++ b/evennia/accounts/accounts.py @@ -381,7 +381,7 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)): self.attributes.clear() self.nicks.clear() self.aliases.clear() - super(DefaultAccount, self).delete(*args, **kwargs) + super().delete(*args, **kwargs) # methods inherited from database model 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 = 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) self.at_access(result, accessing_obj, access_type, **kwargs) return result @@ -979,7 +979,7 @@ class DefaultGuest(DefaultAccount): We repeat the functionality of `at_disconnect()` here just to be on the safe side. """ - super(DefaultGuest, self).at_server_shutdown() + super().at_server_shutdown() characters = self.db._playable_characters for character in characters: if character: @@ -995,7 +995,7 @@ class DefaultGuest(DefaultAccount): overriding the call (unused by default). """ - super(DefaultGuest, self).at_post_disconnect() + super().at_post_disconnect() characters = self.db._playable_characters for character in characters: if character: diff --git a/evennia/accounts/bots.py b/evennia/accounts/bots.py index f772e7c4d..6d605ad6b 100644 --- a/evennia/accounts/bots.py +++ b/evennia/accounts/bots.py @@ -118,14 +118,14 @@ class Bot(DefaultAccount): 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): """ Incoming protocol -> Evennia """ - super(Bot, self).msg(raw_string, session=session) + super().msg(raw_string, session=session) def at_server_shutdown(self): """ @@ -226,7 +226,7 @@ class IRCBot(Bot): if not hasattr(self, "_nicklist_callers"): self._nicklist_callers = [] self._nicklist_callers.append(caller) - super(IRCBot, self).msg(request_nicklist="") + super().msg(request_nicklist="") return def ping(self, caller): @@ -240,7 +240,7 @@ class IRCBot(Bot): if not hasattr(self, "_ping_callers"): self._ping_callers = [] self._ping_callers.append(caller) - super(IRCBot, self).msg(ping="") + super().msg(ping="") def reconnect(self): """ @@ -248,7 +248,7 @@ class IRCBot(Bot): having to destroy/recreate the bot "account". """ - super(IRCBot, self).msg(reconnect="") + super().msg(reconnect="") def msg(self, text=None, **kwargs): """ @@ -270,7 +270,7 @@ class IRCBot(Bot): 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 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): """ @@ -336,7 +336,7 @@ class IRCBot(Bot): text = "This is an Evennia IRC bot connecting from '%s'." % settings.SERVERNAME else: text = "I understand 'who' and 'about'." - super(IRCBot, self).msg(privmsg=((text,), {"user": user})) + super().msg(privmsg=((text,), {"user": user})) else: # something to send to the main channel if kwargs["type"] == "action": diff --git a/evennia/commands/cmdset.py b/evennia/commands/cmdset.py index c363f87f8..c170d40a3 100644 --- a/evennia/commands/cmdset.py +++ b/evennia/commands/cmdset.py @@ -54,7 +54,7 @@ class _CmdSetMeta(type): if not isinstance(cls.key_mergetypes, dict): cls.key_mergetypes = {} - super(_CmdSetMeta, cls).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) class CmdSet(with_metaclass(_CmdSetMeta, object)): diff --git a/evennia/commands/command.py b/evennia/commands/command.py index 094934a02..ab4fb9043 100644 --- a/evennia/commands/command.py +++ b/evennia/commands/command.py @@ -82,7 +82,7 @@ class CommandMeta(type): """ def __init__(cls, *args, **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 # defining new commands, the admin subclass this class and diff --git a/evennia/commands/default/account.py b/evennia/commands/default/account.py index ecde6d8b3..d09ab08b6 100644 --- a/evennia/commands/default/account.py +++ b/evennia/commands/default/account.py @@ -46,7 +46,7 @@ class MuxAccountLookCommand(COMMAND_DEFAULT_CLASS): def parse(self): """Custom parsing""" - super(MuxAccountLookCommand, self).parse() + super().parse() if _MULTISESSION_MODE < 2: # only one character allowed - not used in this mode diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index 5b19f2006..581a7f756 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -71,7 +71,7 @@ class ObjManipCommand(COMMAND_DEFAULT_CLASS): the cases, see the module doc. """ # get all the normal parsing done (switches etc) - super(ObjManipCommand, self).parse() + super().parse() obj_defs = ([], []) # stores left- and right-hand side of '=' obj_attrs = ([], []) # " @@ -1079,7 +1079,7 @@ class CmdUnLink(CmdLink): self.rhs = "" # call the @link functionality - super(CmdUnLink, self).func() + super().func() class CmdSetHome(CmdLink): diff --git a/evennia/commands/default/muxcommand.py b/evennia/commands/default/muxcommand.py index 5d8d4b289..67a61aad6 100644 --- a/evennia/commands/default/muxcommand.py +++ b/evennia/commands/default/muxcommand.py @@ -30,7 +30,7 @@ class MuxCommand(Command): We just show it here for completeness - we 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): """ @@ -197,7 +197,7 @@ class MuxAccountCommand(MuxCommand): """ 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"): # caller is an Object/Character diff --git a/evennia/commands/default/tests.py b/evennia/commands/default/tests.py index 7d79e6ad5..fee9d1bd3 100644 --- a/evennia/commands/default/tests.py +++ b/evennia/commands/default/tests.py @@ -369,7 +369,7 @@ class TestBuilding(CommandTest): class TestComms(CommandTest): 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) def test_toggle_com(self): diff --git a/evennia/commands/tests.py b/evennia/commands/tests.py index 0e465e377..5df671dbb 100644 --- a/evennia/commands/tests.py +++ b/evennia/commands/tests.py @@ -14,7 +14,7 @@ class _CmdA(Command): key = "A" def __init__(self, cmdset, *args, **kwargs): - super(_CmdA, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.from_cmdset = cmdset @@ -22,7 +22,7 @@ class _CmdB(Command): key = "B" def __init__(self, cmdset, *args, **kwargs): - super(_CmdB, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.from_cmdset = cmdset @@ -30,7 +30,7 @@ class _CmdC(Command): key = "C" def __init__(self, cmdset, *args, **kwargs): - super(_CmdC, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.from_cmdset = cmdset @@ -38,7 +38,7 @@ class _CmdD(Command): key = "D" def __init__(self, cmdset, *args, **kwargs): - super(_CmdD, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.from_cmdset = cmdset @@ -85,7 +85,7 @@ class TestCmdSetMergers(TestCase): "Test merging of cmdsets" def setUp(self): - super(TestCmdSetMergers, self).setUp() + super().setUp() self.cmdset_a = _CmdSetA() self.cmdset_b = _CmdSetB() self.cmdset_c = _CmdSetC() @@ -272,7 +272,7 @@ class TestGetAndMergeCmdSets(TwistedTestCase, EvenniaTest): "Test the cmdhandler.get_and_merge_cmdsets function." def setUp(self): - super(TestGetAndMergeCmdSets, self).setUp() + super().setUp() self.cmdset_a = _CmdSetA() self.cmdset_b = _CmdSetB() self.cmdset_c = _CmdSetC() diff --git a/evennia/comms/admin.py b/evennia/comms/admin.py index 29a02507c..f9ef82baa 100644 --- a/evennia/comms/admin.py +++ b/evennia/comms/admin.py @@ -94,7 +94,7 @@ class ChannelAdmin(admin.ModelAdmin): from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse 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) diff --git a/evennia/comms/comms.py b/evennia/comms/comms.py index 56cd05472..47f72cf20 100644 --- a/evennia/comms/comms.py +++ b/evennia/comms/comms.py @@ -220,7 +220,7 @@ class DefaultChannel(with_metaclass(TypeclassBase, ChannelDB)): """ self.attributes.clear() self.aliases.clear() - super(DefaultChannel, self).delete() + super().delete() from evennia.comms.channelhandler import CHANNELHANDLER CHANNELHANDLER.update() diff --git a/evennia/contrib/chargen.py b/evennia/contrib/chargen.py index 19689e42b..9bbeded6e 100644 --- a/evennia/contrib/chargen.py +++ b/evennia/contrib/chargen.py @@ -116,7 +116,7 @@ class CmdOOCLook(default_cmds.CmdLook): # not ooc mode - leave back to normal look # we have to put this back for normal look to work. self.caller = self.character - super(CmdOOCLook, self).func() + super().func() class CmdOOCCharacterCreate(Command): diff --git a/evennia/contrib/clothing.py b/evennia/contrib/clothing.py index dd61c5f3d..608fa0aa0 100644 --- a/evennia/contrib/clothing.py +++ b/evennia/contrib/clothing.py @@ -684,7 +684,7 @@ class ClothedCharacterCmdSet(default_cmds.CharacterCmdSet): """ Populates the cmdset """ - super(ClothedCharacterCmdSet, self).at_cmdset_creation() + super().at_cmdset_creation() # # any commands you add below will overload the default ones. # diff --git a/evennia/contrib/egi_client/service.py b/evennia/contrib/egi_client/service.py index 8f8ce2bbb..c18e89877 100644 --- a/evennia/contrib/egi_client/service.py +++ b/evennia/contrib/egi_client/service.py @@ -26,7 +26,7 @@ class EvenniaGameIndexService(Service): self.loop = LoopingCall(self.client.send_game_details) def startService(self): - super(EvenniaGameIndexService, self).startService() + super().startService() # TODO: Check to make sure that the client is configured. # 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. @@ -38,7 +38,7 @@ class EvenniaGameIndexService(Service): if self.running == 0: # @reload errors if we've stopped this service. return - super(EvenniaGameIndexService, self).stopService() + super().stopService() if self.loop.running: self.loop.stop() diff --git a/evennia/contrib/email_login.py b/evennia/contrib/email_login.py index c98bf4aa8..aeb34cd72 100644 --- a/evennia/contrib/email_login.py +++ b/evennia/contrib/email_login.py @@ -138,7 +138,7 @@ class CmdUnconnectedCreate(MuxCommand): name enclosed in quotes: connect "Long name with many words" my@myserv.com mypassw """ - super(CmdUnconnectedCreate, self).parse() + super().parse() self.accountinfo = [] if len(self.arglist) < 3: diff --git a/evennia/contrib/extended_room.py b/evennia/contrib/extended_room.py index 7204fa752..21ceb8bba 100644 --- a/evennia/contrib/extended_room.py +++ b/evennia/contrib/extended_room.py @@ -264,7 +264,7 @@ class ExtendedRoom(DefaultRoom): # and re-save the description again. self.db.desc = self.replace_timeslots(self.db.raw_desc, curr_timeslot) # 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 diff --git a/evennia/contrib/gendersub.py b/evennia/contrib/gendersub.py index 205f9a991..2aa4dc92a 100644 --- a/evennia/contrib/gendersub.py +++ b/evennia/contrib/gendersub.py @@ -92,7 +92,7 @@ class GenderCharacter(DefaultCharacter): """ Called once when the object is created. """ - super(GenderCharacter, self).at_object_creation() + super().at_object_creation() self.db.gender = "ambiguous" def _get_pronoun(self, regex_match): @@ -139,4 +139,4 @@ class GenderCharacter(DefaultCharacter): text = _RE_GENDER_PRONOUN.sub(self._get_pronoun, text) except TypeError: pass - super(GenderCharacter, self).msg(text, from_obj=from_obj, session=session, **kwargs) + super().msg(text, from_obj=from_obj, session=session, **kwargs) diff --git a/evennia/contrib/ingame_python/tests.py b/evennia/contrib/ingame_python/tests.py index 15a8a45da..5f6fe6ec5 100644 --- a/evennia/contrib/ingame_python/tests.py +++ b/evennia/contrib/ingame_python/tests.py @@ -30,7 +30,7 @@ class TestEventHandler(EvenniaTest): def setUp(self): """Create the event handler.""" - super(TestEventHandler, self).setUp() + super().setUp() self.handler = create_script( "evennia.contrib.ingame_python.scripts.EventHandler") @@ -51,7 +51,7 @@ class TestEventHandler(EvenniaTest): OLD_EVENTS.update(self.handler.ndb.events) self.handler.stop() CallbackHandler.script = None - super(TestEventHandler, self).tearDown() + super().tearDown() def test_start(self): """Simply make sure the handler runs with proper initial values.""" @@ -248,7 +248,7 @@ class TestCmdCallback(CommandTest): def setUp(self): """Create the callback handler.""" - super(TestCmdCallback, self).setUp() + super().setUp() self.handler = create_script( "evennia.contrib.ingame_python.scripts.EventHandler") @@ -273,7 +273,7 @@ class TestCmdCallback(CommandTest): script.stop() CallbackHandler.script = None - super(TestCmdCallback, self).tearDown() + super().tearDown() def test_list(self): """Test listing callbacks with different rights.""" @@ -413,7 +413,7 @@ class TestDefaultCallbacks(CommandTest): def setUp(self): """Create the callback handler.""" - super(TestDefaultCallbacks, self).setUp() + super().setUp() self.handler = create_script( "evennia.contrib.ingame_python.scripts.EventHandler") @@ -434,7 +434,7 @@ class TestDefaultCallbacks(CommandTest): OLD_EVENTS.update(self.handler.ndb.events) self.handler.stop() CallbackHandler.script = None - super(TestDefaultCallbacks, self).tearDown() + super().tearDown() def test_exit(self): """Test the callbacks of an exit.""" diff --git a/evennia/contrib/ingame_python/typeclasses.py b/evennia/contrib/ingame_python/typeclasses.py index 33729bef6..31b758eeb 100644 --- a/evennia/contrib/ingame_python/typeclasses.py +++ b/evennia/contrib/ingame_python/typeclasses.py @@ -223,7 +223,7 @@ class EventCharacter(DefaultCharacter): if not string: 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): """ @@ -278,7 +278,7 @@ class EventCharacter(DefaultCharacter): if not string: 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): """ @@ -328,7 +328,7 @@ class EventCharacter(DefaultCharacter): 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 destination = self.location @@ -367,7 +367,7 @@ class EventCharacter(DefaultCharacter): puppeting this Object. """ - super(EventCharacter, self).at_post_puppet() + super().at_post_puppet() self.callbacks.call("puppeted", self) @@ -395,7 +395,7 @@ class EventCharacter(DefaultCharacter): if location and isinstance(location, DefaultRoom): location.callbacks.call("unpuppeted_in", self, location) - super(EventCharacter, self).at_pre_unpuppet() + super().at_pre_unpuppet() 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 = location if location and inherits_from(location, "evennia.objects.objects.DefaultRoom") else None @@ -624,7 +624,7 @@ class EventExit(DefaultExit): if not allow: return - super(EventExit, self).at_traverse(traversing_object, target_location) + super().at_traverse(traversing_object, target_location) # After traversing if is_character: @@ -703,7 +703,7 @@ class EventObject(DefaultObject): permissions for that. """ - super(EventObject, self).at_get(getter) + super().at_get(getter) self.callbacks.call("get", getter, self) def at_drop(self, dropper): @@ -719,7 +719,7 @@ class EventObject(DefaultObject): permissions from that. """ - super(EventObject, self).at_drop(dropper) + super().at_drop(dropper) self.callbacks.call("drop", dropper, self) diff --git a/evennia/contrib/rpsystem.py b/evennia/contrib/rpsystem.py index e3ea6b84e..574e6b07e 100644 --- a/evennia/contrib/rpsystem.py +++ b/evennia/contrib/rpsystem.py @@ -76,7 +76,7 @@ Verbose Installation Instructions: Change "class Character(DefaultCharacter):" to `class Character(ContribRPCharacter):` 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`: Import the `ContribRPRoom` class: `from evennia.contrib.rpsystem import ContribRPRoom` @@ -1139,7 +1139,7 @@ class ContribRPObject(DefaultObject): """ Called at initial creation. """ - super(ContribRPObject, self).at_object_creation + super().at_object_creation() # emoting/recog data self.db.pose = "" @@ -1423,7 +1423,7 @@ class ContribRPCharacter(DefaultCharacter, ContribRPObject): """ Called at initial creation. """ - super(ContribRPCharacter, self).at_object_creation() + super().at_object_creation() self.db._sdesc = "" self.db._sdesc_regex = "" diff --git a/evennia/contrib/simpledoor.py b/evennia/contrib/simpledoor.py index d43d211fa..991c089c8 100644 --- a/evennia/contrib/simpledoor.py +++ b/evennia/contrib/simpledoor.py @@ -77,8 +77,8 @@ class SimpleDoor(DefaultExit): """ # we have to be careful to avoid a delete-loop. if self.db.return_exit: - super(SimpleDoor, self.db.return_exit).delete() - super(SimpleDoor, self).delete() + super().delete() + super().delete() return True def at_failed_traverse(self, traversing_object): @@ -103,7 +103,7 @@ class CmdOpen(default_cmds.CmdOpen): Simple wrapper for the default CmdOpen.create_exit """ # 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) if hasattr(self, "return_exit_already_created"): # we don't create a return exit if it was already created (because diff --git a/evennia/contrib/tests.py b/evennia/contrib/tests.py index d3534d03c..b97fb2492 100644 --- a/evennia/contrib/tests.py +++ b/evennia/contrib/tests.py @@ -25,7 +25,7 @@ text = "Automated testing is advantageous for a number of reasons:" \ class TestLanguage(EvenniaTest): def setUp(self): - super(TestLanguage, self).setUp() + super().setUp() rplanguage.add_language(key="testlang", word_length_variance=1, noun_prefix="bara", @@ -35,7 +35,7 @@ class TestLanguage(EvenniaTest): force=True) def tearDown(self): - super(TestLanguage, self).tearDown() + super().tearDown() rplanguage._LANGUAGE_HANDLER.delete() 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): def setUp(self): - super(TestRPSystem, self).setUp() + super().setUp() self.room = create_object(rpsystem.ContribRPRoom, key="Location") self.speaker = create_object(rpsystem.ContribRPCharacter, key="Sender", 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" def setUp(self): - super(TestExtendedRoom, self).setUp() + super().setUp() self.room1.ndb.last_timeslot = "afternoon" self.room1.ndb.last_season = "winter" self.room1.db.details = {'testdetail': self.DETAIL_DESC} @@ -244,7 +244,7 @@ from evennia.contrib import barter class TestBarter(CommandTest): def setUp(self): - super(TestBarter, self).setUp() + super().setUp() self.tradeitem1 = create_object(key="TradeItem1", location=self.char1) self.tradeitem2 = create_object(key="TradeItem2", location=self.char1) self.tradeitem3 = create_object(key="TradeItem3", location=self.char2) @@ -331,7 +331,7 @@ from evennia import DefaultCharacter class TestWilderness(EvenniaTest): def setUp(self): - super(TestWilderness, self).setUp() + super().setUp() self.char1 = create_object(DefaultCharacter, key="char1") self.char2 = create_object(DefaultCharacter, key="char2") @@ -564,7 +564,7 @@ def _testcallback(): class TestCustomGameTime(EvenniaTest): def setUp(self): - super(TestCustomGameTime, self).setUp() + super().setUp() gametime.gametime = Mock(return_value=2975000898.46) # does not seem to work def tearDown(self): diff --git a/evennia/contrib/turnbattle.py b/evennia/contrib/turnbattle.py index 692656bc3..90fccea78 100644 --- a/evennia/contrib/turnbattle.py +++ b/evennia/contrib/turnbattle.py @@ -541,7 +541,7 @@ class CmdCombatHelp(CmdHelp): "|wPass:|n Pass your turn without further action.|/" + "|wDisengage:|n End your turn and attempt to end combat.|/") else: - super(CmdCombatHelp, self).func() # Call the default help command + super().func() # Call the default help command class BattleCmdSet(default_cmds.CharacterCmdSet): diff --git a/evennia/contrib/turnbattle/tb_basic.py b/evennia/contrib/turnbattle/tb_basic.py index 70c81deba..f78ddf38c 100644 --- a/evennia/contrib/turnbattle/tb_basic.py +++ b/evennia/contrib/turnbattle/tb_basic.py @@ -541,7 +541,7 @@ class CmdCombatHelp(CmdHelp): "|wPass:|n Pass your turn without further action.|/" + "|wDisengage:|n End your turn and attempt to end combat.|/") else: - super(CmdCombatHelp, self).func() # Call the default help command + super().func() # Call the default help command class BattleCmdSet(default_cmds.CharacterCmdSet): diff --git a/evennia/contrib/turnbattle/tb_equip.py b/evennia/contrib/turnbattle/tb_equip.py index 7d9ea5844..1b13c8db1 100644 --- a/evennia/contrib/turnbattle/tb_equip.py +++ b/evennia/contrib/turnbattle/tb_equip.py @@ -658,7 +658,7 @@ class CmdCombatHelp(CmdHelp): "|wPass:|n Pass your turn without further action.|/" + "|wDisengage:|n End your turn and attempt to end combat.|/") else: - super(CmdCombatHelp, self).func() # Call the default help command + super().func() # Call the default help command class CmdWield(Command): """ diff --git a/evennia/contrib/tutorial_world/objects.py b/evennia/contrib/tutorial_world/objects.py index 1e836d5bb..779f37aba 100644 --- a/evennia/contrib/tutorial_world/objects.py +++ b/evennia/contrib/tutorial_world/objects.py @@ -51,7 +51,7 @@ class TutorialObject(DefaultObject): def at_object_creation(self): """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." def reset(self): @@ -124,7 +124,7 @@ class Readable(TutorialObject): Called when object is created. We make sure to set the needed 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.readable_text = "There is no text written on %s." % self.key # define a command on the object. @@ -222,7 +222,7 @@ class Obelisk(TutorialObject): def at_object_creation(self): """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.puzzle_descs = ["You see a normal stone slab"] # make sure this can never be picked up @@ -246,7 +246,7 @@ class Obelisk(TutorialObject): caller.db.puzzle_clue = clueindex # call the parent function as normal (this will use # 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): """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.is_giving_light = False self.db.burntime = 60 * 3 # 3 minutes @@ -602,7 +602,7 @@ class CrumblingWall(TutorialObject, DefaultExit): def at_object_creation(self): """called when the object is first created.""" - super(CrumblingWall, self).at_object_creation() + super().at_object_creation() self.aliases.add(["secret passage", "passage", "crack", "opening", "secret door"]) @@ -694,7 +694,7 @@ class CrumblingWall(TutorialObject, DefaultExit): self.db.desc = "".join(result) # 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): """ @@ -863,7 +863,7 @@ class Weapon(TutorialObject): def at_object_creation(self): """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.parry = 0.8 # parry chance self.db.damage = 1.0 diff --git a/evennia/contrib/tutorial_world/rooms.py b/evennia/contrib/tutorial_world/rooms.py index e78012460..5880e9daf 100644 --- a/evennia/contrib/tutorial_world/rooms.py +++ b/evennia/contrib/tutorial_world/rooms.py @@ -311,7 +311,7 @@ class WeatherRoom(TutorialRoom): the ticking of the room; the TickerHandler works fine for 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 # "update_weather" on this object. The interval is randomized # 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. """ - super(IntroRoom, self).at_object_creation() + super().at_object_creation() self.db.tutorial_info = "The first room of the tutorial. " \ "This assigns the health Attribute to "\ "the account." @@ -633,7 +633,7 @@ class BridgeRoom(WeatherRoom): """Setups the room""" # this will start the weather room's ticker and tell # 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 # needed to leave through that exit). These are defaults, but you # 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. """ - super(DarkRoom, self).at_object_creation() + super().at_object_creation() self.db.tutorial_info = "This is a room with custom command sets on itself." # the room starts dark. self.db.is_lit = False @@ -950,7 +950,7 @@ class TeleportRoom(TutorialRoom): def at_object_creation(self): """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. self.db.puzzle_value = 1 # target of successful teleportation. Can be a dbref or a @@ -1016,7 +1016,7 @@ class OutroRoom(TutorialRoom): """ 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. " \ "This cleans up all temporary Attributes " \ "the tutorial may have assigned to the "\ diff --git a/evennia/contrib/unixcommand.py b/evennia/contrib/unixcommand.py index 8ba538c57..0b63c288c 100644 --- a/evennia/contrib/unixcommand.py +++ b/evennia/contrib/unixcommand.py @@ -110,7 +110,7 @@ class UnixCommandParser(argparse.ArgumentParser): """ prog = prog or command.key - super(UnixCommandParser, self).__init__( + super().__init__( prog=prog, description=description, conflict_handler='resolve', add_help=False, **kwargs) self.command = command @@ -133,7 +133,7 @@ class UnixCommandParser(argparse.ArgumentParser): in order to avoid unintentional color codes. """ - return raw(super(UnixCommandParser, self).format_usage()) + return raw(super().format_usage()) def format_help(self): """Return the parser help, including its epilog. @@ -144,7 +144,7 @@ class UnixCommandParser(argparse.ArgumentParser): 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 def print_usage(self, file=None): @@ -234,7 +234,7 @@ class UnixCommand(Command): overloading evential same-named class properties. """ - super(UnixCommand, self).__init__(**kwargs) + super().__init__(**kwargs) # Create the empty UnixCommandParser, inheriting argparse.ArgumentParser lines = dedent(self.__doc__.strip("\n")).splitlines() diff --git a/evennia/game_template/commands/command.py b/evennia/game_template/commands/command.py index 529a8450e..c085025b8 100644 --- a/evennia/game_template/commands/command.py +++ b/evennia/game_template/commands/command.py @@ -70,7 +70,7 @@ class Command(BaseCommand): # We just show it here for completeness - we # 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): # """ diff --git a/evennia/game_template/commands/default_cmdsets.py b/evennia/game_template/commands/default_cmdsets.py index a2e5ffbf4..7633f14c4 100644 --- a/evennia/game_template/commands/default_cmdsets.py +++ b/evennia/game_template/commands/default_cmdsets.py @@ -29,7 +29,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet): """ Populates the cmdset """ - super(CharacterCmdSet, self).at_cmdset_creation() + super().at_cmdset_creation() # # any commands you add below will overload the default ones. # @@ -48,7 +48,7 @@ class AccountCmdSet(default_cmds.AccountCmdSet): """ Populates the cmdset """ - super(AccountCmdSet, self).at_cmdset_creation() + super().at_cmdset_creation() # # any commands you add below will overload the default ones. # @@ -65,7 +65,7 @@ class UnloggedinCmdSet(default_cmds.UnloggedinCmdSet): """ Populates the cmdset """ - super(UnloggedinCmdSet, self).at_cmdset_creation() + super().at_cmdset_creation() # # 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. It prints some info. """ - super(SessionCmdSet, self).at_cmdset_creation() + super().at_cmdset_creation() # # any commands you add below will overload the default ones. # diff --git a/evennia/objects/admin.py b/evennia/objects/admin.py index 007cfe21c..7e1d9056d 100644 --- a/evennia/objects/admin.py +++ b/evennia/objects/admin.py @@ -120,7 +120,7 @@ class ObjectDBAdmin(admin.ModelAdmin): """ if not obj: 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): """ @@ -138,7 +138,7 @@ class ObjectDBAdmin(admin.ModelAdmin): 'fields': flatten_fieldsets(self.add_fieldsets), }) 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): """ @@ -166,7 +166,7 @@ class ObjectDBAdmin(admin.ModelAdmin): from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse 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) diff --git a/evennia/objects/objects.py b/evennia/objects/objects.py index 23e65c31b..a35476423 100644 --- a/evennia/objects/objects.py +++ b/evennia/objects/objects.py @@ -877,7 +877,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): self.location = None # this updates contents_cache for our location # Perform the deletion of the object - super(DefaultObject, self).delete() + super().delete() return True 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. """ - 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) self.at_access(result, accessing_obj, access_type, **kwargs) return result @@ -1760,7 +1760,7 @@ class DefaultCharacter(DefaultObject): Character object works). """ - super(DefaultCharacter, self).basetype_setup() + super().basetype_setup() self.locks.add(";".join(["get:false()", # noone can pick up the character "call:false()"])) # no commands can be called on character from outside # 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()", "puppet:false()"])) # would be weird to puppet a room ... self.location = None @@ -1990,7 +1990,7 @@ class DefaultExit(DefaultObject): 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() self.locks.add(";".join(["puppet:false()", # would be weird to puppet an exit ... diff --git a/evennia/server/portal/portalsessionhandler.py b/evennia/server/portal/portalsessionhandler.py index 032fdfc5b..c06757b79 100644 --- a/evennia/server/portal/portalsessionhandler.py +++ b/evennia/server/portal/portalsessionhandler.py @@ -50,7 +50,7 @@ class PortalSessionHandler(SessionHandler): Init the handler """ - super(PortalSessionHandler, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.portal = None self.latest_sessid = 0 self.uptime = time.time() diff --git a/evennia/server/portal/ssh.py b/evennia/server/portal/ssh.py index 980839b62..34cc618e8 100644 --- a/evennia/server/portal/ssh.py +++ b/evennia/server/portal/ssh.py @@ -338,7 +338,7 @@ class AccountDBPasswordChecker(object): """ self.factory = factory - super(AccountDBPasswordChecker, self).__init__() + super().__init__() def requestAvatarId(self, c): """ diff --git a/evennia/server/portal/ssl.py b/evennia/server/portal/ssl.py index 761df6766..27703e43c 100644 --- a/evennia/server/portal/ssl.py +++ b/evennia/server/portal/ssl.py @@ -52,7 +52,7 @@ class SSLProtocol(TelnetProtocol): """ def __init__(self, *args, **kwargs): - super(SSLProtocol, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.protocol_name = "ssl" diff --git a/evennia/server/portal/telnet.py b/evennia/server/portal/telnet.py index ec41bbfc8..a75f9e275 100644 --- a/evennia/server/portal/telnet.py +++ b/evennia/server/portal/telnet.py @@ -35,7 +35,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session): def __init__(self, *args, **kwargs): self.protocol_name = "telnet" - super(TelnetProtocol, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def connectionMade(self): """ @@ -169,7 +169,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session): self.mccp.no_mccp(option) return True else: - return super(TelnetProtocol, self).disableLocal(option) + return super().disableLocal(option) def connectionLost(self, reason): """ @@ -220,7 +220,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session): def _write(self, data): """hook overloading the one used in plain telnet""" 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): """ diff --git a/evennia/server/portal/webclient_ajax.py b/evennia/server/portal/webclient_ajax.py index 02759b79f..414f0e72e 100644 --- a/evennia/server/portal/webclient_ajax.py +++ b/evennia/server/portal/webclient_ajax.py @@ -44,7 +44,7 @@ class LazyEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, Promise): return str(obj) - return super(LazyEncoder, self).default(obj) + return super().default(obj) def jsonify(obj): @@ -298,7 +298,7 @@ class AjaxWebClientSession(session.Session): def __init__(self, *args, **kwargs): self.protocol_name = "ajax/comet" - super(AjaxWebClientSession, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def get_client_session(self): """ diff --git a/evennia/server/sessionhandler.py b/evennia/server/sessionhandler.py index 89d6afde8..34030ade3 100644 --- a/evennia/server/sessionhandler.py +++ b/evennia/server/sessionhandler.py @@ -104,22 +104,22 @@ class SessionHandler(dict): "Clean out None-sessions automatically." if None in self: del self[None] - return super(SessionHandler, self).__getitem__(key) + return super().__getitem__(key) def get(self, key, default=None): "Clean out None-sessions automatically." if None in self: del self[None] - return super(SessionHandler, self).get(key, default) + return super().get(key, default) def __setitem__(self, key, value): "Don't assign None sessions" if key is not None: - super(SessionHandler, self).__setitem__(key, value) + super().__setitem__(key, value) def __contains__(self, key): "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): """ @@ -267,7 +267,7 @@ class ServerSessionHandler(SessionHandler): Init the handler. """ - super(ServerSessionHandler, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.server = None self.server_data = {"servername": _SERVERNAME} diff --git a/evennia/server/tests.py b/evennia/server/tests.py index 7b39a2d7f..db861573f 100644 --- a/evennia/server/tests.py +++ b/evennia/server/tests.py @@ -45,4 +45,4 @@ class EvenniaTestSuiteRunner(DiscoverRunner): """ import evennia 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) diff --git a/evennia/typeclasses/admin.py b/evennia/typeclasses/admin.py index c5dd481f9..d6ef39734 100644 --- a/evennia/typeclasses/admin.py +++ b/evennia/typeclasses/admin.py @@ -48,7 +48,7 @@ class TagForm(forms.ModelForm): the corresponding tag fields. The initial data of the form fields will similarly be populated. """ - super(TagForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) tagkey = None tagcategory = 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 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.tag_key = self.cleaned_data['tag_key'] instance.tag_category = self.cleaned_data['tag_category'] or None @@ -109,7 +109,7 @@ class TagFormSet(forms.BaseInlineFormSet): else: handler_name = "tags" 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 for obj in self.deleted_objects: 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 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): pass @@ -190,7 +190,7 @@ class AttributeForm(forms.ModelForm): similarly be populated. """ - super(AttributeForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) attr_key = None attr_category = None attr_value = None @@ -255,7 +255,7 @@ class AttributeFormSet(forms.BaseInlineFormSet): else: handler_name = "attributes" 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 for obj in self.deleted_objects: 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 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): pass diff --git a/evennia/typeclasses/attributes.py b/evennia/typeclasses/attributes.py index 1d3b82022..5bae73573 100644 --- a/evennia/typeclasses/attributes.py +++ b/evennia/typeclasses/attributes.py @@ -800,7 +800,7 @@ class NickHandler(AttributeHandler): _attrtype = "nick" def __init__(self, *args, **kwargs): - super(NickHandler, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._regex_cache = {} def has(self, key, category="inputline"): @@ -816,7 +816,7 @@ class NickHandler(AttributeHandler): 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): """ @@ -836,9 +836,9 @@ class NickHandler(AttributeHandler): """ 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: - retval = super(NickHandler, self).get(key=key, category=category, **kwargs) + retval = super().get(key=key, category=category, **kwargs) if retval: return retval[3] if isinstance(retval, tuple) else \ [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") else: 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) def remove(self, key, category="inputline", **kwargs): @@ -876,7 +876,7 @@ class NickHandler(AttributeHandler): 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): """ diff --git a/evennia/typeclasses/managers.py b/evennia/typeclasses/managers.py index 47293eaa5..7bd2a406a 100644 --- a/evennia/typeclasses/managers.py +++ b/evennia/typeclasses/managers.py @@ -390,7 +390,7 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): the given dbref ranges. """ - retval = super(TypedObjectManager, self).all() + retval = super().all() if min_dbref is not None: retval = retval.filter(id__gte=self.dbref(min_dbref, reqhash=False)) if max_dbref is not None: @@ -545,7 +545,7 @@ class TypeclassManager(TypedObjectManager): """ kwargs.update({"db_typeclass_path": self.model.path}) - return super(TypeclassManager, self).get(**kwargs) + return super().get(**kwargs) def filter(self, *args, **kwargs): """ @@ -563,7 +563,7 @@ class TypeclassManager(TypedObjectManager): """ kwargs.update({"db_typeclass_path": self.model.path}) - return super(TypeclassManager, self).filter(*args, **kwargs) + return super().filter(*args, **kwargs) def all(self): """ @@ -573,7 +573,7 @@ class TypeclassManager(TypedObjectManager): 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): """ @@ -587,7 +587,7 @@ class TypeclassManager(TypedObjectManager): 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): """ @@ -601,7 +601,7 @@ class TypeclassManager(TypedObjectManager): 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): """ @@ -611,7 +611,7 @@ class TypeclassManager(TypedObjectManager): 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): """ @@ -644,7 +644,7 @@ class TypeclassManager(TypedObjectManager): paths = [self.model.path] + ["%s.%s" % (cls.__module__, cls.__name__) for cls in self._get_subclasses(self.model)] kwargs.update({"db_typeclass_path__in": paths}) - return super(TypeclassManager, self).get(**kwargs) + return super().get(**kwargs) def filter_family(self, *args, **kwargs): """ @@ -665,7 +665,7 @@ class TypeclassManager(TypedObjectManager): paths = [self.model.path] + ["%s.%s" % (cls.__module__, cls.__name__) for cls in self._get_subclasses(self.model)] kwargs.update({"db_typeclass_path__in": paths}) - return super(TypeclassManager, self).filter(*args, **kwargs) + return super().filter(*args, **kwargs) def all_family(self): """ @@ -678,4 +678,4 @@ class TypeclassManager(TypedObjectManager): """ paths = [self.model.path] + ["%s.%s" % (cls.__module__, cls.__name__) 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) diff --git a/evennia/typeclasses/models.py b/evennia/typeclasses/models.py index dbe48d770..4dad9aa03 100644 --- a/evennia/typeclasses/models.py +++ b/evennia/typeclasses/models.py @@ -256,7 +256,7 @@ class TypedObject(SharedMemoryModel): """ 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) # initialize all handlers in a lazy fashion @@ -604,7 +604,7 @@ class TypedObject(SharedMemoryModel): self.nicks.clear() # scrambling properties self.delete = self._deleted - super(TypedObject, self).delete() + super().delete() # # Attribute storage diff --git a/evennia/utils/ansi.py b/evennia/utils/ansi.py index e69845abb..a63a11a2d 100644 --- a/evennia/utils/ansi.py +++ b/evennia/utils/ansi.py @@ -630,7 +630,7 @@ class ANSIMeta(type): for func_name in [ 'capitalize', 'translate', 'lower', 'upper', 'swapcase']: setattr(cls, func_name, _transform(func_name)) - super(ANSIMeta, cls).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) class ANSIString(with_metaclass(ANSIMeta, str)): @@ -708,7 +708,7 @@ class ANSIString(with_metaclass(ANSIMeta, str)): if not isinstance(string, str): 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._clean_string = clean_string ansi_string._code_indexes = code_indexes @@ -764,7 +764,7 @@ class ANSIString(with_metaclass(ANSIMeta, str)): """ self.parser = kwargs.pop('parser', ANSI_PARSER) - super(ANSIString, self).__init__() + super().__init__() if self._code_indexes is None: self._code_indexes, self._char_indexes = self._get_indexes() diff --git a/evennia/utils/dbserialize.py b/evennia/utils/dbserialize.py index dfc184d06..c4bc141a4 100644 --- a/evennia/utils/dbserialize.py +++ b/evennia/utils/dbserialize.py @@ -233,7 +233,7 @@ class _SaverList(_SaverMutable, MutableSequence): """ def __init__(self, *args, **kwargs): - super(_SaverList, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._data = list() @_save @@ -268,7 +268,7 @@ class _SaverDict(_SaverMutable, MutableMapping): """ def __init__(self, *args, **kwargs): - super(_SaverDict, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._data = dict() def has_key(self, key): @@ -281,7 +281,7 @@ class _SaverSet(_SaverMutable, MutableSet): """ def __init__(self, *args, **kwargs): - super(_SaverSet, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._data = set() def __contains__(self, value): @@ -302,7 +302,7 @@ class _SaverOrderedDict(_SaverMutable, MutableMapping): """ def __init__(self, *args, **kwargs): - super(_SaverOrderedDict, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._data = OrderedDict() def has_key(self, key): @@ -315,7 +315,7 @@ class _SaverDeque(_SaverMutable): """ def __init__(self, *args, **kwargs): - super(_SaverDeque, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._data = deque() @_save diff --git a/evennia/utils/idmapper/manager.py b/evennia/utils/idmapper/manager.py index 9053149e8..57eb546b0 100644 --- a/evennia/utils/idmapper/manager.py +++ b/evennia/utils/idmapper/manager.py @@ -33,5 +33,5 @@ class SharedMemoryManager(Manager): except Exception: pass if inst is None: - inst = super(SharedMemoryManager, self).get(*args, **kwargs) + inst = super().get(*args, **kwargs) return inst diff --git a/evennia/utils/idmapper/models.py b/evennia/utils/idmapper/models.py index 326c387f5..8da63663d 100644 --- a/evennia/utils/idmapper/models.py +++ b/evennia/utils/idmapper/models.py @@ -85,7 +85,7 @@ class SharedMemoryModelBase(ModelBase): if not hasattr(dbmodel, "__instance_cache__"): # we store __instance_cache__ only on the dbmodel base dbmodel.__instance_cache__ = {} - super(SharedMemoryModelBase, cls)._prepare() + super()._prepare() def __new__(cls, name, bases, attrs): """ @@ -203,7 +203,7 @@ class SharedMemoryModelBase(ModelBase): # makes sure not to overload manually created wrappers on the model 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)): @@ -364,7 +364,7 @@ class SharedMemoryModel(with_metaclass(SharedMemoryModelBase, Model)): """ self.flush_from_cache() self._is_deleted = True - super(SharedMemoryModel, self).delete(*args, **kwargs) + super().delete(*args, **kwargs) def save(self, *args, **kwargs): """ @@ -390,11 +390,11 @@ class SharedMemoryModel(with_metaclass(SharedMemoryModelBase, Model)): if _IS_MAIN_THREAD: # in main thread - normal operation - super(SharedMemoryModel, self).save(*args, **kwargs) + super().save(*args, **kwargs) else: # in another thread; make sure to save in reactor thread def _save_callback(cls, *args, **kwargs): - super(SharedMemoryModel, cls).save(*args, **kwargs) + super().save(*args, **kwargs) callFromThread(_save_callback, self, *args, **kwargs) # update field-update hooks and eventual OOB watchers @@ -429,7 +429,7 @@ class WeakSharedMemoryModelBase(SharedMemoryModelBase): """ def _prepare(cls): - super(WeakSharedMemoryModelBase, cls)._prepare() + super()._prepare() cls.__dbclass__.__instance_cache__ = WeakValueDictionary() diff --git a/evennia/utils/idmapper/tests.py b/evennia/utils/idmapper/tests.py index 374eb0187..36a612e71 100644 --- a/evennia/utils/idmapper/tests.py +++ b/evennia/utils/idmapper/tests.py @@ -31,7 +31,7 @@ class SharedMemorysTest(TestCase): # TODO: test for cross model relation (singleton to regular) def setUp(self): - super(SharedMemorysTest, self).setUp() + super().setUp() n = 0 category = Category.objects.create(name="Category %d" % (n,)) regcategory = RegularCategory.objects.create(name="Category %d" % (n,)) diff --git a/evennia/utils/inlinefuncs.py b/evennia/utils/inlinefuncs.py index 118f4fea5..919c291c3 100644 --- a/evennia/utils/inlinefuncs.py +++ b/evennia/utils/inlinefuncs.py @@ -224,14 +224,14 @@ class ParseStack(list): """ def __init__(self, *args, **kwargs): - super(ParseStack, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # always start stack with the empty string list.append(self, "") # indicates if the top of the stack is a string or not self._string_last = True 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) def __ne__(self, other): diff --git a/evennia/utils/picklefield.py b/evennia/utils/picklefield.py index 61ed452c1..d7fc256e8 100644 --- a/evennia/utils/picklefield.py +++ b/evennia/utils/picklefield.py @@ -151,7 +151,7 @@ class PickledFormField(CharField): def __init__(self, *args, **kwargs): # This needs to fall through to literal_eval. kwargs['required'] = False - super(PickledFormField, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def clean(self, value): try: @@ -184,7 +184,7 @@ class PickledObjectField(models.Field): def __init__(self, *args, **kwargs): self.compress = kwargs.pop('compress', False) self.protocol = kwargs.pop('protocol', DEFAULT_PROTOCOL) - super(PickledObjectField, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def get_default(self): """ @@ -203,7 +203,7 @@ class PickledObjectField(models.Field): return self.default() return self.default # 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 from_db_value(self, value, *args): @@ -233,7 +233,7 @@ class PickledObjectField(models.Field): return PickledFormField(**kwargs) 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) 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) # 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. - return super(PickledObjectField, self).get_db_prep_lookup( + return super().get_db_prep_lookup( lookup_type, value, connection=connection, prepared=prepared) diff --git a/evennia/utils/test_resources.py b/evennia/utils/test_resources.py index b4124b721..2fdebaa85 100644 --- a/evennia/utils/test_resources.py +++ b/evennia/utils/test_resources.py @@ -65,4 +65,4 @@ class EvenniaTest(TestCase): del SESSIONS[self.session.sessid] self.account.delete() self.account2.delete() - super(EvenniaTest, self).tearDown() + super().tearDown() diff --git a/evennia/utils/utils.py b/evennia/utils/utils.py index 832b8a01e..956225385 100644 --- a/evennia/utils/utils.py +++ b/evennia/utils/utils.py @@ -1807,13 +1807,13 @@ class LimitedSizeOrderedDict(OrderedDict): in FIFO order. If `False`, remove in FILO order. """ - super(LimitedSizeOrderedDict, self).__init__() + super().__init__() self.size_limit = kwargs.get("size_limit", None) self.filo = not kwargs.get("fifo", True) # FIFO inverse of FILO self._check_size() def __eq__(self, other): - ret = super(LimitedSizeOrderedDict, self).__eq__(other) + ret = super().__eq__(other) if ret: return (ret and hasattr(other, 'size_limit') and self.size_limit == other.size_limit and @@ -1830,11 +1830,11 @@ class LimitedSizeOrderedDict(OrderedDict): self.popitem(last=filo) def __setitem__(self, key, value): - super(LimitedSizeOrderedDict, self).__setitem__(key, value) + super().__setitem__(key, value) self._check_size() def update(self, *args, **kwargs): - super(LimitedSizeOrderedDict, self).update(*args, **kwargs) + super().update(*args, **kwargs) self._check_size()