mirror of
https://github.com/evennia/evennia.git
synced 2026-04-03 14:37:17 +02:00
Resolve merge conflicts against develop branch
This commit is contained in:
commit
20ef7f26ed
186 changed files with 1363 additions and 2081 deletions
|
|
@ -1,8 +1,8 @@
|
|||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
- "3.6"
|
||||
sudo: false
|
||||
install:
|
||||
install:
|
||||
- pip install -e .
|
||||
- pip install coveralls
|
||||
before_script:
|
||||
|
|
@ -10,6 +10,6 @@ before_script:
|
|||
- cd dummy
|
||||
- evennia migrate
|
||||
script:
|
||||
- coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test evennia
|
||||
- coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test evennia
|
||||
after_success:
|
||||
- coveralls
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Created for the Player->Account renaming
|
|||
Griatch 2017, released under the BSD license.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
|
@ -130,7 +130,7 @@ def rename_in_tree(path, in_list, out_list, excl_list, fileend_list, is_interact
|
|||
replacements in each file.
|
||||
|
||||
"""
|
||||
repl_mapping = zip(in_list, out_list)
|
||||
repl_mapping = list(zip(in_list, out_list))
|
||||
|
||||
for root, dirs, files in os.walk(path):
|
||||
|
||||
|
|
@ -155,13 +155,13 @@ def rename_in_tree(path, in_list, out_list, excl_list, fileend_list, is_interact
|
|||
for src, dst in repl_mapping:
|
||||
new_file = _case_sensitive_replace(new_file, src, dst)
|
||||
if new_file != file:
|
||||
inp = raw_input(_green("Rename %s\n -> %s\n Y/[N]? > " % (file, new_file)))
|
||||
inp = input(_green("Rename %s\n -> %s\n Y/[N]? > " % (file, new_file)))
|
||||
if inp.upper() == 'Y':
|
||||
new_full_path = os.path.join(root, new_file)
|
||||
try:
|
||||
os.rename(full_path, new_full_path)
|
||||
except OSError as err:
|
||||
raw_input(_red("Could not rename - %s (return to skip)" % err))
|
||||
input(_red("Could not rename - %s (return to skip)" % err))
|
||||
else:
|
||||
print("... Renamed.")
|
||||
else:
|
||||
|
|
@ -171,12 +171,12 @@ def rename_in_tree(path, in_list, out_list, excl_list, fileend_list, is_interact
|
|||
for src, dst in repl_mapping:
|
||||
new_root = _case_sensitive_replace(new_root, src, dst)
|
||||
if new_root != root:
|
||||
inp = raw_input(_green("Dir Rename %s\n -> %s\n Y/[N]? > " % (root, new_root)))
|
||||
inp = input(_green("Dir Rename %s\n -> %s\n Y/[N]? > " % (root, new_root)))
|
||||
if inp.upper() == 'Y':
|
||||
try:
|
||||
os.rename(root, new_root)
|
||||
except OSError as err:
|
||||
raw_input(_red("Could not rename - %s (return to skip)" % err))
|
||||
input(_red("Could not rename - %s (return to skip)" % err))
|
||||
else:
|
||||
print("... Renamed.")
|
||||
else:
|
||||
|
|
@ -204,7 +204,7 @@ def rename_in_file(path, in_list, out_list, is_interactive):
|
|||
with open(path, 'r') as fil:
|
||||
org_text = fil.read()
|
||||
|
||||
repl_mapping = zip(in_list, out_list)
|
||||
repl_mapping = list(zip(in_list, out_list))
|
||||
|
||||
if not is_interactive:
|
||||
# just replace everything immediately
|
||||
|
|
@ -239,12 +239,12 @@ def rename_in_file(path, in_list, out_list, is_interactive):
|
|||
|
||||
while True:
|
||||
|
||||
for iline, renamed_line in sorted(renamed.items(), key=lambda tup: tup[0]):
|
||||
for iline, renamed_line in sorted(list(renamed.items()), key=lambda tup: tup[0]):
|
||||
print("%3i orig: %s" % (iline + 1, org_lines[iline]))
|
||||
print(" new : %s" % (_yellow(renamed_line)))
|
||||
print(_green("%s (%i lines changed)" % (path, len(renamed))))
|
||||
|
||||
ret = raw_input(_green("Choose: "
|
||||
ret = input(_green("Choose: "
|
||||
"[q]uit, "
|
||||
"[h]elp, "
|
||||
"[s]kip file, "
|
||||
|
|
@ -275,12 +275,12 @@ def rename_in_file(path, in_list, out_list, is_interactive):
|
|||
print("Quit renaming program.")
|
||||
sys.exit()
|
||||
elif ret == "h":
|
||||
raw_input(_HELP_TEXT.format(sources=in_list, targets=out_list))
|
||||
input(_HELP_TEXT.format(sources=in_list, targets=out_list))
|
||||
elif ret.startswith("i"):
|
||||
# ignore one or more lines
|
||||
ignores = [int(ind) - 1 for ind in ret[1:].split(',') if ind.strip().isdigit()]
|
||||
if not ignores:
|
||||
raw_input("Ignore example: i 2,7,34,133\n (return to continue)")
|
||||
input("Ignore example: i 2,7,34,133\n (return to continue)")
|
||||
continue
|
||||
for ign in ignores:
|
||||
renamed.pop(ign, None)
|
||||
|
|
|
|||
|
|
@ -17,9 +17,8 @@ to launch such a shell (using python or ipython depending on your install).
|
|||
See www.evennia.com for full documentation.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
from builtins import object
|
||||
|
||||
|
||||
|
||||
# Delayed loading of properties
|
||||
|
||||
|
|
@ -104,7 +103,10 @@ def _create_version():
|
|||
except IOError as err:
|
||||
print(err)
|
||||
try:
|
||||
version = "%s (rev %s)" % (version, check_output("git rev-parse --short HEAD", shell=True, cwd=root, stderr=STDOUT).strip())
|
||||
rev = check_output(
|
||||
"git rev-parse --short HEAD",
|
||||
shell=True, cwd=root, stderr=STDOUT).strip().decode()
|
||||
version = "%s (rev %s)" % (version, rev)
|
||||
except (IOError, CalledProcessError):
|
||||
# ignore if we cannot get to git
|
||||
pass
|
||||
|
|
@ -314,8 +316,3 @@ def _init():
|
|||
syscmdkeys = SystemCmds()
|
||||
del SystemCmds
|
||||
del _EvContainer
|
||||
|
||||
|
||||
del object
|
||||
del absolute_import
|
||||
del print_function
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ from evennia.comms.models import ChannelDB
|
|||
from evennia.commands import cmdhandler
|
||||
from evennia.utils import logger
|
||||
from evennia.utils.utils import (lazy_property,
|
||||
make_iter, to_unicode, is_iter,
|
||||
make_iter, is_iter,
|
||||
variable_from_module)
|
||||
from evennia.typeclasses.attributes import NickHandler
|
||||
from evennia.scripts.scripthandler import ScriptHandler
|
||||
|
|
@ -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):
|
||||
|
|
@ -446,7 +446,6 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)):
|
|||
commands at run-time.
|
||||
|
||||
"""
|
||||
raw_string = to_unicode(raw_string)
|
||||
raw_string = self.nicks.nickreplace(raw_string, categories=("inputline", "channel"), include_account=False)
|
||||
if not session and _MULTISESSION_MODE in (0, 1):
|
||||
# for these modes we use the first/only session
|
||||
|
|
@ -491,7 +490,7 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)):
|
|||
|
||||
"""
|
||||
# handle me, self and *me, *self
|
||||
if isinstance(searchdata, basestring):
|
||||
if isinstance(searchdata, str):
|
||||
# handle wrapping of common terms
|
||||
if searchdata.lower() in ("me", "*me", "self", "*self",):
|
||||
return self
|
||||
|
|
@ -529,7 +528,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,11 +978,11 @@ 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:
|
||||
print "deleting Character:", character
|
||||
print("deleting Character:", character)
|
||||
character.delete()
|
||||
|
||||
def at_post_disconnect(self, **kwargs):
|
||||
|
|
@ -995,7 +994,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:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Bots are a special child typeclasses of
|
|||
Account that are controlled by the server.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import time
|
||||
from django.conf import settings
|
||||
from evennia.accounts.accounts import DefaultAccount
|
||||
|
|
@ -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":
|
||||
|
|
|
|||
|
|
@ -165,9 +165,9 @@ class AccountDBManager(TypedObjectManager, UserManager):
|
|||
if typeclass:
|
||||
# we accept both strings and actual typeclasses
|
||||
if callable(typeclass):
|
||||
typeclass = u"%s.%s" % (typeclass.__module__, typeclass.__name__)
|
||||
typeclass = "%s.%s" % (typeclass.__module__, typeclass.__name__)
|
||||
else:
|
||||
typeclass = u"%s" % typeclass
|
||||
typeclass = "%s" % typeclass
|
||||
query["db_typeclass_path"] = typeclass
|
||||
if exact:
|
||||
return self.filter(**query)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
import django.utils.timezone
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
import evennia.accounts.manager
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.9 on 2016-09-05 09:02
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-06-06 17:31
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import django.contrib.auth.validators
|
||||
from django.db import migrations, models
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-07-03 19:17
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.apps import apps as global_apps
|
||||
from django.db import migrations
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class AccountDB(TypedObject, AbstractUser):
|
|||
return smart_str("%s(account %s)" % (self.name, self.dbid))
|
||||
|
||||
def __unicode__(self):
|
||||
return u"%s(account#%s)" % (self.name, self.dbid)
|
||||
return "%s(account#%s)" % (self.name, self.dbid)
|
||||
|
||||
#@property
|
||||
def __username_get(self):
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ from django.conf import settings
|
|||
from evennia.commands.command import InterruptCommand
|
||||
from evennia.comms.channelhandler import CHANNELHANDLER
|
||||
from evennia.utils import logger, utils
|
||||
from evennia.utils.utils import string_suggestions, to_unicode
|
||||
from evennia.utils.utils import string_suggestions
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ def _progressive_cmd_run(cmd, generator, response=None):
|
|||
|
||||
try:
|
||||
if response is None:
|
||||
value = generator.next()
|
||||
value = next(generator)
|
||||
else:
|
||||
value = generator.send(response)
|
||||
except StopIteration:
|
||||
|
|
@ -198,7 +198,7 @@ def _progressive_cmd_run(cmd, generator, response=None):
|
|||
else:
|
||||
if isinstance(value, (int, float)):
|
||||
utils.delay(value, _progressive_cmd_run, cmd, generator)
|
||||
elif isinstance(value, basestring):
|
||||
elif isinstance(value, str):
|
||||
_GET_INPUT(cmd.caller, value, _process_input, cmd=cmd, generator=generator)
|
||||
else:
|
||||
raise ValueError("unknown type for a yielded value in command: {}".format(type(value)))
|
||||
|
|
@ -443,7 +443,7 @@ def get_and_merge_cmdsets(caller, session, account, obj, callertype, raw_string)
|
|||
tempmergers[prio] = cmdset
|
||||
|
||||
# sort cmdsets after reverse priority (highest prio are merged in last)
|
||||
cmdsets = yield sorted(tempmergers.values(), key=lambda x: x.priority)
|
||||
cmdsets = yield sorted(list(tempmergers.values()), key=lambda x: x.priority)
|
||||
|
||||
# Merge all command sets into one, beginning with the lowest-prio one
|
||||
cmdset = cmdsets[0]
|
||||
|
|
@ -618,8 +618,6 @@ def cmdhandler(called_by, raw_string, _testing=False, callertype="session", sess
|
|||
finally:
|
||||
_COMMAND_NESTING[called_by] -= 1
|
||||
|
||||
raw_string = to_unicode(raw_string, force_string=True)
|
||||
|
||||
session, account, obj = session, None, None
|
||||
if callertype == "session":
|
||||
session = called_by
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ replacing cmdparser function. The replacement parser must accept the
|
|||
same inputs as the default one.
|
||||
|
||||
"""
|
||||
from __future__ import division
|
||||
|
||||
|
||||
import re
|
||||
from django.conf import settings
|
||||
|
|
@ -70,7 +70,7 @@ def cmdparser(raw_string, cmdset, caller, match_index=None):
|
|||
the `raw_cmdname` is the cmdname unmodified by eventual prefix-stripping.
|
||||
|
||||
"""
|
||||
cmdlen, strlen = len(unicode(cmdname)), len(unicode(string))
|
||||
cmdlen, strlen = len(str(cmdname)), len(str(string))
|
||||
mratio = 1 - (strlen - cmdlen) / (1.0 * strlen)
|
||||
args = string[cmdlen:]
|
||||
return (cmdname, args, cmdobj, cmdlen, mratio, raw_cmdname)
|
||||
|
|
|
|||
|
|
@ -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)):
|
||||
|
|
|
|||
|
|
@ -422,13 +422,13 @@ class CmdSetHandler(object):
|
|||
it's a 'quirk' that has to be documented.
|
||||
|
||||
"""
|
||||
if not (isinstance(cmdset, basestring) or utils.inherits_from(cmdset, CmdSet)):
|
||||
if not (isinstance(cmdset, str) or utils.inherits_from(cmdset, CmdSet)):
|
||||
string = _("Only CmdSets can be added to the cmdsethandler!")
|
||||
raise Exception(string)
|
||||
|
||||
if callable(cmdset):
|
||||
cmdset = cmdset(self.obj)
|
||||
elif isinstance(cmdset, basestring):
|
||||
elif isinstance(cmdset, str):
|
||||
# this is (maybe) a python path. Try to import from cache.
|
||||
cmdset = self._import_cmdset(cmdset)
|
||||
if cmdset and cmdset.key != '_CMDSET_ERROR':
|
||||
|
|
@ -586,11 +586,11 @@ class CmdSetHandler(object):
|
|||
"""
|
||||
if callable(cmdset) and hasattr(cmdset, 'path'):
|
||||
# try it as a callable
|
||||
print "Try callable", cmdset
|
||||
print("Try callable", cmdset)
|
||||
if must_be_default:
|
||||
return self.cmdset_stack and (self.cmdset_stack[0].path == cmdset.path)
|
||||
else:
|
||||
print [cset.path for cset in self.cmdset_stack], cmdset.path
|
||||
print([cset.path for cset in self.cmdset_stack], cmdset.path)
|
||||
return any([cset for cset in self.cmdset_stack
|
||||
if cset.path == cmdset.path])
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ def _init_command(cls, **kwargs):
|
|||
temp.append(lockstring)
|
||||
cls.lock_storage = ";".join(temp)
|
||||
|
||||
if hasattr(cls, 'arg_regex') and isinstance(cls.arg_regex, basestring):
|
||||
if hasattr(cls, 'arg_regex') and isinstance(cls.arg_regex, str):
|
||||
cls.arg_regex = re.compile(r"%s" % cls.arg_regex, re.I + re.UNICODE)
|
||||
if not hasattr(cls, "auto_help"):
|
||||
cls.auto_help = True
|
||||
|
|
@ -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
|
||||
|
|
@ -201,6 +201,19 @@ class Command(with_metaclass(CommandMeta, object)):
|
|||
# probably got a string
|
||||
return cmd in self._matchset
|
||||
|
||||
def __hash__(self):
|
||||
"""
|
||||
Python 3 requires that any class which implements __eq__ must also
|
||||
implement __hash__ and that the corresponding hashes for equivalent
|
||||
instances are themselves equivalent.
|
||||
|
||||
Technically, the following implementation is only valid for comparison
|
||||
against other Commands, as our __eq__ supports comparison against
|
||||
str, too.
|
||||
|
||||
"""
|
||||
return hash('\n'.join(self._matchset))
|
||||
|
||||
def __ne__(self, cmd):
|
||||
"""
|
||||
The logical negation of __eq__. Since this is one of the most
|
||||
|
|
@ -266,7 +279,7 @@ class Command(with_metaclass(CommandMeta, object)):
|
|||
caches are properly updated as well.
|
||||
|
||||
"""
|
||||
if isinstance(new_aliases, basestring):
|
||||
if isinstance(new_aliases, str):
|
||||
new_aliases = new_aliases.split(';')
|
||||
aliases = (str(alias).strip().lower() for alias in make_iter(new_aliases))
|
||||
self.aliases = list(set(alias for alias in aliases if alias != self.key))
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ method. Otherwise all text will be returned to all connected sessions.
|
|||
from builtins import range
|
||||
|
||||
import time
|
||||
from codecs import lookup as codecs_lookup
|
||||
from django.conf import settings
|
||||
from evennia.server.sessionhandler import SESSIONS
|
||||
from evennia.utils import utils, create, search, evtable
|
||||
|
|
@ -46,7 +47,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
|
||||
|
|
@ -502,13 +503,13 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
|
|||
options["SCREENWIDTH"] = options["SCREENWIDTH"][0]
|
||||
else:
|
||||
options["SCREENWIDTH"] = " \n".join("%s : %s" % (screenid, size)
|
||||
for screenid, size in options["SCREENWIDTH"].iteritems())
|
||||
for screenid, size in options["SCREENWIDTH"].items())
|
||||
if "SCREENHEIGHT" in options:
|
||||
if len(options["SCREENHEIGHT"]) == 1:
|
||||
options["SCREENHEIGHT"] = options["SCREENHEIGHT"][0]
|
||||
else:
|
||||
options["SCREENHEIGHT"] = " \n".join("%s : %s" % (screenid, size)
|
||||
for screenid, size in options["SCREENHEIGHT"].iteritems())
|
||||
for screenid, size in options["SCREENHEIGHT"].items())
|
||||
options.pop("TTYPE", None)
|
||||
|
||||
header = ("Name", "Value", "Saved") if saved_options else ("Name", "Value")
|
||||
|
|
@ -533,7 +534,7 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
|
|||
def validate_encoding(new_encoding):
|
||||
# helper: change encoding
|
||||
try:
|
||||
utils.to_str(utils.to_unicode("test-string"), encoding=new_encoding)
|
||||
codecs_lookup(new_encoding)
|
||||
except LookupError:
|
||||
raise RuntimeError("The encoding '|w%s|n' is invalid. " % new_encoding)
|
||||
return val
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
@ -1541,7 +1541,7 @@ class CmdSetAttribute(ObjManipCommand):
|
|||
def load(caller):
|
||||
"""Called for the editor to load the buffer"""
|
||||
old_value = obj.attributes.get(attr)
|
||||
if old_value is not None and not isinstance(old_value, basestring):
|
||||
if old_value is not None and not isinstance(old_value, str):
|
||||
typ = type(old_value).__name__
|
||||
self.caller.msg("|RWARNING! Saving this buffer will overwrite the "
|
||||
"current attribute (of type %s) with a string!|n" % typ)
|
||||
|
|
@ -1937,10 +1937,9 @@ class CmdExamine(ObjManipCommand):
|
|||
Formats a single attribute line.
|
||||
"""
|
||||
if crop:
|
||||
if not isinstance(value, basestring):
|
||||
if not isinstance(value, str):
|
||||
value = utils.to_str(value, force_string=True)
|
||||
value = utils.crop(value)
|
||||
value = utils.to_unicode(value)
|
||||
|
||||
string = "\n %s = %s" % (attr, value)
|
||||
string = raw(string)
|
||||
|
|
@ -2707,7 +2706,7 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
|
|||
self.caller.msg(string)
|
||||
return
|
||||
|
||||
if isinstance(prototype, basestring):
|
||||
if isinstance(prototype, str):
|
||||
# A prototype key
|
||||
keystr = prototype
|
||||
prototype = prototypes.get(prototype, None)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ make sure to homogenize self.caller to always be the account object
|
|||
for easy handling.
|
||||
|
||||
"""
|
||||
from past.builtins import cmp
|
||||
from django.conf import settings
|
||||
from evennia.comms.models import ChannelDB, Msg
|
||||
from evennia.accounts.models import AccountDB
|
||||
|
|
@ -711,7 +710,7 @@ class CmdPage(COMMAND_DEFAULT_CLASS):
|
|||
|
||||
if not self.args or not self.rhs:
|
||||
pages = pages_we_sent + pages_we_got
|
||||
pages.sort(lambda x, y: cmp(x.date_created, y.date_created))
|
||||
pages = sorted(pages, key=lambda page: page.date_created)
|
||||
|
||||
number = 5
|
||||
if self.args:
|
||||
|
|
@ -754,7 +753,7 @@ class CmdPage(COMMAND_DEFAULT_CLASS):
|
|||
|
||||
recobjs = []
|
||||
for receiver in set(receivers):
|
||||
if isinstance(receiver, basestring):
|
||||
if isinstance(receiver, str):
|
||||
pobj = caller.search(receiver)
|
||||
elif hasattr(receiver, 'character'):
|
||||
pobj = receiver
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
System commands
|
||||
|
||||
"""
|
||||
from __future__ import division
|
||||
|
||||
|
||||
import traceback
|
||||
import os
|
||||
|
|
@ -544,7 +544,7 @@ class CmdService(COMMAND_DEFAULT_CLASS):
|
|||
table = EvTable("|wService|n (use @services/start|stop|delete)", "|wstatus", align="l")
|
||||
for service in service_collection.services:
|
||||
table.add_row(service.name, service.running and "|gRunning" or "|rNot Running")
|
||||
caller.msg(unicode(table))
|
||||
caller.msg(str(table))
|
||||
return
|
||||
|
||||
# Get the service to start / stop
|
||||
|
|
@ -663,7 +663,7 @@ class CmdTime(COMMAND_DEFAULT_CLASS):
|
|||
table2.add_row("Total time passed:", utils.time_format(gametime.gametime(), 2))
|
||||
table2.add_row("Current time ", datetime.datetime.fromtimestamp(gametime.gametime(absolute=True)))
|
||||
table2.reformat_column(0, width=30)
|
||||
self.caller.msg(unicode(table1) + "\n" + unicode(table2))
|
||||
self.caller.msg(str(table1) + "\n" + str(table2))
|
||||
|
||||
|
||||
class CmdServerLoad(COMMAND_DEFAULT_CLASS):
|
||||
|
|
@ -841,4 +841,4 @@ class CmdTickers(COMMAND_DEFAULT_CLASS):
|
|||
sub[1] if sub[1] else sub[2],
|
||||
sub[4] or "[Unset]",
|
||||
"*" if sub[5] else "-")
|
||||
self.caller.msg("|wActive tickers|n:\n" + unicode(table))
|
||||
self.caller.msg("|wActive tickers|n:\n" + str(table))
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class CommandTest(EvenniaTest):
|
|||
cmdobj.parse()
|
||||
ret = cmdobj.func()
|
||||
if isinstance(ret, types.GeneratorType):
|
||||
ret.next()
|
||||
next(ret)
|
||||
cmdobj.at_post_cmd()
|
||||
except StopIteration:
|
||||
pass
|
||||
|
|
@ -128,9 +128,9 @@ class TestGeneral(CommandTest):
|
|||
self.call(general.CmdNick(), "testalias = testaliasedstring1", "Nick 'testalias' mapped to 'testaliasedstring1'.")
|
||||
self.call(general.CmdNick(), "/account testalias = testaliasedstring2", "Nick 'testalias' mapped to 'testaliasedstring2'.")
|
||||
self.call(general.CmdNick(), "/object testalias = testaliasedstring3", "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(u"testaliasedstring3", self.char1.nicks.get("testalias", category="object"))
|
||||
self.assertEqual("testaliasedstring1", self.char1.nicks.get("testalias"))
|
||||
self.assertEqual("testaliasedstring2", self.char1.nicks.get("testalias", category="account"))
|
||||
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.")
|
||||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ Commands that are available from the connect screen.
|
|||
"""
|
||||
import re
|
||||
import time
|
||||
from codecs import lookup as codecs_lookup
|
||||
from collections import defaultdict
|
||||
from random import getrandbits
|
||||
from django.conf import settings
|
||||
|
|
@ -481,7 +482,7 @@ class CmdUnconnectedEncoding(COMMAND_DEFAULT_CLASS):
|
|||
old_encoding = self.session.protocol_flags.get("ENCODING", None)
|
||||
encoding = self.args
|
||||
try:
|
||||
utils.to_str(utils.to_unicode("test-string"), encoding=encoding)
|
||||
codecs_lookup(encoding)
|
||||
except LookupError:
|
||||
string = "|rThe encoding '|w%s|r' is invalid. Keeping the previous encoding '|w%s|r'.|n"\
|
||||
% (encoding, old_encoding)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ class ChannelHandler(object):
|
|||
if channelname:
|
||||
channel = self._cached_channels.get(channelname.lower(), None)
|
||||
return [channel] if channel else []
|
||||
return self._cached_channels.values()
|
||||
return list(self._cached_channels.values())
|
||||
|
||||
def get_cmdset(self, source_object):
|
||||
"""
|
||||
|
|
@ -292,7 +292,7 @@ class ChannelHandler(object):
|
|||
else:
|
||||
# create a new cmdset holding all viable channels
|
||||
chan_cmdset = None
|
||||
chan_cmds = [channelcmd for channel, channelcmd in self._cached_channel_cmds.iteritems()
|
||||
chan_cmds = [channelcmd for channel, channelcmd in self._cached_channel_cmds.items()
|
||||
if channel.subscriptions.has(source_object) and
|
||||
channelcmd.access(source_object, 'send')]
|
||||
if chan_cmds:
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ class DefaultChannel(with_metaclass(TypeclassBase, ChannelDB)):
|
|||
|
||||
"""
|
||||
senders = make_iter(senders) if senders else []
|
||||
if isinstance(msgobj, basestring):
|
||||
if isinstance(msgobj, str):
|
||||
# given msgobj is a string - convert to msgobject (always TempMsg)
|
||||
msgobj = TempMsg(senders=senders, header=header, message=msgobj, channels=[self])
|
||||
# we store the logging setting for use in distribute_message()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ These managers define helper methods for accessing the database from
|
|||
Comm system components.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
from django.db.models import Q
|
||||
from evennia.typeclasses.managers import (TypedObjectManager, TypeclassManager)
|
||||
|
|
@ -43,9 +43,9 @@ def dbref(inp, reqhash=True):
|
|||
dbref, otherwise `None`.
|
||||
|
||||
"""
|
||||
if reqhash and not (isinstance(inp, basestring) and inp.startswith("#")):
|
||||
if reqhash and not (isinstance(inp, str) and inp.startswith("#")):
|
||||
return None
|
||||
if isinstance(inp, basestring):
|
||||
if isinstance(inp, str):
|
||||
inp = inp.lstrip('#')
|
||||
try:
|
||||
if int(inp) < 0:
|
||||
|
|
@ -77,7 +77,7 @@ def identify_object(inp):
|
|||
return inp, "object"
|
||||
elif clsname == "ChannelDB":
|
||||
return inp, "channel"
|
||||
if isinstance(inp, basestring):
|
||||
if isinstance(inp, str):
|
||||
return inp, "string"
|
||||
elif dbref(inp):
|
||||
return dbref(inp), "dbref"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.conf import settings
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.9 on 2016-09-05 09:02
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.9 on 2016-09-21 17:31
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.11 on 2016-12-06 19:12
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.11 on 2017-02-17 20:39
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-06-06 17:31
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-06-17 20:17
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-07-05 17:26
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import migrations, models, connection
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-07-05 17:36
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-07-06 20:41
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import migrations, connection
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ class Msg(SharedMemoryModel):
|
|||
for sender in make_iter(senders):
|
||||
if not sender:
|
||||
continue
|
||||
if isinstance(sender, basestring):
|
||||
if isinstance(sender, str):
|
||||
self.db_sender_external = sender
|
||||
self.extra_senders.append(sender)
|
||||
self.save(update_fields=["db_sender_external"])
|
||||
|
|
@ -203,7 +203,7 @@ class Msg(SharedMemoryModel):
|
|||
for sender in make_iter(senders):
|
||||
if not sender:
|
||||
continue
|
||||
if isinstance(sender, basestring):
|
||||
if isinstance(sender, str):
|
||||
self.db_sender_external = ""
|
||||
self.save(update_fields=["db_sender_external"])
|
||||
if not hasattr(sender, "__dbclass__"):
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ cmdset. This will make the trade (or barter) command available
|
|||
in-game.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
from builtins import object
|
||||
|
||||
from evennia import Command, DefaultScript, CmdSet
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ def clothing_type_count(clothes_list):
|
|||
for garment in clothes_list:
|
||||
if garment.db.clothing_type:
|
||||
type = garment.db.clothing_type
|
||||
if type not in types_count.keys():
|
||||
if type not in list(types_count.keys()):
|
||||
types_count[type] = 1
|
||||
else:
|
||||
types_count[type] += 1
|
||||
|
|
@ -380,7 +380,7 @@ class CmdWear(MuxCommand):
|
|||
# Apply individual clothing type limits.
|
||||
if clothing.db.clothing_type and not clothing.db.worn:
|
||||
type_count = single_type_count(get_worn_clothes(self.caller), clothing.db.clothing_type)
|
||||
if clothing.db.clothing_type in CLOTHING_TYPE_LIMIT.keys():
|
||||
if clothing.db.clothing_type in list(CLOTHING_TYPE_LIMIT.keys()):
|
||||
if type_count >= CLOTHING_TYPE_LIMIT[clothing.db.clothing_type]:
|
||||
self.caller.msg("You can't wear any more clothes of the type '%s'." % clothing.db.clothing_type)
|
||||
return
|
||||
|
|
@ -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.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import urllib
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
import platform
|
||||
import warnings
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ from twisted.internet.defer import inlineCallbacks
|
|||
from twisted.web.client import Agent, _HTTP11ClientFactory, HTTPConnectionPool
|
||||
from twisted.web.http_headers import Headers
|
||||
from twisted.web.iweb import IBodyProducer
|
||||
from zope.interface import implements
|
||||
from zope.interface import implementer
|
||||
|
||||
from evennia.accounts.models import AccountDB
|
||||
from evennia.server.sessionhandler import SESSIONS
|
||||
|
|
@ -107,7 +107,7 @@ class EvenniaGameIndexClient(object):
|
|||
'django_version': django.get_version(),
|
||||
'server_platform': platform.platform(),
|
||||
}
|
||||
data = urllib.urlencode(values)
|
||||
data = urllib.parse.urlencode(values)
|
||||
|
||||
d = agent.request(
|
||||
'POST', self.report_url,
|
||||
|
|
@ -144,12 +144,11 @@ class SimpleResponseReceiver(protocol.Protocol):
|
|||
def connectionLost(self, reason=protocol.connectionDone):
|
||||
self.d.callback((self.status_code, self.buf))
|
||||
|
||||
|
||||
@implementer(IBodyProducer)
|
||||
class StringProducer(object):
|
||||
"""
|
||||
Used for feeding a request body to the tx HTTP client.
|
||||
"""
|
||||
implements(IBodyProducer)
|
||||
|
||||
def __init__(self, body):
|
||||
self.body = body
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ Installation/testing:
|
|||
3) Use `desc` and `detail` to customize the room, then play around!
|
||||
|
||||
"""
|
||||
from __future__ import division
|
||||
|
||||
|
||||
import datetime
|
||||
import re
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ class CmdCallback(COMMAND_DEFAULT_CLASS):
|
|||
row.append("Yes" if callback.get("valid") else "No")
|
||||
table.add_row(*row)
|
||||
|
||||
self.msg(unicode(table))
|
||||
self.msg(str(table))
|
||||
else:
|
||||
names = list(set(list(types.keys()) + list(callbacks.keys())))
|
||||
table = EvTable("Callback name", "Number", "Description",
|
||||
|
|
@ -269,7 +269,7 @@ class CmdCallback(COMMAND_DEFAULT_CLASS):
|
|||
description = description.strip("\n").splitlines()[0]
|
||||
table.add_row(name, no, description)
|
||||
|
||||
self.msg(unicode(table))
|
||||
self.msg(str(table))
|
||||
|
||||
def add_callback(self):
|
||||
"""Add a callback."""
|
||||
|
|
@ -457,7 +457,7 @@ class CmdCallback(COMMAND_DEFAULT_CLASS):
|
|||
updated_on = "|gUnknown|n"
|
||||
|
||||
table.add_row(obj.id, type_name, obj, name, by, updated_on)
|
||||
self.msg(unicode(table))
|
||||
self.msg(str(table))
|
||||
return
|
||||
|
||||
# An object was specified
|
||||
|
|
@ -518,7 +518,7 @@ class CmdCallback(COMMAND_DEFAULT_CLASS):
|
|||
delta = time_format((future - now).total_seconds(), 1)
|
||||
table.add_row(task_id, key, callback_name, delta)
|
||||
|
||||
self.msg(unicode(table))
|
||||
self.msg(str(table))
|
||||
|
||||
# Private functions to handle editing
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Scripts for the in-game Python system.
|
|||
"""
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from Queue import Queue
|
||||
from queue import Queue
|
||||
import re
|
||||
import sys
|
||||
import traceback
|
||||
|
|
@ -362,7 +362,7 @@ class EventHandler(DefaultScript):
|
|||
self.db.locked[i] = (t_obj, t_callback_name, t_number - 1)
|
||||
|
||||
# Delete time-related callbacks associated with this object
|
||||
for script in list(obj.scripts.all()):
|
||||
for script in obj.scripts.all():
|
||||
if isinstance(script, TimecallbackScript):
|
||||
if script.obj is obj and script.db.callback_name == callback_name:
|
||||
if script.db.number == number:
|
||||
|
|
|
|||
|
|
@ -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."""
|
||||
|
|
@ -224,13 +224,13 @@ class TestEventHandler(EvenniaTest):
|
|||
self.assertEqual(callback.code, "pass")
|
||||
self.assertEqual(callback.author, self.char1)
|
||||
self.assertEqual(callback.valid, True)
|
||||
self.assertIn([callback], self.room1.callbacks.all().values())
|
||||
self.assertIn([callback], list(self.room1.callbacks.all().values()))
|
||||
|
||||
# Edit this very callback
|
||||
new = self.room1.callbacks.edit("dummy", 0, "character.db.say = True",
|
||||
author=self.char1, valid=True)
|
||||
self.assertIn([new], self.room1.callbacks.all().values())
|
||||
self.assertNotIn([callback], self.room1.callbacks.all().values())
|
||||
self.assertIn([new], list(self.room1.callbacks.all().values()))
|
||||
self.assertNotIn([callback], list(self.room1.callbacks.all().values()))
|
||||
|
||||
# Try to call this callback
|
||||
self.assertTrue(self.room1.callbacks.call("dummy",
|
||||
|
|
@ -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."""
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ def register_events(path_or_typeclass):
|
|||
temporary storage, waiting for the script to be initialized.
|
||||
|
||||
"""
|
||||
if isinstance(path_or_typeclass, basestring):
|
||||
if isinstance(path_or_typeclass, str):
|
||||
typeclass = class_from_module(path_or_typeclass)
|
||||
else:
|
||||
typeclass = path_or_typeclass
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ class CmdMail(default_cmds.MuxCommand):
|
|||
table.reformat_column(4, width=7)
|
||||
|
||||
self.caller.msg(_HEAD_CHAR * _WIDTH)
|
||||
self.caller.msg(unicode(table))
|
||||
self.caller.msg(str(table))
|
||||
self.caller.msg(_HEAD_CHAR * _WIDTH)
|
||||
else:
|
||||
self.caller.msg("There are no messages in your inbox.")
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ def example1_build_mountains(x, y, **kwargs):
|
|||
room.db.desc = random.choice(room_desc)
|
||||
|
||||
# Create a random number of objects to populate the room.
|
||||
for i in xrange(randint(0, 3)):
|
||||
for i in range(randint(0, 3)):
|
||||
rock = create_object(key="Rock", location=room)
|
||||
rock.db.desc = "An ordinary rock."
|
||||
|
||||
|
|
@ -276,7 +276,7 @@ COMMAND_DEFAULT_CLASS = utils.class_from_module(settings.COMMAND_DEFAULT_CLASS)
|
|||
# Helper function for readability.
|
||||
def _map_to_list(game_map):
|
||||
"""
|
||||
Splits multi line map string into list of rows, treats for UTF-8 encoding.
|
||||
Splits multi line map string into list of rows.
|
||||
|
||||
Args:
|
||||
game_map (str): An ASCII map
|
||||
|
|
@ -285,9 +285,7 @@ def _map_to_list(game_map):
|
|||
list (list): The map split into rows
|
||||
|
||||
"""
|
||||
list_map = game_map.split('\n')
|
||||
return [character.decode('UTF-8') if isinstance(character, basestring)
|
||||
else character for character in list_map]
|
||||
return game_map.split('\n')
|
||||
|
||||
|
||||
def build_map(caller, game_map, legend, iterations=1, build_exits=True):
|
||||
|
|
@ -321,12 +319,12 @@ def build_map(caller, game_map, legend, iterations=1, build_exits=True):
|
|||
room_dict = {}
|
||||
|
||||
caller.msg("Creating Landmass...")
|
||||
for iteration in xrange(iterations):
|
||||
for y in xrange(len(game_map)):
|
||||
for x in xrange(len(game_map[y])):
|
||||
for iteration in range(iterations):
|
||||
for y in range(len(game_map)):
|
||||
for x in range(len(game_map[y])):
|
||||
for key in legend:
|
||||
# obs - we must use == for unicode
|
||||
if utils.to_unicode(game_map[y][x]) == utils.to_unicode(key):
|
||||
if game_map[y][x] == key:
|
||||
room = legend[key](x, y, iteration=iteration,
|
||||
room_dict=room_dict,
|
||||
caller=caller)
|
||||
|
|
@ -336,7 +334,7 @@ def build_map(caller, game_map, legend, iterations=1, build_exits=True):
|
|||
if build_exits:
|
||||
# Creating exits. Assumes single room object in dict entry
|
||||
caller.msg("Connecting Areas...")
|
||||
for loc_key, location in room_dict.iteritems():
|
||||
for loc_key, location in room_dict.items():
|
||||
x = loc_key[0]
|
||||
y = loc_key[1]
|
||||
|
||||
|
|
|
|||
|
|
@ -185,8 +185,8 @@ class RandomStringGenerator(object):
|
|||
tree = re.sre_parse.parse(regex).data
|
||||
# `tree` contains a list of elements in the regular expression
|
||||
for element in tree:
|
||||
# `eleemnt` is also a list, the first element is a string
|
||||
name = element[0]
|
||||
# `element` is also a list, the first element is a string
|
||||
name = str(element[0]).lower()
|
||||
desc = {"min": 1, "max": 1}
|
||||
|
||||
# If `.`, break here
|
||||
|
|
@ -213,10 +213,11 @@ class RandomStringGenerator(object):
|
|||
|
||||
def _find_literal(self, element):
|
||||
"""Find the literal corresponding to a piece of regular expression."""
|
||||
name = str(element[0]).lower()
|
||||
chars = []
|
||||
if element[0] == "literal":
|
||||
if name == "literal":
|
||||
chars.append(chr(element[1]))
|
||||
elif element[0] == "in":
|
||||
elif name == "in":
|
||||
negate = False
|
||||
if element[1][0][0] == "negate":
|
||||
negate = True
|
||||
|
|
@ -233,10 +234,10 @@ class RandomStringGenerator(object):
|
|||
chars.remove(char)
|
||||
else:
|
||||
chars.append(char)
|
||||
elif element[0] == "range":
|
||||
elif name == "range":
|
||||
chars = [chr(i) for i in range(element[1][0], element[1][1] + 1)]
|
||||
elif element[0] == "category":
|
||||
category = element[1]
|
||||
elif name == "category":
|
||||
category = str(element[1]).lower()
|
||||
if category == "category_digit":
|
||||
chars = list(string.digits)
|
||||
elif category == "category_word":
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ class LanguageHandler(DefaultScript):
|
|||
translation = {}
|
||||
|
||||
if auto_translations:
|
||||
if isinstance(auto_translations, basestring):
|
||||
if isinstance(auto_translations, str):
|
||||
# path to a file rather than a list
|
||||
with open(auto_translations, 'r') as f:
|
||||
auto_translations = f.readlines()
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
|
|
@ -511,7 +511,7 @@ def send_emote(sender, receivers, emote, anonymous_add="first"):
|
|||
process_language = receiver.process_language
|
||||
except AttributeError:
|
||||
process_language = _dummy_process
|
||||
for key, (langname, saytext) in language_mapping.iteritems():
|
||||
for key, (langname, saytext) in language_mapping.items():
|
||||
# color says
|
||||
receiver_lang_mapping[key] = process_language(saytext, sender, langname)
|
||||
# map the language {##num} markers. This will convert the escaped sdesc markers on
|
||||
|
|
@ -981,7 +981,7 @@ class CmdPose(RPCommand): # set current pose and default pose
|
|||
# set the pose. We do one-time ref->sdesc mapping here.
|
||||
parsed, mapping = parse_sdescs_and_recogs(caller, caller.location.contents, pose)
|
||||
mapping = dict((ref, obj.sdesc.get() if hasattr(obj, "sdesc") else obj.key)
|
||||
for ref, obj in mapping.iteritems())
|
||||
for ref, obj in mapping.items())
|
||||
pose = parsed.format(**mapping)
|
||||
|
||||
if len(target_name) + len(pose) > 60:
|
||||
|
|
@ -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 = ""
|
||||
|
|
@ -1223,7 +1223,7 @@ class ContribRPObject(DefaultObject):
|
|||
messaging is assumed to be handled by the caller.
|
||||
|
||||
"""
|
||||
is_string = isinstance(searchdata, basestring)
|
||||
is_string = isinstance(searchdata, str)
|
||||
|
||||
if is_string:
|
||||
# searchdata is a string; wrap some common self-references
|
||||
|
|
@ -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 = ""
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
||||
|
|
@ -355,14 +355,14 @@ class TestWilderness(EvenniaTest):
|
|||
wilderness.enter_wilderness(self.char1)
|
||||
self.assertIsInstance(self.char1.location, wilderness.WildernessRoom)
|
||||
w = self.get_wilderness_script()
|
||||
self.assertEquals(w.db.itemcoordinates[self.char1], (0, 0))
|
||||
self.assertEqual(w.db.itemcoordinates[self.char1], (0, 0))
|
||||
|
||||
def test_enter_wilderness_custom_coordinates(self):
|
||||
wilderness.create_wilderness()
|
||||
wilderness.enter_wilderness(self.char1, coordinates=(1, 2))
|
||||
self.assertIsInstance(self.char1.location, wilderness.WildernessRoom)
|
||||
w = self.get_wilderness_script()
|
||||
self.assertEquals(w.db.itemcoordinates[self.char1], (1, 2))
|
||||
self.assertEqual(w.db.itemcoordinates[self.char1], (1, 2))
|
||||
|
||||
def test_enter_wilderness_custom_name(self):
|
||||
name = "customnname"
|
||||
|
|
@ -381,7 +381,7 @@ class TestWilderness(EvenniaTest):
|
|||
i.access(self.char1, "view") or
|
||||
i.access(self.char1, "traverse"))]
|
||||
|
||||
self.assertEquals(len(exits), 3)
|
||||
self.assertEqual(len(exits), 3)
|
||||
exitsok = ["north", "northeast", "east"]
|
||||
for each_exit in exitsok:
|
||||
self.assertTrue(any([e for e in exits if e.key == each_exit]))
|
||||
|
|
@ -393,7 +393,7 @@ class TestWilderness(EvenniaTest):
|
|||
if i.destination and (
|
||||
i.access(self.char1, "view") or
|
||||
i.access(self.char1, "traverse"))]
|
||||
self.assertEquals(len(exits), 8)
|
||||
self.assertEqual(len(exits), 8)
|
||||
exitsok = ["north", "northeast", "east", "southeast", "south",
|
||||
"southwest", "west", "northwest"]
|
||||
for each_exit in exitsok:
|
||||
|
|
@ -410,25 +410,25 @@ class TestWilderness(EvenniaTest):
|
|||
w = self.get_wilderness_script()
|
||||
|
||||
# We should have no unused room after moving the first account in.
|
||||
self.assertEquals(len(w.db.unused_rooms), 0)
|
||||
self.assertEqual(len(w.db.unused_rooms), 0)
|
||||
w.move_obj(self.char1, (0, 0))
|
||||
self.assertEquals(len(w.db.unused_rooms), 0)
|
||||
self.assertEqual(len(w.db.unused_rooms), 0)
|
||||
|
||||
# And also no unused room after moving the second one in.
|
||||
w.move_obj(self.char2, (1, 1))
|
||||
self.assertEquals(len(w.db.unused_rooms), 0)
|
||||
self.assertEqual(len(w.db.unused_rooms), 0)
|
||||
|
||||
# But if char2 moves into char1's room, we should have one unused room
|
||||
# Which should be char2's old room that got created.
|
||||
w.move_obj(self.char2, (0, 0))
|
||||
self.assertEquals(len(w.db.unused_rooms), 1)
|
||||
self.assertEquals(self.char1.location, self.char2.location)
|
||||
self.assertEqual(len(w.db.unused_rooms), 1)
|
||||
self.assertEqual(self.char1.location, self.char2.location)
|
||||
|
||||
# And if char2 moves back out, that unused room should be put back to
|
||||
# use again.
|
||||
w.move_obj(self.char2, (1, 1))
|
||||
self.assertNotEquals(self.char1.location, self.char2.location)
|
||||
self.assertEquals(len(w.db.unused_rooms), 0)
|
||||
self.assertNotEqual(self.char1.location, self.char2.location)
|
||||
self.assertEqual(len(w.db.unused_rooms), 0)
|
||||
|
||||
def test_get_new_coordinates(self):
|
||||
loc = (1, 1)
|
||||
|
|
@ -440,9 +440,9 @@ class TestWilderness(EvenniaTest):
|
|||
"southwest": (0, 0),
|
||||
"west": (0, 1),
|
||||
"northwest": (0, 2)}
|
||||
for direction, correct_loc in directions.iteritems(): # Not compatible with Python 3
|
||||
for direction, correct_loc in directions.items(): # Not compatible with Python 3
|
||||
new_loc = wilderness.get_new_coordinates(loc, direction)
|
||||
self.assertEquals(new_loc, correct_loc, direction)
|
||||
self.assertEqual(new_loc, correct_loc, direction)
|
||||
|
||||
|
||||
# Testing chargen contrib
|
||||
|
|
@ -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):
|
||||
|
|
@ -797,6 +797,11 @@ class TestTutorialWorldMob(EvenniaTest):
|
|||
|
||||
from evennia.contrib.tutorial_world import objects as tutobjects
|
||||
|
||||
def _ignoreCancelled(err, *args, **kwargs):
|
||||
# Ignore the cancelled errors that we intend to occur.
|
||||
from twisted.internet.defer import CancelledError
|
||||
if not issubclass(err.type, CancelledError):
|
||||
err.raiseException()
|
||||
|
||||
class TestTutorialWorldObjects(CommandTest):
|
||||
def test_tutorialobj(self):
|
||||
|
|
@ -823,6 +828,7 @@ class TestTutorialWorldObjects(CommandTest):
|
|||
self.call(tutobjects.CmdLight(), "", "You light torch.", obj=light)
|
||||
light._burnout()
|
||||
if hasattr(light, "deferred"):
|
||||
light.deferred.addErrback(_ignoreCancelled)
|
||||
light.deferred.cancel()
|
||||
self.assertFalse(light.pk)
|
||||
|
||||
|
|
@ -845,6 +851,7 @@ class TestTutorialWorldObjects(CommandTest):
|
|||
self.assertTrue(wall.db.exit_open)
|
||||
wall.reset()
|
||||
if hasattr(wall, "deferred"):
|
||||
wall.deferred.addErrback(_ignoreCancelled)
|
||||
wall.deferred.cancel()
|
||||
wall.delete()
|
||||
|
||||
|
|
@ -920,7 +927,7 @@ class TestTurnBattleCmd(CommandTest):
|
|||
self.call(tb_basic.CmdPass(), "", "You can only do that in combat. (see: help fight)")
|
||||
self.call(tb_basic.CmdDisengage(), "", "You can only do that in combat. (see: help fight)")
|
||||
self.call(tb_basic.CmdRest(), "", "Char rests to recover HP.")
|
||||
|
||||
|
||||
# Test equipment commands
|
||||
def test_turnbattleequipcmd(self):
|
||||
# Start with equip module specific commands.
|
||||
|
|
@ -938,7 +945,7 @@ class TestTurnBattleCmd(CommandTest):
|
|||
self.call(tb_equip.CmdPass(), "", "You can only do that in combat. (see: help fight)")
|
||||
self.call(tb_equip.CmdDisengage(), "", "You can only do that in combat. (see: help fight)")
|
||||
self.call(tb_equip.CmdRest(), "", "Char rests to recover HP.")
|
||||
|
||||
|
||||
# Test range commands
|
||||
def test_turnbattlerangecmd(self):
|
||||
# Start with range module specific commands.
|
||||
|
|
@ -952,7 +959,7 @@ class TestTurnBattleCmd(CommandTest):
|
|||
self.call(tb_range.CmdPass(), "", "You can only do that in combat. (see: help fight)")
|
||||
self.call(tb_range.CmdDisengage(), "", "You can only do that in combat. (see: help fight)")
|
||||
self.call(tb_range.CmdRest(), "", "Char rests to recover HP.")
|
||||
|
||||
|
||||
|
||||
class TestTurnBattleFunc(EvenniaTest):
|
||||
|
||||
|
|
@ -1034,7 +1041,7 @@ class TestTurnBattleFunc(EvenniaTest):
|
|||
self.assertTrue(turnhandler.db.fighters == [joiner, attacker, defender])
|
||||
# Remove the script at the end
|
||||
turnhandler.stop()
|
||||
|
||||
|
||||
# Test the combat functions in tb_equip too. They work mostly the same.
|
||||
def test_tbequipfunc(self):
|
||||
attacker = create_object(tb_equip.TBEquipCharacter, key="Attacker")
|
||||
|
|
@ -1113,7 +1120,7 @@ class TestTurnBattleFunc(EvenniaTest):
|
|||
self.assertTrue(turnhandler.db.fighters == [joiner, attacker, defender])
|
||||
# Remove the script at the end
|
||||
turnhandler.stop()
|
||||
|
||||
|
||||
# Test combat functions in tb_range too.
|
||||
def test_tbrangefunc(self):
|
||||
testroom = create_object(DefaultRoom, key="Test Room")
|
||||
|
|
|
|||
|
|
@ -733,7 +733,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):
|
||||
|
|
|
|||
|
|
@ -850,7 +850,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):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
"""
|
||||
This package holds the demo game of Evennia.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
|
||||
from . import mob, objects, rooms
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ commands needed to control them. Those commands could also have been
|
|||
in a separate module (e.g. if they could have been re-used elsewhere.)
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import random
|
||||
from evennia import TICKER_HANDLER
|
||||
|
|
@ -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 "\
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ class WildernessScript(DefaultScript):
|
|||
for coordinates, room in self.db.rooms.items():
|
||||
room.ndb.wildernessscript = self
|
||||
room.ndb.active_coordinates = coordinates
|
||||
for item in self.db.itemcoordinates.keys():
|
||||
for item in list(self.db.itemcoordinates.keys()):
|
||||
# Items deleted from the wilderness leave None type 'ghosts'
|
||||
# that must be cleaned out
|
||||
if item is None:
|
||||
|
|
@ -302,7 +302,7 @@ class WildernessScript(DefaultScript):
|
|||
[Object, ]: list of Objects at coordinates
|
||||
"""
|
||||
result = []
|
||||
for item, item_coordinates in self.itemcoordinates.items():
|
||||
for item, item_coordinates in list(self.itemcoordinates.items()):
|
||||
# Items deleted from the wilderness leave None type 'ghosts'
|
||||
# that must be cleaned out
|
||||
if item is None:
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
# """
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -62,4 +62,4 @@ AMP_PORT = 4006
|
|||
try:
|
||||
from server.conf.secret_settings import *
|
||||
except ImportError:
|
||||
print "secret_settings.py file not found or failed to import."
|
||||
print("secret_settings.py file not found or failed to import.")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-06-06 17:31
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class HelpEntry(SharedMemoryModel):
|
|||
return self.key
|
||||
|
||||
def __unicode__(self):
|
||||
return u'%s' % self.key
|
||||
return '%s' % self.key
|
||||
|
||||
def access(self, accessing_obj, access_type='read', default=False):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ DefaultLock: Exits: controls who may traverse the exit to
|
|||
Dark/light script
|
||||
```
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from evennia.utils import utils
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ restricted @perm command sets them, but otherwise they are identical
|
|||
to any other identifier you can use.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
from builtins import object
|
||||
|
||||
import re
|
||||
|
|
@ -302,7 +302,7 @@ class LockHandler(object):
|
|||
error.
|
||||
|
||||
"""
|
||||
if isinstance(lockstring, basestring):
|
||||
if isinstance(lockstring, str):
|
||||
lockdefs = lockstring.split(";")
|
||||
else:
|
||||
lockdefs = [lockdef for locks in lockstring for lockdef in locks.split(";")]
|
||||
|
|
|
|||
|
|
@ -27,29 +27,29 @@ class TestLockCheck(EvenniaTest):
|
|||
dbref = self.obj2.dbref
|
||||
self.obj1.locks.add("owner:dbref(%s);edit:dbref(%s) or perm(Admin);examine:perm(Builder) and id(%s);delete:perm(Admin);get:all()" % (dbref, dbref, dbref))
|
||||
self.obj2.permissions.add('Admin')
|
||||
self.assertEquals(True, self.obj1.locks.check(self.obj2, 'owner'))
|
||||
self.assertEquals(True, self.obj1.locks.check(self.obj2, 'edit'))
|
||||
self.assertEquals(True, self.obj1.locks.check(self.obj2, 'examine'))
|
||||
self.assertEquals(True, self.obj1.locks.check(self.obj2, 'delete'))
|
||||
self.assertEquals(True, self.obj1.locks.check(self.obj2, 'get'))
|
||||
self.assertEqual(True, self.obj1.locks.check(self.obj2, 'owner'))
|
||||
self.assertEqual(True, self.obj1.locks.check(self.obj2, 'edit'))
|
||||
self.assertEqual(True, self.obj1.locks.check(self.obj2, 'examine'))
|
||||
self.assertEqual(True, self.obj1.locks.check(self.obj2, 'delete'))
|
||||
self.assertEqual(True, self.obj1.locks.check(self.obj2, 'get'))
|
||||
self.obj1.locks.add("get:false()")
|
||||
self.assertEquals(False, self.obj1.locks.check(self.obj2, 'get'))
|
||||
self.assertEquals(True, self.obj1.locks.check(self.obj2, 'not_exist', default=True))
|
||||
self.assertEqual(False, self.obj1.locks.check(self.obj2, 'get'))
|
||||
self.assertEqual(True, self.obj1.locks.check(self.obj2, 'not_exist', default=True))
|
||||
|
||||
|
||||
class TestLockfuncs(EvenniaTest):
|
||||
def testrun(self):
|
||||
self.obj2.permissions.add('Admin')
|
||||
self.assertEquals(True, lockfuncs.true(self.obj2, self.obj1))
|
||||
self.assertEquals(False, lockfuncs.false(self.obj2, self.obj1))
|
||||
self.assertEquals(True, lockfuncs.perm(self.obj2, self.obj1, 'Admin'))
|
||||
self.assertEquals(True, lockfuncs.perm_above(self.obj2, self.obj1, 'Builder'))
|
||||
self.assertEqual(True, lockfuncs.true(self.obj2, self.obj1))
|
||||
self.assertEqual(False, lockfuncs.false(self.obj2, self.obj1))
|
||||
self.assertEqual(True, lockfuncs.perm(self.obj2, self.obj1, 'Admin'))
|
||||
self.assertEqual(True, lockfuncs.perm_above(self.obj2, self.obj1, 'Builder'))
|
||||
dbref = self.obj2.dbref
|
||||
self.assertEquals(True, lockfuncs.dbref(self.obj2, self.obj1, '%s' % dbref))
|
||||
self.assertEqual(True, lockfuncs.dbref(self.obj2, self.obj1, '%s' % dbref))
|
||||
self.obj2.db.testattr = 45
|
||||
self.assertEquals(True, lockfuncs.attr(self.obj2, self.obj1, 'testattr', '45'))
|
||||
self.assertEquals(False, lockfuncs.attr_gt(self.obj2, self.obj1, 'testattr', '45'))
|
||||
self.assertEquals(True, lockfuncs.attr_ge(self.obj2, self.obj1, 'testattr', '45'))
|
||||
self.assertEquals(False, lockfuncs.attr_lt(self.obj2, self.obj1, 'testattr', '45'))
|
||||
self.assertEquals(True, lockfuncs.attr_le(self.obj2, self.obj1, 'testattr', '45'))
|
||||
self.assertEquals(False, lockfuncs.attr_ne(self.obj2, self.obj1, 'testattr', '45'))
|
||||
self.assertEqual(True, lockfuncs.attr(self.obj2, self.obj1, 'testattr', '45'))
|
||||
self.assertEqual(False, lockfuncs.attr_gt(self.obj2, self.obj1, 'testattr', '45'))
|
||||
self.assertEqual(True, lockfuncs.attr_ge(self.obj2, self.obj1, 'testattr', '45'))
|
||||
self.assertEqual(False, lockfuncs.attr_lt(self.obj2, self.obj1, 'testattr', '45'))
|
||||
self.assertEqual(True, lockfuncs.attr_le(self.obj2, self.obj1, 'testattr', '45'))
|
||||
self.assertEqual(False, lockfuncs.attr_ne(self.obj2, self.obj1, 'testattr', '45'))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from django.db.models import Q
|
|||
from django.conf import settings
|
||||
from django.db.models.fields import exceptions
|
||||
from evennia.typeclasses.managers import TypedObjectManager, TypeclassManager
|
||||
from evennia.utils.utils import to_unicode, is_iter, make_iter, string_partial_matching
|
||||
from evennia.utils.utils import is_iter, make_iter, string_partial_matching
|
||||
from builtins import int
|
||||
|
||||
__all__ = ("ObjectManager",)
|
||||
|
|
@ -72,7 +72,7 @@ class ObjectDBManager(TypedObjectManager):
|
|||
match (Object or list): One or more matching results.
|
||||
|
||||
"""
|
||||
ostring = to_unicode(ostring).lstrip('*')
|
||||
ostring = str(ostring).lstrip('*')
|
||||
# simplest case - search by dbref
|
||||
dbref = self.dbref(ostring)
|
||||
if dbref:
|
||||
|
|
@ -151,7 +151,7 @@ class ObjectDBManager(TypedObjectManager):
|
|||
|
||||
# This doesn't work if attribute_value is an object. Workaround below
|
||||
|
||||
if isinstance(attribute_value, (basestring, int, float, bool)):
|
||||
if isinstance(attribute_value, (str, int, float, bool)):
|
||||
return self.filter(cand_restriction & type_restriction & Q(db_attributes__db_key=attribute_name,
|
||||
db_attributes__db_value=attribute_value))
|
||||
else:
|
||||
|
|
@ -196,9 +196,7 @@ class ObjectDBManager(TypedObjectManager):
|
|||
typeclasses (list, optional): List of typeclass-path strings to restrict matches with
|
||||
|
||||
"""
|
||||
if isinstance(property_value, basestring):
|
||||
property_value = to_unicode(property_value)
|
||||
if isinstance(property_name, basestring):
|
||||
if isinstance(property_name, str):
|
||||
if not property_name.startswith('db_'):
|
||||
property_name = "db_%s" % property_name
|
||||
querykwargs = {property_name: property_value}
|
||||
|
|
@ -244,7 +242,7 @@ class ObjectDBManager(TypedObjectManager):
|
|||
Returns:
|
||||
matches (list): A list of matches of length 0, 1 or more.
|
||||
"""
|
||||
if not isinstance(ostring, basestring):
|
||||
if not isinstance(ostring, str):
|
||||
if hasattr(ostring, "key"):
|
||||
ostring = ostring.key
|
||||
else:
|
||||
|
|
@ -365,9 +363,9 @@ class ObjectDBManager(TypedObjectManager):
|
|||
typeclasses = make_iter(typeclass)
|
||||
for i, typeclass in enumerate(make_iter(typeclasses)):
|
||||
if callable(typeclass):
|
||||
typeclasses[i] = u"%s.%s" % (typeclass.__module__, typeclass.__name__)
|
||||
typeclasses[i] = "%s.%s" % (typeclass.__module__, typeclass.__name__)
|
||||
else:
|
||||
typeclasses[i] = u"%s" % typeclass
|
||||
typeclasses[i] = "%s" % typeclass
|
||||
typeclass = typeclasses
|
||||
|
||||
if candidates is not None:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
import django.db.models.deletion
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
import django.db.models.deletion
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-06-06 17:31
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-07-05 17:27
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import migrations, models, connection
|
||||
import django.db.models.deletion
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-07-05 17:36
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-07-06 20:41
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import migrations, connection
|
||||
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ class ObjectDB(TypedObject):
|
|||
|
||||
def __location_set(self, location):
|
||||
"""Set location, checking for loops and allowing dbref"""
|
||||
if isinstance(location, (basestring, int)):
|
||||
if isinstance(location, (str, int)):
|
||||
# allow setting of #dbref
|
||||
dbid = dbref(location, reqhash=False)
|
||||
if dbid:
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ from evennia.commands import cmdhandler
|
|||
from evennia.utils import search
|
||||
from evennia.utils import logger
|
||||
from evennia.utils.utils import (variable_from_module, lazy_property,
|
||||
make_iter, to_unicode, is_iter)
|
||||
make_iter, is_iter)
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
_MULTISESSION_MODE = settings.MULTISESSION_MODE
|
||||
|
|
@ -359,7 +359,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
|
|||
messaging is assumed to be handled by the caller.
|
||||
|
||||
"""
|
||||
is_string = isinstance(searchdata, basestring)
|
||||
is_string = isinstance(searchdata, str)
|
||||
|
||||
|
||||
if is_string:
|
||||
|
|
@ -436,7 +436,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
|
|||
matching Accounts.
|
||||
|
||||
"""
|
||||
if isinstance(searchdata, basestring):
|
||||
if isinstance(searchdata, str):
|
||||
# searchdata is a string; wrap some common self-references
|
||||
if searchdata.lower() in ("me", "self",):
|
||||
return [self.account] if quiet else self.account
|
||||
|
|
@ -479,7 +479,6 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
|
|||
"""
|
||||
# nick replacement - we require full-word matching.
|
||||
# do text encoding conversion
|
||||
raw_string = to_unicode(raw_string)
|
||||
raw_string = self.nicks.nickreplace(raw_string, categories=("inputline", "channel"), include_account=True)
|
||||
return cmdhandler.cmdhandler(self, raw_string, callertype="object", session=session, **kwargs)
|
||||
|
||||
|
|
@ -877,7 +876,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 +895,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 +1759,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 +1873,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 +1989,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 ...
|
||||
|
|
|
|||
|
|
@ -240,9 +240,9 @@ class ScriptDBManager(TypedObjectManager):
|
|||
|
||||
if typeclass:
|
||||
if callable(typeclass):
|
||||
typeclass = u"%s.%s" % (typeclass.__module__, typeclass.__name__)
|
||||
typeclass = "%s.%s" % (typeclass.__module__, typeclass.__name__)
|
||||
else:
|
||||
typeclass = u"%s" % typeclass
|
||||
typeclass = "%s" % typeclass
|
||||
|
||||
# not a dbref; normal search
|
||||
obj_restriction = obj and Q(db_obj=obj) or Q()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.conf import settings
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue