diff --git a/evennia/accounts/accounts.py b/evennia/accounts/accounts.py index 520aa4cbc7..2cb8064fef 100644 --- a/evennia/accounts/accounts.py +++ b/evennia/accounts/accounts.py @@ -483,7 +483,7 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)): kwargs["options"] = options if text is not None: - if not (isinstance(text, basestring) or isinstance(text, tuple)): + if not (isinstance(text, str) or isinstance(text, tuple)): # sanitize text before sending across the wire try: text = to_str(text, force_string=True) diff --git a/evennia/commands/cmdhandler.py b/evennia/commands/cmdhandler.py index bc98dd5748..1f068e13e3 100644 --- a/evennia/commands/cmdhandler.py +++ b/evennia/commands/cmdhandler.py @@ -211,8 +211,8 @@ def _process_input(caller, prompt, result, cmd, generator): Args: caller (Character, Account or Session): the caller. - prompt (basestring): The sent prompt. - result (basestring): The unprocessed answer. + prompt (str): The sent prompt. + result (str): The unprocessed answer. cmd (Command): The command itself. generator (GeneratorType): The generator. diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index 11377c0a0d..4b6ac6f782 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -2930,7 +2930,7 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS): if ';' in self.args: key, tags = (part.strip().lower() for part in self.args.split(";", 1)) tags = [tag.strip() for tag in tags.split(",")] if tags else None - EvMore(caller, unicode(protlib.list_prototypes(caller, key=key, tags=tags)), + EvMore(caller, str(protlib.list_prototypes(caller, key=key, tags=tags)), exit_on_lastpage=True) return @@ -3063,13 +3063,13 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS): # A direct creation of an object from a given prototype prototype = _parse_prototype( - self.args, expect=dict if self.args.strip().startswith("{") else basestring) + self.args, expect=dict if self.args.strip().startswith("{") else str) if not prototype: # this will only let through dicts or strings return key = '' - if isinstance(prototype, basestring): + if isinstance(prototype, str): # A prototype key we are looking to apply key = prototype prototypes = protlib.search_prototype(prototype) diff --git a/evennia/commands/default/tests.py b/evennia/commands/default/tests.py index 4856844ed3..d252e738c2 100644 --- a/evennia/commands/default/tests.py +++ b/evennia/commands/default/tests.py @@ -155,10 +155,10 @@ class TestGeneral(CommandTest): "Account-nick 'testalias' mapped to 'testaliasedstring2'.") self.call(general.CmdNick(), "/object testalias = testaliasedstring3", "Object-nick 'testalias' mapped to 'testaliasedstring3'.") - self.assertEqual(u"testaliasedstring1", self.char1.nicks.get("testalias")) - self.assertEqual(u"testaliasedstring2", self.char1.nicks.get("testalias", category="account")) + self.assertEqual("testaliasedstring1", self.char1.nicks.get("testalias")) + self.assertEqual("testaliasedstring2", self.char1.nicks.get("testalias", category="account")) self.assertEqual(None, self.char1.account.nicks.get("testalias", category="account")) - self.assertEqual(u"testaliasedstring3", self.char1.nicks.get("testalias", category="object")) + self.assertEqual("testaliasedstring3", self.char1.nicks.get("testalias", category="object")) def test_get_and_drop(self): self.call(general.CmdGet(), "Obj", "You pick up Obj.") diff --git a/evennia/contrib/building_menu.py b/evennia/contrib/building_menu.py index 596af136b3..8b7b18343d 100644 --- a/evennia/contrib/building_menu.py +++ b/evennia/contrib/building_menu.py @@ -595,7 +595,7 @@ class BuildingMenu(object): if choice_key == self.joker_key: continue - if not isinstance(menu_key, basestring) or menu_key != choice_key: + if not isinstance(menu_key, str) or menu_key != choice_key: common = False break @@ -631,7 +631,7 @@ class BuildingMenu(object): if choice_key == self.joker_key: continue - if not isinstance(menu_key, basestring) or menu_key != choice_key: + if not isinstance(menu_key, str) or menu_key != choice_key: common = False break diff --git a/evennia/objects/objects.py b/evennia/objects/objects.py index 68d391bcb2..97a99ad53d 100644 --- a/evennia/objects/objects.py +++ b/evennia/objects/objects.py @@ -571,7 +571,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): logger.log_trace() if text is not None: - if not (isinstance(text, basestring) or isinstance(text, tuple)): + if not (isinstance(text, str) or isinstance(text, tuple)): # sanitize text before sending across the wire try: text = to_str(text, force_string=True) diff --git a/evennia/prototypes/protfuncs.py b/evennia/prototypes/protfuncs.py index a13aa7e532..235a0d7628 100644 --- a/evennia/prototypes/protfuncs.py +++ b/evennia/prototypes/protfuncs.py @@ -256,7 +256,7 @@ def eval(*args, **kwargs): string = ",".join(args) struct = literal_eval(string) - if isinstance(struct, basestring): + if isinstance(struct, str): # we must shield the string, otherwise it will be merged as a string and future # literal_evas will pick up e.g. '2' as something that should be converted to a number struct = '"{}"'.format(struct) diff --git a/evennia/prototypes/prototypes.py b/evennia/prototypes/prototypes.py index fc8edb55ab..5a37f29216 100644 --- a/evennia/prototypes/prototypes.py +++ b/evennia/prototypes/prototypes.py @@ -567,7 +567,7 @@ def protfunc_parser(value, available_functions=None, testing=False, stacktrace=F eventual object #dbrefs in the output from the protfunc. """ - if not isinstance(value, basestring): + if not isinstance(value, str): try: value = value.dbref except AttributeError: diff --git a/evennia/prototypes/spawner.py b/evennia/prototypes/spawner.py index d1c099fb57..5d72f9ba3b 100644 --- a/evennia/prototypes/spawner.py +++ b/evennia/prototypes/spawner.py @@ -128,7 +128,7 @@ prototype, override its name with an empty dict. """ -from __future__ import print_function + import copy import hashlib @@ -447,7 +447,7 @@ def batch_update_objects_with_prototype(prototype, diff=None, objects=None): """ prototype = protlib.homogenize_prototype(prototype) - if isinstance(prototype, basestring): + if isinstance(prototype, str): new_prototype = protlib.search_prototype(prototype) else: new_prototype = prototype diff --git a/evennia/prototypes/tests.py b/evennia/prototypes/tests.py index 411bd45c27..cb30dc8f42 100644 --- a/evennia/prototypes/tests.py +++ b/evennia/prototypes/tests.py @@ -88,7 +88,7 @@ class TestUtils(EvenniaTest): 'prototype_key': Something, 'prototype_locks': 'spawn:all();edit:all()', 'prototype_tags': [], - 'tags': [(u'foo', None, None)], + 'tags': [('foo', None, None)], 'typeclass': 'evennia.objects.objects.DefaultObject'}, new_prot) def test_update_objects_from_prototypes(self): @@ -134,7 +134,7 @@ class TestUtils(EvenniaTest): 'prototype_key': Something, 'prototype_locks': 'spawn:all();edit:all()', 'prototype_tags': [], - 'tags': [(u'footag', u'foocategory', None)], + 'tags': [('footag', 'foocategory', None)], 'typeclass': 'evennia.objects.objects.DefaultObject'}) self.assertEqual(old_prot, @@ -183,7 +183,7 @@ class TestUtils(EvenniaTest): 'typeclass': ('evennia.objects.objects.DefaultObject', 'evennia.objects.objects.DefaultObject', 'KEEP'), 'aliases': {'foo': ('foo', None, 'REMOVE')}, - 'tags': {u'footag': ((u'footag', u'foocategory', None), None, 'REMOVE')}, + 'tags': {'footag': (('footag', 'foocategory', None), None, 'REMOVE')}, 'prototype_desc': ('Built from Obj', 'New version of prototype', 'UPDATE'), 'permissions': {"Builder": (None, 'Builder', 'ADD')} @@ -391,7 +391,7 @@ class TestPrototypeStorage(EvenniaTest): self.assertEqual(list(protlib.search_prototype("prot")), [prot1b, prot2, prot3]) self.assertEqual(list(protlib.search_prototype(tags="foo1")), [prot1b, prot2, prot3]) - self.assertTrue(str(unicode(protlib.list_prototypes(self.char1)))) + self.assertTrue(str(str(protlib.list_prototypes(self.char1)))) class _MockMenu(object): @@ -574,17 +574,17 @@ class TestMenuModule(EvenniaTest): # diff helpers obj_diff = { 'attrs': { - u'desc': ((u'desc', u'This is User #1.', None, ''), - (u'desc', u'This is User #1.', None, ''), + 'desc': (('desc', 'This is User #1.', None, ''), + ('desc', 'This is User #1.', None, ''), 'KEEP'), - u'foo': (None, - (u'foo', u'bar', None, ''), + 'foo': (None, + ('foo', 'bar', None, ''), 'ADD'), - u'prelogout_location': ((u'prelogout_location', "#2", None, ''), - (u'prelogout_location', "#2", None, ''), + 'prelogout_location': (('prelogout_location', "#2", None, ''), + ('prelogout_location', "#2", None, ''), 'KEEP')}, 'home': ('#2', '#2', 'KEEP'), - 'key': (u'TestChar', u'TestChar', 'KEEP'), + 'key': ('TestChar', 'TestChar', 'KEEP'), 'locks': ('boot:false();call:false();control:perm(Developer);delete:false();' 'edit:false();examine:perm(Developer);get:false();msg:all();' 'puppet:false();tell:perm(Admin);view:all()', @@ -598,8 +598,8 @@ class TestMenuModule(EvenniaTest): 'prototype_locks': ('spawn:all();edit:all()', 'spawn:all();edit:all()', 'KEEP'), 'prototype_tags': {}, 'tags': {'foo': (None, ('foo', None, ''), 'ADD')}, - 'typeclass': (u'typeclasses.characters.Character', - u'typeclasses.characters.Character', 'KEEP')} + 'typeclass': ('typeclasses.characters.Character', + 'typeclasses.characters.Character', 'KEEP')} texts, options = olc_menus._format_diff_text_and_options(obj_diff) self.assertEqual(