Change to use super() instead of the old py2 style everywhere
This commit is contained in:
parent
55237f20a7
commit
5859de7054
33 changed files with 69 additions and 70 deletions
|
|
@ -26,7 +26,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
ref: v0.9.5
|
ref: v0.9.5
|
||||||
|
|
||||||
- name: Checkout develop branch
|
- name: Checkout ${{ github.ref }} branch
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
|
@ -56,6 +56,5 @@ jobs:
|
||||||
git config --global user.email "docbuilder@evennia.com"
|
git config --global user.email "docbuilder@evennia.com"
|
||||||
git config --global user.name "Evennia docbuilder action"
|
git config --global user.name "Evennia docbuilder action"
|
||||||
git branch
|
git branch
|
||||||
git checkout develop
|
|
||||||
cd docs
|
cd docs
|
||||||
make release
|
make release
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ that will edit any default object, offering to change its key and description.
|
||||||
key = "DefaultCharacter"
|
key = "DefaultCharacter"
|
||||||
|
|
||||||
def at_cmdset_creation(self):
|
def at_cmdset_creation(self):
|
||||||
super(CharacterCmdSet, self).at_cmdset_creation()
|
super().at_cmdset_creation()
|
||||||
# ... add the line below
|
# ... add the line below
|
||||||
self.add(GenericBuildingCmd())
|
self.add(GenericBuildingCmd())
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
||||||
"""
|
"""
|
||||||
Populates the cmdset
|
Populates the cmdset
|
||||||
"""
|
"""
|
||||||
super(CharacterCmdSet, self).at_cmdset_creation()
|
super().at_cmdset_creation()
|
||||||
self.add(CmdCallback())
|
self.add(CmdCallback())
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -664,7 +664,7 @@ class DefaultAccount(AccountDB, metaclass=TypeclassBase):
|
||||||
could get invalidated.
|
could get invalidated.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(DefaultAccount, self).set_password(password)
|
super().set_password(password)
|
||||||
logger.log_sec(f"Password successfully changed for {self}.")
|
logger.log_sec(f"Password successfully changed for {self}.")
|
||||||
self.at_password_change()
|
self.at_password_change()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ class TestDefaultGuest(BaseEvenniaTest):
|
||||||
|
|
||||||
class TestDefaultAccountAuth(BaseEvenniaTest):
|
class TestDefaultAccountAuth(BaseEvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestDefaultAccountAuth, self).setUp()
|
super().setUp()
|
||||||
|
|
||||||
self.password = "testpassword"
|
self.password = "testpassword"
|
||||||
self.account.delete()
|
self.account.delete()
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
|
||||||
"""
|
"""
|
||||||
Support escaping of = with \=
|
Support escaping of = with \=
|
||||||
"""
|
"""
|
||||||
super(CmdNick, self).parse()
|
super().parse()
|
||||||
args = (self.lhs or "") + (" = %s" % self.rhs if self.rhs else "")
|
args = (self.lhs or "") + (" = %s" % self.rhs if self.rhs else "")
|
||||||
parts = re.split(r"(?<!\\)=", args, 1)
|
parts = re.split(r"(?<!\\)=", args, 1)
|
||||||
self.rhs = None
|
self.rhs = None
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ that will edit any default object, offering to change its key and description.
|
||||||
key = "DefaultCharacter"
|
key = "DefaultCharacter"
|
||||||
|
|
||||||
def at_cmdset_creation(self):
|
def at_cmdset_creation(self):
|
||||||
super(CharacterCmdSet, self).at_cmdset_creation()
|
super().at_cmdset_creation()
|
||||||
# ... add the line below
|
# ... add the line below
|
||||||
self.add(GenericBuildingCmd())
|
self.add(GenericBuildingCmd())
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ that will edit any default object offering to change its key and description.
|
||||||
key = "DefaultCharacter"
|
key = "DefaultCharacter"
|
||||||
|
|
||||||
def at_cmdset_creation(self):
|
def at_cmdset_creation(self):
|
||||||
super(CharacterCmdSet, self).at_cmdset_creation()
|
super().at_cmdset_creation()
|
||||||
# ... add the line below
|
# ... add the line below
|
||||||
self.add(GenericBuildingCmd())
|
self.add(GenericBuildingCmd())
|
||||||
```
|
```
|
||||||
|
|
@ -338,7 +338,7 @@ class CmdNoInput(Command):
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.menu = kwargs.pop("building_menu", None)
|
self.menu = kwargs.pop("building_menu", None)
|
||||||
super(Command, self).__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
"""Display the menu or choice text."""
|
"""Display the menu or choice text."""
|
||||||
|
|
@ -359,7 +359,7 @@ class CmdNoMatch(Command):
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.menu = kwargs.pop("building_menu", None)
|
self.menu = kwargs.pop("building_menu", None)
|
||||||
super(Command, self).__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
"""Call the proper menu or redirect to nomatch."""
|
"""Call the proper menu or redirect to nomatch."""
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class Submenu(BuildingMenu):
|
||||||
|
|
||||||
class TestBuildingMenu(BaseEvenniaCommandTest):
|
class TestBuildingMenu(BaseEvenniaCommandTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestBuildingMenu, self).setUp()
|
super().setUp()
|
||||||
self.menu = BuildingMenu(caller=self.char1, obj=self.room1, title="test")
|
self.menu = BuildingMenu(caller=self.char1, obj=self.room1, title="test")
|
||||||
self.menu.add_choice("title", key="t", attr="key")
|
self.menu.add_choice("title", key="t", attr="key")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
||||||
"""
|
"""
|
||||||
Populates the cmdset
|
Populates the cmdset
|
||||||
"""
|
"""
|
||||||
super(CharacterCmdSet, self).at_cmdset_creation()
|
super().at_cmdset_creation()
|
||||||
self.add(CmdCallback())
|
self.add(CmdCallback())
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -808,7 +808,7 @@ class PuzzleSystemCmdSet(CmdSet):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def at_cmdset_creation(self):
|
def at_cmdset_creation(self):
|
||||||
super(PuzzleSystemCmdSet, self).at_cmdset_creation()
|
super().at_cmdset_creation()
|
||||||
|
|
||||||
self.add(CmdCreatePuzzleRecipe())
|
self.add(CmdCreatePuzzleRecipe())
|
||||||
self.add(CmdEditPuzzle())
|
self.add(CmdEditPuzzle())
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ from . import puzzles
|
||||||
|
|
||||||
class TestPuzzles(BaseEvenniaCommandTest):
|
class TestPuzzles(BaseEvenniaCommandTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestPuzzles, self).setUp()
|
super().setUp()
|
||||||
self.steel = create_object(self.object_typeclass, key="steel", location=self.char1.location)
|
self.steel = create_object(self.object_typeclass, key="steel", location=self.char1.location)
|
||||||
self.flint = create_object(self.object_typeclass, key="flint", location=self.char1.location)
|
self.flint = create_object(self.object_typeclass, key="flint", location=self.char1.location)
|
||||||
self.fire = create_object(self.object_typeclass, key="fire", location=self.char1.location)
|
self.fire = create_object(self.object_typeclass, key="fire", location=self.char1.location)
|
||||||
|
|
|
||||||
|
|
@ -1046,7 +1046,7 @@ class CmdCombatHelp(CmdHelp):
|
||||||
+ "|wUse:|n Use an item you're carrying."
|
+ "|wUse:|n Use an item you're carrying."
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
super(CmdCombatHelp, self).func() # Call the default help command
|
super().func() # Call the default help command
|
||||||
|
|
||||||
|
|
||||||
class CmdUse(MuxCommand):
|
class CmdUse(MuxCommand):
|
||||||
|
|
|
||||||
|
|
@ -1080,7 +1080,7 @@ class CmdCombatHelp(CmdHelp):
|
||||||
+ "|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):
|
||||||
|
|
|
||||||
|
|
@ -1409,7 +1409,7 @@ class CmdCombatHelp(CmdHelp):
|
||||||
+ "|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):
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class TestTurnBattleBasicCmd(BaseEvenniaCommandTest):
|
||||||
|
|
||||||
class TestTurnBattleEquipCmd(BaseEvenniaCommandTest):
|
class TestTurnBattleEquipCmd(BaseEvenniaCommandTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTurnBattleEquipCmd, self).setUp()
|
super().setUp()
|
||||||
self.testweapon = create_object(tb_equip.TBEWeapon, key="test weapon")
|
self.testweapon = create_object(tb_equip.TBEWeapon, key="test weapon")
|
||||||
self.testarmor = create_object(tb_equip.TBEArmor, key="test armor")
|
self.testarmor = create_object(tb_equip.TBEArmor, key="test armor")
|
||||||
self.testweapon.move_to(self.char1)
|
self.testweapon.move_to(self.char1)
|
||||||
|
|
@ -63,7 +63,7 @@ class TestTurnBattleRangeCmd(BaseEvenniaCommandTest):
|
||||||
|
|
||||||
class TestTurnBattleItemsCmd(BaseEvenniaCommandTest):
|
class TestTurnBattleItemsCmd(BaseEvenniaCommandTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTurnBattleItemsCmd, self).setUp()
|
super().setUp()
|
||||||
self.testitem = create_object(key="test item")
|
self.testitem = create_object(key="test item")
|
||||||
self.testitem.move_to(self.char1)
|
self.testitem.move_to(self.char1)
|
||||||
|
|
||||||
|
|
@ -95,7 +95,7 @@ class TestTurnBattleMagicCmd(BaseEvenniaCommandTest):
|
||||||
|
|
||||||
class TestTurnBattleBasicFunc(BaseEvenniaTest):
|
class TestTurnBattleBasicFunc(BaseEvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTurnBattleBasicFunc, self).setUp()
|
super().setUp()
|
||||||
self.testroom = create_object(DefaultRoom, key="Test Room")
|
self.testroom = create_object(DefaultRoom, key="Test Room")
|
||||||
self.attacker = create_object(
|
self.attacker = create_object(
|
||||||
tb_basic.TBBasicCharacter, key="Attacker", location=self.testroom
|
tb_basic.TBBasicCharacter, key="Attacker", location=self.testroom
|
||||||
|
|
@ -106,12 +106,12 @@ class TestTurnBattleBasicFunc(BaseEvenniaTest):
|
||||||
self.joiner = create_object(tb_basic.TBBasicCharacter, key="Joiner", location=None)
|
self.joiner = create_object(tb_basic.TBBasicCharacter, key="Joiner", location=None)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(TestTurnBattleBasicFunc, self).tearDown()
|
super().tearDown()
|
||||||
self.turnhandler.stop()
|
self.turnhandler.stop()
|
||||||
self.testroom.delete()
|
|
||||||
self.attacker.delete()
|
self.attacker.delete()
|
||||||
self.defender.delete()
|
self.defender.delete()
|
||||||
self.joiner.delete()
|
self.joiner.delete()
|
||||||
|
self.testroom.delete()
|
||||||
|
|
||||||
# Test combat functions
|
# Test combat functions
|
||||||
def test_tbbasicfunc(self):
|
def test_tbbasicfunc(self):
|
||||||
|
|
@ -188,7 +188,7 @@ class TestTurnBattleBasicFunc(BaseEvenniaTest):
|
||||||
|
|
||||||
class TestTurnBattleEquipFunc(BaseEvenniaTest):
|
class TestTurnBattleEquipFunc(BaseEvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTurnBattleEquipFunc, self).setUp()
|
super().setUp()
|
||||||
self.testroom = create_object(DefaultRoom, key="Test Room")
|
self.testroom = create_object(DefaultRoom, key="Test Room")
|
||||||
self.attacker = create_object(
|
self.attacker = create_object(
|
||||||
tb_equip.TBEquipCharacter, key="Attacker", location=self.testroom
|
tb_equip.TBEquipCharacter, key="Attacker", location=self.testroom
|
||||||
|
|
@ -199,12 +199,12 @@ class TestTurnBattleEquipFunc(BaseEvenniaTest):
|
||||||
self.joiner = create_object(tb_equip.TBEquipCharacter, key="Joiner", location=None)
|
self.joiner = create_object(tb_equip.TBEquipCharacter, key="Joiner", location=None)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(TestTurnBattleEquipFunc, self).tearDown()
|
super().tearDown()
|
||||||
self.turnhandler.stop()
|
self.turnhandler.stop()
|
||||||
self.testroom.delete()
|
|
||||||
self.attacker.delete()
|
self.attacker.delete()
|
||||||
self.defender.delete()
|
self.defender.delete()
|
||||||
self.joiner.delete()
|
self.joiner.delete()
|
||||||
|
self.testroom.delete()
|
||||||
|
|
||||||
# Test the combat functions in tb_equip too. They work mostly the same.
|
# Test the combat functions in tb_equip too. They work mostly the same.
|
||||||
def test_tbequipfunc(self):
|
def test_tbequipfunc(self):
|
||||||
|
|
@ -280,7 +280,7 @@ class TestTurnBattleEquipFunc(BaseEvenniaTest):
|
||||||
|
|
||||||
class TestTurnBattleRangeFunc(BaseEvenniaTest):
|
class TestTurnBattleRangeFunc(BaseEvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTurnBattleRangeFunc, self).setUp()
|
super().setUp()
|
||||||
self.testroom = create_object(DefaultRoom, key="Test Room")
|
self.testroom = create_object(DefaultRoom, key="Test Room")
|
||||||
self.attacker = create_object(
|
self.attacker = create_object(
|
||||||
tb_range.TBRangeCharacter, key="Attacker", location=self.testroom
|
tb_range.TBRangeCharacter, key="Attacker", location=self.testroom
|
||||||
|
|
@ -291,12 +291,12 @@ class TestTurnBattleRangeFunc(BaseEvenniaTest):
|
||||||
self.joiner = create_object(tb_range.TBRangeCharacter, key="Joiner", location=self.testroom)
|
self.joiner = create_object(tb_range.TBRangeCharacter, key="Joiner", location=self.testroom)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(TestTurnBattleRangeFunc, self).tearDown()
|
super().tearDown()
|
||||||
self.turnhandler.stop()
|
self.turnhandler.stop()
|
||||||
self.testroom.delete()
|
|
||||||
self.attacker.delete()
|
self.attacker.delete()
|
||||||
self.defender.delete()
|
self.defender.delete()
|
||||||
self.joiner.delete()
|
self.joiner.delete()
|
||||||
|
self.testroom.delete()
|
||||||
|
|
||||||
# Test combat functions in tb_range too.
|
# Test combat functions in tb_range too.
|
||||||
def test_tbrangefunc(self):
|
def test_tbrangefunc(self):
|
||||||
|
|
@ -390,7 +390,7 @@ class TestTurnBattleRangeFunc(BaseEvenniaTest):
|
||||||
class TestTurnBattleItemsFunc(BaseEvenniaTest):
|
class TestTurnBattleItemsFunc(BaseEvenniaTest):
|
||||||
@patch("evennia.contrib.game_systems.turnbattle.tb_items.tickerhandler", new=MagicMock())
|
@patch("evennia.contrib.game_systems.turnbattle.tb_items.tickerhandler", new=MagicMock())
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTurnBattleItemsFunc, self).setUp()
|
super().setUp()
|
||||||
self.testroom = create_object(DefaultRoom, key="Test Room")
|
self.testroom = create_object(DefaultRoom, key="Test Room")
|
||||||
self.attacker = create_object(
|
self.attacker = create_object(
|
||||||
tb_items.TBItemsCharacter, key="Attacker", location=self.testroom
|
tb_items.TBItemsCharacter, key="Attacker", location=self.testroom
|
||||||
|
|
@ -405,13 +405,13 @@ class TestTurnBattleItemsFunc(BaseEvenniaTest):
|
||||||
self.test_healpotion.db.item_uses = 3
|
self.test_healpotion.db.item_uses = 3
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(TestTurnBattleItemsFunc, self).tearDown()
|
super().tearDown()
|
||||||
self.turnhandler.stop()
|
self.turnhandler.stop()
|
||||||
self.testroom.delete()
|
|
||||||
self.attacker.delete()
|
self.attacker.delete()
|
||||||
self.defender.delete()
|
self.defender.delete()
|
||||||
self.joiner.delete()
|
self.joiner.delete()
|
||||||
self.user.delete()
|
self.user.delete()
|
||||||
|
self.testroom.delete()
|
||||||
|
|
||||||
# Test functions in tb_items.
|
# Test functions in tb_items.
|
||||||
def test_tbitemsfunc(self):
|
def test_tbitemsfunc(self):
|
||||||
|
|
@ -513,7 +513,7 @@ class TestTurnBattleItemsFunc(BaseEvenniaTest):
|
||||||
|
|
||||||
class TestTurnBattleMagicFunc(BaseEvenniaTest):
|
class TestTurnBattleMagicFunc(BaseEvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTurnBattleMagicFunc, self).setUp()
|
super().setUp()
|
||||||
self.testroom = create_object(DefaultRoom, key="Test Room")
|
self.testroom = create_object(DefaultRoom, key="Test Room")
|
||||||
self.attacker = create_object(
|
self.attacker = create_object(
|
||||||
tb_magic.TBMagicCharacter, key="Attacker", location=self.testroom
|
tb_magic.TBMagicCharacter, key="Attacker", location=self.testroom
|
||||||
|
|
@ -524,12 +524,12 @@ class TestTurnBattleMagicFunc(BaseEvenniaTest):
|
||||||
self.joiner = create_object(tb_magic.TBMagicCharacter, key="Joiner", location=self.testroom)
|
self.joiner = create_object(tb_magic.TBMagicCharacter, key="Joiner", location=self.testroom)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(TestTurnBattleMagicFunc, self).tearDown()
|
super().tearDown()
|
||||||
self.turnhandler.stop()
|
self.turnhandler.stop()
|
||||||
self.testroom.delete()
|
|
||||||
self.attacker.delete()
|
self.attacker.delete()
|
||||||
self.defender.delete()
|
self.defender.delete()
|
||||||
self.joiner.delete()
|
self.joiner.delete()
|
||||||
|
self.testroom.delete()
|
||||||
|
|
||||||
# Test combat functions in tb_magic.
|
# Test combat functions in tb_magic.
|
||||||
def test_tbbasicfunc(self):
|
def test_tbbasicfunc(self):
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,7 @@ class ExtendedRoom(DefaultRoom):
|
||||||
# ensures that our description is current based on time/season
|
# ensures that our description is current based on time/season
|
||||||
self.update_current_description()
|
self.update_current_description()
|
||||||
# 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, **kwargs)
|
return super().return_appearance(looker, **kwargs)
|
||||||
|
|
||||||
def update_current_description(self):
|
def update_current_description(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,11 @@ class TestBodyFunctions(BaseEvenniaTest):
|
||||||
script_typeclass = BodyFunctions
|
script_typeclass = BodyFunctions
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestBodyFunctions, self).setUp()
|
super().setUp()
|
||||||
self.script.obj = self.char1
|
self.script.obj = self.char1
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(TestBodyFunctions, self).tearDown()
|
super().tearDown()
|
||||||
# if we forget to stop the script, DirtyReactorAggregateError will be raised
|
# if we forget to stop the script, DirtyReactorAggregateError will be raised
|
||||||
self.script.stop()
|
self.script.stop()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,7 @@ class AuditedServerSession(ServerSession):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.log_err(e)
|
logger.log_err(e)
|
||||||
|
|
||||||
super(AuditedServerSession, self).data_out(**kwargs)
|
super().data_out(**kwargs)
|
||||||
|
|
||||||
def data_in(self, **kwargs):
|
def data_in(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
@ -246,4 +246,4 @@ class AuditedServerSession(ServerSession):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.log_err(e)
|
logger.log_err(e)
|
||||||
|
|
||||||
super(AuditedServerSession, self).data_in(**kwargs)
|
super().data_in(**kwargs)
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class TestLockCheck(BaseEvenniaTest):
|
||||||
|
|
||||||
class TestLockfuncs(BaseEvenniaTest):
|
class TestLockfuncs(BaseEvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestLockfuncs, self).setUp()
|
super().setUp()
|
||||||
self.account2.permissions.add("Admin")
|
self.account2.permissions.add("Admin")
|
||||||
self.char2.permissions.add("Builder")
|
self.char2.permissions.add("Builder")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2661,7 +2661,7 @@ class OLCMenu(EvMenu):
|
||||||
Format the node text itself.
|
Format the node text itself.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return super(OLCMenu, self).nodetext_formatter(nodetext)
|
return super().nodetext_formatter(nodetext)
|
||||||
|
|
||||||
def options_formatter(self, optionlist):
|
def options_formatter(self, optionlist):
|
||||||
"""
|
"""
|
||||||
|
|
@ -2697,7 +2697,7 @@ class OLCMenu(EvMenu):
|
||||||
if olc_options
|
if olc_options
|
||||||
else ""
|
else ""
|
||||||
)
|
)
|
||||||
other_options = super(OLCMenu, self).options_formatter(other_options)
|
other_options = super().options_formatter(other_options)
|
||||||
sep = "\n\n" if olc_options and other_options else ""
|
sep = "\n\n" if olc_options and other_options else ""
|
||||||
|
|
||||||
return "{}{}{}".format(olc_options, sep, other_options)
|
return "{}{}{}".format(olc_options, sep, other_options)
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ _PROTPARENTS = {
|
||||||
|
|
||||||
class TestSpawner(BaseEvenniaTest):
|
class TestSpawner(BaseEvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestSpawner, self).setUp()
|
super().setUp()
|
||||||
self.prot1 = {
|
self.prot1 = {
|
||||||
"prototype_key": "testprototype",
|
"prototype_key": "testprototype",
|
||||||
"typeclass": "evennia.objects.objects.DefaultObject",
|
"typeclass": "evennia.objects.objects.DefaultObject",
|
||||||
|
|
@ -309,7 +309,7 @@ class TestUtils(BaseEvenniaTest):
|
||||||
|
|
||||||
class TestProtLib(BaseEvenniaTest):
|
class TestProtLib(BaseEvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestProtLib, self).setUp()
|
super().setUp()
|
||||||
self.obj1.attributes.add("testattr", "testval")
|
self.obj1.attributes.add("testattr", "testval")
|
||||||
self.prot = spawner.prototype_from_object(self.obj1)
|
self.prot = spawner.prototype_from_object(self.obj1)
|
||||||
|
|
||||||
|
|
@ -357,7 +357,7 @@ class TestProtFuncs(BaseEvenniaTest):
|
||||||
|
|
||||||
class TestPrototypeStorage(BaseEvenniaTest):
|
class TestPrototypeStorage(BaseEvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestPrototypeStorage, self).setUp()
|
super().setUp()
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
|
|
||||||
self.prot1 = spawner.prototype_from_object(self.obj1)
|
self.prot1 = spawner.prototype_from_object(self.obj1)
|
||||||
|
|
@ -442,7 +442,7 @@ class TestMenuModule(BaseEvenniaTest):
|
||||||
maxDiff = None
|
maxDiff = None
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestMenuModule, self).setUp()
|
super().setUp()
|
||||||
|
|
||||||
# set up fake store
|
# set up fake store
|
||||||
self.caller = self.char1
|
self.caller = self.char1
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ class AMPServerClientProtocol(amp.AMPMultiConnectionProtocol):
|
||||||
"""
|
"""
|
||||||
# print("AMPClient new connection {}".format(self))
|
# print("AMPClient new connection {}".format(self))
|
||||||
info_dict = self.factory.server.get_info_dict()
|
info_dict = self.factory.server.get_info_dict()
|
||||||
super(AMPServerClientProtocol, self).connectionMade()
|
super().connectionMade()
|
||||||
# first thing we do is to request the Portal to sync all sessions
|
# first thing we do is to request the Portal to sync all sessions
|
||||||
# back with the Server side. We also need the startup mode (reload, reset, shutdown)
|
# back with the Server side. We also need the startup mode (reload, reset, shutdown)
|
||||||
self.send_AdminServer2Portal(
|
self.send_AdminServer2Portal(
|
||||||
|
|
|
||||||
|
|
@ -177,14 +177,14 @@ class Compressed(amp.String):
|
||||||
Note: In Py3 this is really a byte stream.
|
Note: In Py3 this is really a byte stream.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return zlib.compress(super(Compressed, self).toString(inObject), 9)
|
return zlib.compress(super().toString(inObject), 9)
|
||||||
|
|
||||||
def fromString(self, inString):
|
def fromString(self, inString):
|
||||||
"""
|
"""
|
||||||
Convert (decompress) from the string-representation on the wire to Python.
|
Convert (decompress) from the string-representation on the wire to Python.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return super(Compressed, self).fromString(zlib.decompress(inString))
|
return super().fromString(zlib.decompress(inString))
|
||||||
|
|
||||||
|
|
||||||
class MsgLauncher2Portal(amp.Command):
|
class MsgLauncher2Portal(amp.Command):
|
||||||
|
|
@ -313,7 +313,7 @@ class AMPMultiConnectionProtocol(amp.AMP):
|
||||||
self.send_task = None
|
self.send_task = None
|
||||||
self.multibatches = 0
|
self.multibatches = 0
|
||||||
# later twisted amp has its own __init__
|
# later twisted amp has its own __init__
|
||||||
super(AMPMultiConnectionProtocol, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def _commandReceived(self, box):
|
def _commandReceived(self, box):
|
||||||
"""
|
"""
|
||||||
|
|
@ -368,7 +368,7 @@ class AMPMultiConnectionProtocol(amp.AMP):
|
||||||
# an incomplete AMP box means more batches are forthcoming.
|
# an incomplete AMP box means more batches are forthcoming.
|
||||||
self.multibatches += 1
|
self.multibatches += 1
|
||||||
try:
|
try:
|
||||||
super(AMPMultiConnectionProtocol, self).dataReceived(data)
|
super().dataReceived(data)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
_get_logger().log_trace(
|
_get_logger().log_trace(
|
||||||
"Discarded incoming partial (packed) data (len {})".format(len(data))
|
"Discarded incoming partial (packed) data (len {})".format(len(data))
|
||||||
|
|
@ -379,7 +379,7 @@ class AMPMultiConnectionProtocol(amp.AMP):
|
||||||
# end of existing multibatch
|
# end of existing multibatch
|
||||||
self.multibatches = max(0, self.multibatches - 1)
|
self.multibatches = max(0, self.multibatches - 1)
|
||||||
try:
|
try:
|
||||||
super(AMPMultiConnectionProtocol, self).dataReceived(data)
|
super().dataReceived(data)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
_get_logger().log_trace(
|
_get_logger().log_trace(
|
||||||
"Discarded incoming multi-batch (packed) data (len {})".format(len(data))
|
"Discarded incoming multi-batch (packed) data (len {})".format(len(data))
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class AMPServerProtocol(amp.AMPMultiConnectionProtocol):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# wipe broadcast and data memory
|
# wipe broadcast and data memory
|
||||||
super(AMPServerProtocol, self).connectionLost(reason)
|
super().connectionLost(reason)
|
||||||
if self.factory.server_connection == self:
|
if self.factory.server_connection == self:
|
||||||
self.factory.server_connection = None
|
self.factory.server_connection = None
|
||||||
self.factory.portal.server_info_dict = {}
|
self.factory.portal.server_info_dict = {}
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,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_key = "telnet/ssl"
|
self.protocol_key = "telnet/ssl"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class TestAMPServer(TwistedTestCase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestAMPServer, self).setUp()
|
super().setUp()
|
||||||
portal = Mock()
|
portal = Mock()
|
||||||
factory = AMPServerFactory(portal)
|
factory = AMPServerFactory(portal)
|
||||||
self.proto = factory.buildProtocol(("localhost", 0))
|
self.proto = factory.buildProtocol(("localhost", 0))
|
||||||
|
|
@ -217,7 +217,7 @@ class TestIRC(TestCase):
|
||||||
|
|
||||||
class TestTelnet(TwistedTestCase):
|
class TestTelnet(TwistedTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTelnet, self).setUp()
|
super().setUp()
|
||||||
factory = TelnetServerFactory()
|
factory = TelnetServerFactory()
|
||||||
factory.protocol = TelnetProtocol
|
factory.protocol = TelnetProtocol
|
||||||
factory.sessionhandler = PORTAL_SESSIONS
|
factory.sessionhandler = PORTAL_SESSIONS
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class ServerSession(_BASE_SESSION_CLASS):
|
||||||
if not _ObjectDB:
|
if not _ObjectDB:
|
||||||
from evennia.objects.models import ObjectDB as _ObjectDB
|
from evennia.objects.models import ObjectDB as _ObjectDB
|
||||||
|
|
||||||
super(ServerSession, self).at_sync()
|
super().at_sync()
|
||||||
if not self.logged_in:
|
if not self.logged_in:
|
||||||
# assign the unloggedin-command set.
|
# assign the unloggedin-command set.
|
||||||
self.cmdset_storage = settings.CMDSET_UNLOGGEDIN
|
self.cmdset_storage = settings.CMDSET_UNLOGGEDIN
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ DelayedCall.debug = True
|
||||||
# MagicMock(return_value=create.account("TestAMPAccount", "test@test.com", "testpassword")))
|
# MagicMock(return_value=create.account("TestAMPAccount", "test@test.com", "testpassword")))
|
||||||
class _TestAMP(TwistedTestCase):
|
class _TestAMP(TwistedTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(_TestAMP, self).setUp()
|
super().setUp()
|
||||||
self.account = mommy.make("accounts.AccountDB", id=1)
|
self.account = mommy.make("accounts.AccountDB", id=1)
|
||||||
self.server = server.Evennia(MagicMock())
|
self.server = server.Evennia(MagicMock())
|
||||||
self.server.sessions.data_in = MagicMock()
|
self.server.sessions.data_in = MagicMock()
|
||||||
|
|
@ -47,7 +47,7 @@ class _TestAMP(TwistedTestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.account.delete()
|
self.account.delete()
|
||||||
super(_TestAMP, self).tearDown()
|
super().tearDown()
|
||||||
|
|
||||||
def _connect_client(self, mocktransport):
|
def _connect_client(self, mocktransport):
|
||||||
"Setup client to send data for testing"
|
"Setup client to send data for testing"
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,6 @@ class EvenniaTestSuiteRunner(DiscoverRunner):
|
||||||
import evennia
|
import evennia
|
||||||
|
|
||||||
evennia._init()
|
evennia._init()
|
||||||
return super(EvenniaTestSuiteRunner, self).build_suite(
|
return super().build_suite(
|
||||||
test_labels, extra_tests=extra_tests, **kwargs
|
test_labels, extra_tests=extra_tests, **kwargs
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -751,7 +751,7 @@ class TypeclassManager(TypedObjectManager):
|
||||||
Annotated queryset.
|
Annotated queryset.
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
super(TypeclassManager, self)
|
super()
|
||||||
.filter(db_typeclass_path=self.model.path)
|
.filter(db_typeclass_path=self.model.path)
|
||||||
.annotate(*args, **kwargs)
|
.annotate(*args, **kwargs)
|
||||||
)
|
)
|
||||||
|
|
@ -767,7 +767,7 @@ class TypeclassManager(TypedObjectManager):
|
||||||
Queryset of values dictionaries, just filtered by typeclass first.
|
Queryset of values dictionaries, just filtered by typeclass first.
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
super(TypeclassManager, self)
|
super()
|
||||||
.filter(db_typeclass_path=self.model.path)
|
.filter(db_typeclass_path=self.model.path)
|
||||||
.values(*args, **kwargs)
|
.values(*args, **kwargs)
|
||||||
)
|
)
|
||||||
|
|
@ -783,7 +783,7 @@ class TypeclassManager(TypedObjectManager):
|
||||||
Queryset of value_list tuples, just filtered by typeclass first.
|
Queryset of value_list tuples, just filtered by typeclass first.
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
super(TypeclassManager, self)
|
super()
|
||||||
.filter(db_typeclass_path=self.model.path)
|
.filter(db_typeclass_path=self.model.path)
|
||||||
.values_list(*args, **kwargs)
|
.values_list(*args, **kwargs)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class EvenniaWebTest(BaseEvenniaTest):
|
||||||
authenticated_response = 200
|
authenticated_response = 200
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(EvenniaWebTest, self).setUp()
|
super().setUp()
|
||||||
|
|
||||||
# Add chars to account rosters
|
# Add chars to account rosters
|
||||||
self.account.db._playable_characters = [self.char1]
|
self.account.db._playable_characters = [self.char1]
|
||||||
|
|
@ -110,13 +110,13 @@ class WebclientTest(EvenniaWebTest):
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
self.authenticated_response = 200
|
self.authenticated_response = 200
|
||||||
self.unauthenticated_response = 200
|
self.unauthenticated_response = 200
|
||||||
super(WebclientTest, self).test_get()
|
super().test_get()
|
||||||
|
|
||||||
@override_settings(WEBCLIENT_ENABLED=False)
|
@override_settings(WEBCLIENT_ENABLED=False)
|
||||||
def test_get_disabled(self):
|
def test_get_disabled(self):
|
||||||
self.authenticated_response = 404
|
self.authenticated_response = 404
|
||||||
self.unauthenticated_response = 404
|
self.unauthenticated_response = 404
|
||||||
super(WebclientTest, self).test_get()
|
super().test_get()
|
||||||
|
|
||||||
|
|
||||||
class ChannelListTest(EvenniaWebTest):
|
class ChannelListTest(EvenniaWebTest):
|
||||||
|
|
@ -127,7 +127,7 @@ class ChannelDetailTest(EvenniaWebTest):
|
||||||
url_name = "channel-detail"
|
url_name = "channel-detail"
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ChannelDetailTest, self).setUp()
|
super().setUp()
|
||||||
|
|
||||||
klass = class_from_module(self.channel_typeclass,
|
klass = class_from_module(self.channel_typeclass,
|
||||||
fallback=settings.FALLBACK_CHANNEL_TYPECLASS)
|
fallback=settings.FALLBACK_CHANNEL_TYPECLASS)
|
||||||
|
|
@ -189,7 +189,7 @@ class HelpLockedDetailTest(EvenniaWebTest):
|
||||||
url_name = "help-entry-detail"
|
url_name = "help-entry-detail"
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(HelpLockedDetailTest, self).setUp()
|
super().setUp()
|
||||||
|
|
||||||
# create a db entry with a lock
|
# create a db entry with a lock
|
||||||
self.db_help_entry = create_help_entry('unit test locked topic', 'unit test locked entrytext',
|
self.db_help_entry = create_help_entry('unit test locked topic', 'unit test locked entrytext',
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ class ObjectDetailView(EvenniaDetailView):
|
||||||
raise PermissionDenied("You are not authorized to %s this object." % self.access_type)
|
raise PermissionDenied("You are not authorized to %s this object." % self.access_type)
|
||||||
|
|
||||||
# Get the object, if it is in the specified queryset
|
# Get the object, if it is in the specified queryset
|
||||||
obj = super(ObjectDetailView, self).get_object(queryset)
|
obj = super().get_object(queryset)
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue