diff --git a/evennia/accounts/accounts.py b/evennia/accounts/accounts.py index 43870ce1fa..47720ad211 100644 --- a/evennia/accounts/accounts.py +++ b/evennia/accounts/accounts.py @@ -16,14 +16,13 @@ import time import typing from random import getrandbits +import evennia from django.conf import settings from django.contrib.auth import authenticate, password_validation from django.core.exceptions import ImproperlyConfigured, ValidationError from django.utils import timezone from django.utils.module_loading import import_string from django.utils.translation import gettext as _ - -import evennia from evennia.accounts.manager import AccountManager from evennia.accounts.models import AccountDB from evennia.commands.cmdsethandler import CmdSetHandler @@ -42,13 +41,7 @@ from evennia.typeclasses.attributes import ModelAttributeBackend, NickHandler from evennia.typeclasses.models import TypeclassBase from evennia.utils import class_from_module, create, logger from evennia.utils.optionhandler import OptionHandler -from evennia.utils.utils import ( - is_iter, - lazy_property, - make_iter, - to_str, - variable_from_module, -) +from evennia.utils.utils import is_iter, lazy_property, make_iter, to_str, variable_from_module __all__ = ("DefaultAccount", "DefaultGuest") diff --git a/evennia/commands/default/general.py b/evennia/commands/default/general.py index e1eff225ee..3899cfcd93 100644 --- a/evennia/commands/default/general.py +++ b/evennia/commands/default/general.py @@ -5,8 +5,7 @@ General Character commands usually available to all characters import re from django.conf import settings - -import evennia +from evennia.objects.objects import DefaultObject from evennia.typeclasses.attributes import NickTemplateInvalid from evennia.utils import utils @@ -143,7 +142,7 @@ class CmdNick(COMMAND_DEFAULT_CLASS): def parse(self): """ - Support escaping of = with \= + Support escaping of = with \\= """ super().parse() args = (self.lhs or "") + (" = %s" % self.rhs if self.rhs else "") @@ -153,7 +152,7 @@ class CmdNick(COMMAND_DEFAULT_CLASS): self.lhs = parts[0].strip() else: self.lhs, self.rhs = [part.strip() for part in parts] - self.lhs = self.lhs.replace("\=", "=") + self.lhs = self.lhs.replace("\\=", "=") def func(self): """Create the nickname""" @@ -799,6 +798,6 @@ class CmdAccess(COMMAND_DEFAULT_CLASS): string += "\n|wYour access|n:" string += f"\nCharacter |c{caller.key}|n: {cperms}" - if utils.inherits_from(caller, evennia.DefaultObject): + if utils.inherits_from(caller, DefaultObject): string += f"\nAccount |c{caller.account.key}|n: {pperms}" caller.msg(string) diff --git a/evennia/commands/default/system.py b/evennia/commands/default/system.py index df493f366a..9ab2b9af3d 100644 --- a/evennia/commands/default/system.py +++ b/evennia/commands/default/system.py @@ -957,7 +957,7 @@ class CmdTickers(COMMAND_DEFAULT_CLASS): locks = "cmd:perm(tickers) or perm(Builder)" def func(self): - from evennia import TICKER_HANDLER + from evennia.scripts.tickerhandler import TICKER_HANDLER all_subs = TICKER_HANDLER.all_display() if not all_subs: diff --git a/evennia/commands/default/tests.py b/evennia/commands/default/tests.py index 5db4c14acd..ccafd8d984 100644 --- a/evennia/commands/default/tests.py +++ b/evennia/commands/default/tests.py @@ -18,14 +18,10 @@ import evennia from anything import Anything from django.conf import settings from django.test import override_settings -from evennia import ( - DefaultCharacter, - DefaultExit, - DefaultObject, - DefaultRoom, - ObjectDB, - search_object, -) + +from evennia.objects.objects import DefaultCharacter, DefaultExit, DefaultObject, DefaultRoom +from evennia.objects.models import ObjectDB +from evennia.utils.search import search_object from evennia.commands import cmdparser from evennia.commands.cmdset import CmdSet from evennia.commands.command import Command, InterruptCommand @@ -37,7 +33,6 @@ from evennia.commands.default.muxcommand import MuxCommand from evennia.prototypes import prototypes as protlib from evennia.utils import create, gametime, utils from evennia.utils.test_resources import BaseEvenniaCommandTest # noqa -from evennia.utils.test_resources import BaseEvenniaTest, EvenniaCommandTest from parameterized import parameterized from twisted.internet import task diff --git a/evennia/comms/comms.py b/evennia/comms/comms.py index 5b1a0bc028..56338c1d2c 100644 --- a/evennia/comms/comms.py +++ b/evennia/comms/comms.py @@ -9,7 +9,7 @@ from django.contrib.contenttypes.models import ContentType from django.urls import reverse from django.utils.text import slugify -import evennia +from evennia.objects.objects import DefaultObject from evennia.comms.managers import ChannelManager from evennia.comms.models import ChannelDB from evennia.typeclasses.models import TypeclassBase @@ -231,7 +231,7 @@ class DefaultChannel(ChannelDB, metaclass=TypeclassBase): """ has_sub = self.subscriptions.has(subscriber) - if not has_sub and inherits_from(subscriber, evennia.DefaultObject): + if not has_sub and inherits_from(subscriber, DefaultObject): # it's common to send an Object when we # by default only allow Accounts to subscribe. has_sub = self.subscriptions.has(subscriber.account) diff --git a/evennia/comms/tests.py b/evennia/comms/tests.py index b037730e49..7bd9a8c6ac 100644 --- a/evennia/comms/tests.py +++ b/evennia/comms/tests.py @@ -1,6 +1,6 @@ from django.test import SimpleTestCase -from evennia import DefaultChannel +from evennia.comms.comms import DefaultChannel from evennia.commands.default.comms import CmdChannel from evennia.utils.create import create_message from evennia.utils.test_resources import BaseEvenniaTest diff --git a/evennia/contrib/base_systems/ingame_python/typeclasses.py b/evennia/contrib/base_systems/ingame_python/typeclasses.py index 5f14ee8c6e..af9a40032a 100644 --- a/evennia/contrib/base_systems/ingame_python/typeclasses.py +++ b/evennia/contrib/base_systems/ingame_python/typeclasses.py @@ -7,14 +7,14 @@ default ones in evennia core. """ -from evennia import DefaultCharacter, DefaultExit, DefaultObject, DefaultRoom, ScriptDB +from evennia.objects.objects import DefaultCharacter, DefaultExit, DefaultObject, DefaultRoom from evennia.contrib.base_systems.ingame_python.callbackhandler import CallbackHandler from evennia.contrib.base_systems.ingame_python.utils import ( phrase_event, register_events, time_event, ) -from evennia.utils.utils import delay, inherits_from, lazy_property +from evennia.utils.utils import inherits_from, lazy_property # Character help CHARACTER_CAN_DELETE = """ diff --git a/evennia/contrib/base_systems/ingame_python/utils.py b/evennia/contrib/base_systems/ingame_python/utils.py index 8635792964..c991d720fc 100644 --- a/evennia/contrib/base_systems/ingame_python/utils.py +++ b/evennia/contrib/base_systems/ingame_python/utils.py @@ -7,7 +7,8 @@ These functions are to be used by developers to customize events and callbacks. from django.conf import settings -from evennia import ScriptDB, logger +from evennia.scripts.models import ScriptDB +from evennia.utils import logger from evennia.contrib.base_systems.custom_gametime import UNITS, gametime_to_realtime from evennia.contrib.base_systems.custom_gametime import ( real_seconds_until as custom_rsu, diff --git a/evennia/contrib/full_systems/evscaperoom/commands.py b/evennia/contrib/full_systems/evscaperoom/commands.py index e573e1c8ba..2b96b0ad06 100644 --- a/evennia/contrib/full_systems/evscaperoom/commands.py +++ b/evennia/contrib/full_systems/evscaperoom/commands.py @@ -29,16 +29,11 @@ Admin/development commands import re +import evennia from django.conf import settings - -from evennia import ( - SESSION_HANDLER, - CmdSet, - Command, - InterruptCommand, - default_cmds, - syscmdkeys, -) +from evennia import default_cmds, syscmdkeys +from evennia.commands.cmdset import CmdSet +from evennia.commands.command import Command, InterruptCommand from evennia.utils import variable_from_module from .utils import create_evscaperoom_object @@ -300,7 +295,7 @@ class CmdWho(CmdEvscapeRoom, default_cmds.CmdWho): if self.args == "all": table = self.style_table("|wName", "|wRoom") - sessions = SESSION_HANDLER.get_sessions() + sessions = evennia.SESSION_HANDLER.get_sessions() for session in sessions: puppet = session.get_puppet() if puppet: diff --git a/evennia/objects/tests.py b/evennia/objects/tests.py index 9daaf0dcf5..3c9ab78576 100644 --- a/evennia/objects/tests.py +++ b/evennia/objects/tests.py @@ -1,6 +1,6 @@ from unittest import skip -from evennia import DefaultCharacter, DefaultExit, DefaultObject, DefaultRoom +from evennia.objects.objects import DefaultCharacter, DefaultExit, DefaultObject, DefaultRoom from evennia.objects.models import ObjectDB from evennia.typeclasses.attributes import AttributeProperty from evennia.typeclasses.tags import ( diff --git a/evennia/utils/gametime.py b/evennia/utils/gametime.py index 297badde51..f1e499a430 100644 --- a/evennia/utils/gametime.py +++ b/evennia/utils/gametime.py @@ -8,13 +8,13 @@ total runtime of the server and the current uptime. """ import time +import evennia from datetime import datetime, timedelta from django.conf import settings from django.db.utils import OperationalError -import evennia -from evennia import DefaultScript +from evennia.scripts.scripts import DefaultScript from evennia.server.models import ServerConfig from evennia.utils.create import create_script