Remove basestring mentions remnants of 2.7

This commit is contained in:
Griatch 2018-10-13 19:30:24 +02:00
parent e54b87b6fd
commit 58116ff900
10 changed files with 29 additions and 29 deletions

View file

@ -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)

View file

@ -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:

View file

@ -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

View file

@ -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(