mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Remove many uses of the short api from inside the library, to ease startup loops
This commit is contained in:
parent
53b7ee8a90
commit
6117e85ac9
11 changed files with 26 additions and 43 deletions
|
|
@ -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")
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 = """
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue