Format code imports

This commit is contained in:
Griatch 2022-11-10 22:21:12 +01:00
parent 92834aacd0
commit a461a97576
361 changed files with 1019 additions and 754 deletions

View File

@ -8,10 +8,10 @@ Griatch 2017, released under the BSD license.
"""
import fnmatch
import os
import re
import sys
import os
import fnmatch
ANSI_HILITE = "\033[1m"
ANSI_RED = "\033[31m"

View File

@ -6,5 +6,6 @@ This is copied directly into the python bin directory and makes the
'evennia' program available on $PATH.
"""
from evennia.server.evennia_launcher import main
from evennia.server.evennia_launcher import main
main()

View File

@ -5,8 +5,9 @@ Remap autodoc API rst files to md files and wrap their contents.
"""
from glob import glob
from os.path import abspath, join as pathjoin, dirname
from os import rename
from os.path import abspath, dirname
from os.path import join as pathjoin
def _rst2md(filename_rst):

View File

@ -5,11 +5,14 @@
Builds a lunr static search index for optimized search
"""
import os
import json
import glob
import json
import os
from argparse import ArgumentParser
from os.path import sep, abspath, dirname, join as joinpath
from os.path import abspath, dirname
from os.path import join as joinpath
from os.path import sep
from lunr import lunr
_DOCS_PATH = dirname(dirname(abspath(__file__)))

View File

@ -4,8 +4,10 @@ an index.
"""
from collections import defaultdict
from os.path import abspath, dirname, join as pathjoin, sep
from glob import glob
from os.path import abspath, dirname
from os.path import join as pathjoin
from os.path import sep
_EVENNIA_PATH = pathjoin(dirname(dirname(dirname(abspath(__file__)))))
_DOCS_PATH = pathjoin(_EVENNIA_PATH, "docs")

View File

@ -13,9 +13,9 @@ We also need to build the toc-tree and should do so automatically for now.
"""
import datetime
import glob
import re
import datetime
_RE_MD_LINK = re.compile(r"\[(?P<txt>[\w -\[\]]+?)\]\((?P<url>.+?)\)", re.I + re.S + re.U)
_RE_REF_LINK = re.compile(r"\[[\w -\[\]]*?\]\(.+?\)", re.I + re.S + re.U)

View File

@ -8,9 +8,9 @@ Usage:
python fmtwidth.py --width 79 ../source/**.md
"""
import argparse
import glob
import textwrap
import argparse
_DEFAULT_WIDTH = 100

View File

@ -10,7 +10,8 @@ To test - import this from a Django-aware shell, then call run_update.
from os.path import abspath, dirname
from os.path import join as pathjoin
from evennia.utils.utils import callables_from_module, mod_import, variable_from_module
from evennia.utils.utils import (callables_from_module, mod_import,
variable_from_module)
__all__ = "run_update"

View File

@ -3,7 +3,8 @@ Update dynamically generated doc pages based on github sources.
"""
from os.path import dirname, abspath, join as pathjoin
from os.path import abspath, dirname
from os.path import join as pathjoin
ROOTDIR = dirname(dirname(dirname(abspath(__file__))))
DOCDIR = pathjoin(ROOTDIR, "docs")

View File

@ -5,13 +5,12 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys
import re
import sys
# from recommonmark.transform import AutoStructify
from sphinx.util.osutil import cd
# -- Project information -----------------------------------------------------
project = "Evennia"
@ -349,12 +348,8 @@ def setup(app):
# build toctree file
sys.path.insert(1, os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
from docs.pylib import (
auto_link_remapper,
update_default_cmd_index,
contrib_readmes2docs,
update_dynamic_pages,
)
from docs.pylib import (auto_link_remapper, contrib_readmes2docs,
update_default_cmd_index, update_dynamic_pages)
_no_autodoc = os.environ.get("NOAUTODOC")
update_default_cmd_index.run_update(no_autodoc=_no_autodoc)

View File

@ -20,6 +20,7 @@ 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 _
from evennia.accounts.manager import AccountManager
from evennia.accounts.models import AccountDB
from evennia.commands.cmdsethandler import CmdSetHandler

View File

@ -8,6 +8,7 @@ import time
from django.conf import settings
from django.utils.translation import gettext as _
from evennia.accounts.accounts import DefaultAccount
from evennia.scripts.scripts import DefaultScript
from evennia.utils import search, utils

View File

@ -3,12 +3,14 @@ The managers for the custom Account object and permissions.
"""
import datetime
from django.conf import settings
from django.utils import timezone
from django.contrib.auth.models import UserManager
from evennia.typeclasses.managers import TypedObjectManager, TypeclassManager
from django.utils import timezone
from evennia.server import signals
from evennia.utils.utils import make_iter, class_from_module, dbid_to_obj
from evennia.typeclasses.managers import TypeclassManager, TypedObjectManager
from evennia.utils.utils import class_from_module, dbid_to_obj, make_iter
__all__ = ("AccountManager", "AccountDBManager")

View File

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
from django.db import models, migrations
import django.utils.timezone
import django.core.validators
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.db import models, migrations
from django.db import migrations, models
def convert_defaults(apps, schema_editor):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.db import models, migrations
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
from django.db import models, migrations
import evennia.accounts.manager
import django.core.validators
from django.db import migrations, models
import evennia.accounts.manager
class Migration(migrations.Migration):

View File

@ -3,6 +3,7 @@
import django.contrib.auth.validators
from django.db import migrations, models
import evennia.accounts.manager

View File

@ -1,6 +1,7 @@
# Generated by Django 3.2.3 on 2021-05-20 21:37
from django.db import migrations, models
import evennia.accounts.manager

View File

@ -19,6 +19,7 @@ from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.utils.encoding import smart_str
from evennia.accounts.manager import AccountDBManager
from evennia.server.signals import SIGNAL_ACCOUNT_POST_RENAME
from evennia.typeclasses.models import TypedObject

View File

@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
from mock import Mock, MagicMock, patch
from random import randint
from unittest import TestCase
from django.test import override_settings
from evennia.accounts.accounts import AccountSessionHandler
from evennia.accounts.accounts import DefaultAccount, DefaultGuest
from evennia.utils.test_resources import BaseEvenniaTest
from mock import MagicMock, Mock, patch
from evennia.accounts.accounts import AccountSessionHandler, DefaultAccount, DefaultGuest
from evennia.utils import create
from evennia.utils.test_resources import BaseEvenniaTest
from evennia.utils.utils import uses_database

View File

@ -36,13 +36,14 @@ from weakref import WeakValueDictionary
from django.conf import settings
from django.utils.translation import gettext as _
from evennia.commands.command import InterruptCommand
from evennia.utils import logger, utils
from evennia.utils.utils import string_suggestions
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet.task import deferLater
from evennia.commands.command import InterruptCommand
from evennia.utils import logger, utils
from evennia.utils.utils import string_suggestions
_IN_GAME_ERRORS = settings.IN_GAME_ERRORS
__all__ = ("cmdhandler", "InterruptCommand")

View File

@ -8,7 +8,9 @@ same inputs as the default one.
import re
from django.conf import settings
from evennia.utils.logger import log_trace
_MULTIMATCH_REGEX = re.compile(settings.SEARCH_MULTIMATCH_REGEX, re.I + re.U)

View File

@ -29,6 +29,7 @@ Set theory.
from weakref import WeakKeyDictionary
from django.utils.translation import gettext as _
from evennia.utils.utils import inherits_from, is_iter
__all__ = ("CmdSet",)

View File

@ -65,15 +65,16 @@ the 'Fishing' set. Fishing from a boat? No problem!
"""
import sys
from traceback import format_exc
from importlib import import_module
from inspect import trace
from traceback import format_exc
from django.conf import settings
from evennia.utils import logger, utils
from django.utils.translation import gettext as _
from evennia.commands.cmdset import CmdSet
from evennia.server.models import ServerConfig
from django.utils.translation import gettext as _
from evennia.utils import logger, utils
__all__ = ("import_cmdset", "CmdSetHandler")

View File

@ -11,6 +11,7 @@ import re
from django.conf import settings
from django.urls import reverse
from django.utils.text import slugify
from evennia.locks.lockhandler import LockHandler
from evennia.utils.ansi import ANSIString
from evennia.utils.evtable import EvTable

View File

@ -22,6 +22,7 @@ import time
from codecs import lookup as codecs_lookup
from django.conf import settings
from evennia.server.sessionhandler import SESSIONS
from evennia.utils import create, logger, search, utils

View File

@ -4,12 +4,14 @@ Admin commands
"""
import time
import re
import time
from django.conf import settings
from evennia.server.sessionhandler import SESSIONS
from evennia.server.models import ServerConfig
from evennia.utils import evtable, logger, search, class_from_module
from evennia.server.sessionhandler import SESSIONS
from evennia.utils import class_from_module, evtable, logger, search
COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS)

View File

@ -20,10 +20,10 @@ therefore always be limited to superusers only.
import re
from django.conf import settings
from evennia.utils.batchprocessors import BATCHCMD, BATCHCODE
from evennia.commands.cmdset import CmdSet
from evennia.utils import logger, utils
from evennia.utils.batchprocessors import BATCHCMD, BATCHCODE
_RE_COMMENT = re.compile(r"^#.*?$", re.MULTILINE + re.DOTALL)
_RE_CODE_START = re.compile(r"^# batchcode code:", re.MULTILINE)

View File

@ -6,6 +6,7 @@ import re
from django.conf import settings
from django.core.paginator import Paginator
from django.db.models import Max, Min, Q
from evennia import InterruptCommand
from evennia.commands.cmdhandler import get_and_merge_cmdsets
from evennia.locks.lockhandler import LockException

View File

@ -10,8 +10,7 @@ command method rather than caller.msg().
"""
from evennia.commands.cmdset import CmdSet
from evennia.commands.default import help, comms, admin, system
from evennia.commands.default import building, account, general
from evennia.commands.default import account, admin, building, comms, general, help, system
class AccountCmdSet(CmdSet):

View File

@ -5,9 +5,7 @@ communication-commands are instead put on the account level, in the
Account cmdset. Account commands remain available also to Characters.
"""
from evennia.commands.cmdset import CmdSet
from evennia.commands.default import general, help, admin, system
from evennia.commands.default import building
from evennia.commands.default import batchprocess
from evennia.commands.default import admin, batchprocess, building, general, help, system
class CharacterCmdSet(CmdSet):

View File

@ -8,6 +8,7 @@ Communication commands:
"""
from django.conf import settings
from evennia.accounts import bots
from evennia.accounts.models import AccountDB
from evennia.comms.comms import DefaultChannel

View File

@ -4,6 +4,7 @@ General Character commands usually available to all characters
import re
from django.conf import settings
from evennia.typeclasses.attributes import NickTemplateInvalid
from evennia.utils import utils

View File

@ -13,6 +13,7 @@ from dataclasses import dataclass
from itertools import chain
from django.conf import settings
from evennia.help.filehelp import FILE_HELP_ENTRIES
from evennia.help.models import HelpEntry
from evennia.help.utils import help_search_with_index, parse_entry_for_subcategories

View File

@ -3,8 +3,8 @@ The command template for the default MUX-style command set. There
is also an Account/OOC version that makes sure caller is an Account object.
"""
from evennia.utils import utils
from evennia.commands.command import Command
from evennia.utils import utils
# limit symbol import for API
__all__ = ("MuxCommand", "MuxAccountCommand")

View File

@ -18,18 +18,14 @@ line with a command (if there is no match to a known command,
the line is just added to the editor buffer).
"""
from evennia.comms.models import ChannelDB
from evennia.utils import create
from evennia.utils.utils import at_search_result
from django.conf import settings
# The command keys the engine is calling
# (the actual names all start with __)
from evennia.commands.cmdhandler import CMD_NOINPUT
from evennia.commands.cmdhandler import CMD_NOMATCH
from evennia.commands.cmdhandler import CMD_MULTIMATCH
from evennia.utils import utils
from django.conf import settings
from evennia.commands.cmdhandler import CMD_MULTIMATCH, CMD_NOINPUT, CMD_NOMATCH
from evennia.comms.models import ChannelDB
from evennia.utils import create, utils
from evennia.utils.utils import at_search_result
COMMAND_DEFAULT_CLASS = utils.class_from_module(settings.COMMAND_DEFAULT_CLASS)

View File

@ -15,6 +15,7 @@ import traceback
import django
import twisted
from django.conf import settings
from evennia.accounts.models import AccountDB
from evennia.scripts.taskhandler import TaskHandlerTask
from evennia.server.sessionhandler import SESSIONS

View File

@ -17,6 +17,9 @@ from unittest.mock import MagicMock, Mock, patch
from anything import Anything
from django.conf import settings
from django.test import override_settings
from parameterized import parameterized
from twisted.internet import task
from evennia import (
DefaultCharacter,
DefaultExit,
@ -38,8 +41,6 @@ from evennia.server.sessionhandler import SESSIONS
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
# ------------------------------------------------------------
# Command testing
@ -1584,8 +1585,9 @@ class TestBuilding(BaseEvenniaCommandTest):
self.call(
building.CmdTeleport(),
"Obj = Room2",
"Obj(#{}) is leaving Room(#{}), heading for Room2(#{}).|Teleported Obj -> Room2."
.format(oid, rid, rid2),
"Obj(#{}) is leaving Room(#{}), heading for Room2(#{}).|Teleported Obj -> Room2.".format(
oid, rid, rid2
),
)
self.call(building.CmdTeleport(), "NotFound = Room", "Could not find 'NotFound'.")
self.call(
@ -1701,8 +1703,7 @@ class TestBuilding(BaseEvenniaCommandTest):
self.call(
building.CmdSpawn(),
"{'prototype_key':'GOBLIN', 'typeclass':'evennia.objects.objects.DefaultCharacter', "
"'key':'goblin', 'location':'%s'}"
% spawnLoc.dbref,
"'key':'goblin', 'location':'%s'}" % spawnLoc.dbref,
"Spawned goblin",
)
goblin = get_object(self, "goblin")
@ -1750,8 +1751,7 @@ class TestBuilding(BaseEvenniaCommandTest):
self.call(
building.CmdSpawn(),
"/noloc {'prototype_parent':'TESTBALL', 'key': 'Ball', 'prototype_key': 'foo',"
" 'location':'%s'}"
% spawnLoc.dbref,
" 'location':'%s'}" % spawnLoc.dbref,
"Spawned Ball",
)
ball = get_object(self, "Ball")

View File

@ -7,6 +7,7 @@ import re
from codecs import lookup as codecs_lookup
from django.conf import settings
from evennia.commands.cmdhandler import CMD_LOGINSTART
from evennia.comms.models import ChannelDB
from evennia.server.sessionhandler import SESSIONS

View File

@ -4,6 +4,7 @@ Unit testing for the Command system itself.
"""
from django.test import override_settings
from evennia.commands import cmdparser
from evennia.commands.cmdset import CmdSet
from evennia.commands.command import Command
@ -990,9 +991,10 @@ class TestOptionTransferReplace(TestCase):
import sys
from evennia.commands import cmdhandler
from twisted.trial.unittest import TestCase as TwistedTestCase
from evennia.commands import cmdhandler
def _mockdelay(time, func, *args, **kwargs):
return func(*args, **kwargs)

View File

@ -6,9 +6,9 @@ from django.contrib.contenttypes.models import ContentType
from django.urls import reverse
from django.utils.text import slugify
from evennia.typeclasses.models import TypeclassBase
from evennia.comms.models import ChannelDB
from evennia.comms.managers import ChannelManager
from evennia.comms.models import ChannelDB
from evennia.typeclasses.models import TypeclassBase
from evennia.utils import create, logger
from evennia.utils.utils import make_iter

View File

@ -7,10 +7,11 @@ Comm system components.
from django.conf import settings
from django.db.models import Q
from evennia.typeclasses.managers import TypedObjectManager, TypeclassManager
from evennia.server import signals
from evennia.typeclasses.managers import TypeclassManager, TypedObjectManager
from evennia.utils import logger
from evennia.utils.utils import dbref, make_iter, class_from_module
from evennia.utils.utils import class_from_module, dbref, make_iter
_GA = object.__getattribute__
_AccountDB = None

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.db import models, migrations
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.db import models, migrations
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from django.db import models, migrations
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.db import models, migrations
from django.db import migrations, models
def convert_defaults(apps, schema_editor):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.db import models, migrations
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -2,7 +2,7 @@
# Generated by Django 1.11.2 on 2017-07-05 17:26
from django.db import migrations, models, connection
from django.db import connection, migrations, models
def _table_exists(db_cursor, tablename):

View File

@ -2,7 +2,7 @@
# Generated by Django 1.11.2 on 2017-07-06 20:41
from django.db import migrations, connection
from django.db import connection, migrations
def _table_exists(db_cursor, tablename):

View File

@ -19,14 +19,15 @@ necessary to easily be able to delete connections on the fly).
"""
from django.conf import settings
from django.utils import timezone
from django.db import models
from django.utils import timezone
from evennia.comms import managers
from evennia.locks.lockhandler import LockHandler
from evennia.typeclasses.models import TypedObject
from evennia.typeclasses.tags import Tag, TagHandler
from evennia.utils.idmapper.models import SharedMemoryModel
from evennia.comms import managers
from evennia.locks.lockhandler import LockHandler
from evennia.utils.utils import crop, make_iter, lazy_property
from evennia.utils.utils import crop, lazy_property, make_iter
__all__ = ("Msg", "TempMsg", "ChannelDB", "SubscriptionHandler")

View File

@ -33,8 +33,8 @@ See the ./README.md file for details and install instructions.
from django.core.exceptions import (
ImproperlyConfigured,
SuspiciousOperation,
SuspiciousFileOperation,
SuspiciousOperation,
)
try:
@ -72,6 +72,7 @@ import posixpath
import threading
from gzip import GzipFile
from tempfile import SpooledTemporaryFile
from django.core.files.base import File
from django.core.files.storage import Storage
from django.utils.deconstruct import deconstructible

View File

@ -1,16 +1,19 @@
import datetime
import gzip
import pickle
import threading
from unittest import skipIf
from django.test import override_settings
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files.base import ContentFile
from django.test import TestCase
from django.test import TestCase, override_settings
from django.utils.timezone import is_aware, utc
import datetime, gzip, pickle, threading
_SKIP = False
try:
from botocore.exceptions import ClientError
from .awsstorage import aws_s3_cdn as s3boto3
except ImportError:
_SKIP = True

View File

@ -2,5 +2,5 @@
Build-menu contrib - vincent-lg 2018
"""
from .building_menu import GenericBuildingCmd # noqa
from .building_menu import BuildingMenu # noqa
from .building_menu import GenericBuildingCmd # noqa

View File

@ -126,14 +126,14 @@ from inspect import getargspec
from textwrap import dedent
from django.conf import settings
from evennia import Command, CmdSet
from evennia import CmdSet, Command
from evennia.commands import cmdhandler
from evennia.utils.ansi import strip_ansi
from evennia.utils.eveditor import EvEditor
from evennia.utils.logger import log_err, log_trace
from evennia.utils.utils import class_from_module
# Constants
_MAX_TEXT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
_CMD_NOMATCH = cmdhandler.CMD_NOMATCH

View File

@ -4,6 +4,7 @@ Building menu tests.
"""
from evennia.commands.default.tests import BaseEvenniaCommandTest
from .building_menu import BuildingMenu, CmdNoMatch

View File

@ -4,7 +4,9 @@ Test Color markup.
"""
import re
from evennia.utils.test_resources import BaseEvenniaTest
from . import color_markups

View File

@ -1,9 +1,9 @@
from evennia.contrib.base_systems.components import Component, DBField, TagField, signals
from evennia.contrib.base_systems.components.holder import ComponentProperty, ComponentHolderMixin
from evennia.contrib.base_systems.components.holder import ComponentHolderMixin, ComponentProperty
from evennia.contrib.base_systems.components.signals import as_listener
from evennia.objects.objects import DefaultCharacter
from evennia.utils import create
from evennia.utils.test_resources import EvenniaTest, BaseEvenniaTest
from evennia.utils.test_resources import BaseEvenniaTest, EvenniaTest
class ComponentTestA(Component):

View File

@ -3,10 +3,10 @@ Custom gametime contrib - Griatch, vlgeoff 2017
"""
from .custom_gametime import time_to_tuple, UNITS # noqa
from .custom_gametime import gametime_to_realtime # noqa
from .custom_gametime import realtime_to_gametime # noqa
from .custom_gametime import custom_gametime # noqa
from .custom_gametime import real_seconds_until # noqa
from .custom_gametime import schedule # noqa
from .custom_gametime import GametimeScript # noqa
from .custom_gametime import custom_gametime # noqa
from .custom_gametime import gametime_to_realtime # noqa
from .custom_gametime import real_seconds_until # noqa
from .custom_gametime import realtime_to_gametime # noqa
from .custom_gametime import schedule # noqa
from .custom_gametime import UNITS, time_to_tuple # noqa

View File

@ -35,9 +35,10 @@ the converter functions in this module.
# change these to fit your game world
from django.conf import settings
from evennia import DefaultScript
from evennia.utils.create import create_script
from evennia.utils import gametime
from evennia.utils.create import create_script
# The game time speedup / slowdown relative real time
TIMEFACTOR = settings.TIME_FACTOR

View File

@ -5,7 +5,9 @@ Testing custom game time
# Testing custom_gametime
from mock import Mock, patch
from evennia.utils.test_resources import BaseEvenniaTest
from .. import custom_gametime

View File

@ -3,5 +3,5 @@ Email login contrib - Griatch 2012
"""
from .email_login import UnloggedinCmdSet # noqa
from . import connection_screens # noqa
from .email_login import UnloggedinCmdSet # noqa

View File

@ -21,6 +21,7 @@ of the screen is done by the unlogged-in "look" command.
"""
from django.conf import settings
from evennia import utils
CONNECTION_SCREEN = """

View File

@ -33,6 +33,7 @@ the module given by settings.CONNECTION_SCREEN_MODULE.
"""
from django.conf import settings
from evennia.accounts.models import AccountDB
from evennia.commands.cmdhandler import CMD_LOGINSTART
from evennia.commands.cmdset import CmdSet

View File

@ -3,10 +3,4 @@ In-game Python - vlgeoff 2017
"""
from . import callbackhandler
from . import commands
from . import eventfuncs
from . import scripts
from . import tests
from . import typeclasses
from . import utils
from . import callbackhandler, commands, eventfuncs, scripts, tests, typeclasses, utils

View File

@ -5,11 +5,12 @@ Module containing the commands of the in-game Python system.
from datetime import datetime
from django.conf import settings
from evennia.contrib.base_systems.ingame_python.utils import get_event_handler
from evennia.utils.ansi import raw
from evennia.utils.eveditor import EvEditor
from evennia.utils.evtable import EvTable
from evennia.utils.utils import class_from_module, time_format
from evennia.contrib.base_systems.ingame_python.utils import get_event_handler
COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS)

View File

@ -2,21 +2,21 @@
Scripts for the in-game Python system.
"""
from datetime import datetime, timedelta
from queue import Queue
import re
import sys
import traceback
from datetime import datetime, timedelta
from queue import Queue
from django.conf import settings
from evennia import DefaultObject, DefaultScript, ChannelDB, ScriptDB
from evennia import logger
from evennia import ChannelDB, DefaultObject, DefaultScript, ScriptDB, logger
from evennia.contrib.base_systems.ingame_python.callbackhandler import CallbackHandler
from evennia.contrib.base_systems.ingame_python.utils import EVENTS, InterruptEvent, get_next_wait
from evennia.utils.ansi import raw
from evennia.utils.create import create_channel
from evennia.utils.dbserialize import dbserialize
from evennia.utils.utils import all_from_module, delay, pypath_to_realpath
from evennia.contrib.base_systems.ingame_python.callbackhandler import CallbackHandler
from evennia.contrib.base_systems.ingame_python.utils import get_next_wait, EVENTS, InterruptEvent
# Constants
RE_LINE_ERROR = re.compile(r'^ File "\<string\>", line (\d+)')

View File

@ -2,18 +2,20 @@
Module containing the test cases for the in-game Python system.
"""
from mock import Mock
from textwrap import dedent
from django.conf import settings
from mock import Mock
from evennia import ScriptDB
from evennia.commands.default.tests import BaseEvenniaCommandTest
from evennia.objects.objects import ExitCommand
from evennia.utils import ansi, utils
from evennia.utils.create import create_object, create_script
from evennia.utils.test_resources import BaseEvenniaTest
from .commands import CmdCallback
from .callbackhandler import CallbackHandler
from .commands import CmdCallback
# Force settings
settings.EVENTS_CALENDAR = "standard"

View File

@ -7,15 +7,14 @@ default ones in evennia core.
"""
from evennia import DefaultCharacter, DefaultExit, DefaultObject, DefaultRoom
from evennia import ScriptDB
from evennia.utils.utils import delay, inherits_from, lazy_property
from evennia import DefaultCharacter, DefaultExit, DefaultObject, DefaultRoom, ScriptDB
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,
phrase_event,
)
from evennia.utils.utils import delay, inherits_from, lazy_property
# Character help
CHARACTER_CAN_DELETE = """

View File

@ -6,14 +6,13 @@ These functions are to be used by developers to customize events and callbacks.
"""
from django.conf import settings
from evennia import logger
from evennia import ScriptDB
from evennia import ScriptDB, 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
from evennia.utils.create import create_script
from evennia.utils.gametime import real_seconds_until as standard_rsu
from evennia.utils.utils import class_from_module
from evennia.contrib.base_systems.custom_gametime import UNITS
from evennia.contrib.base_systems.custom_gametime import gametime_to_realtime
from evennia.contrib.base_systems.custom_gametime import real_seconds_until as custom_rsu
# Temporary storage for events waiting for the script to be started
EVENTS = []

View File

@ -3,5 +3,5 @@ Menu-login - Vinvent-lg 2016, Griatch 2019
"""
from .menu_login import UnloggedinCmdSet # noqa
from . import connection_screens # noqa
from .menu_login import UnloggedinCmdSet # noqa

View File

@ -21,6 +21,7 @@ of the screen is done by the unlogged-in "look" command.
"""
from django.conf import settings
from evennia import utils
CONNECTION_SCREEN = """

View File

@ -21,10 +21,9 @@ called automatically when a new user connects.
from django.conf import settings
from evennia import Command, CmdSet
from evennia import syscmdkeys
from evennia import CmdSet, Command, syscmdkeys
from evennia.utils.evmenu import EvMenu
from evennia.utils.utils import random_string_from_module, class_from_module, callables_from_module
from evennia.utils.utils import callables_from_module, class_from_module, random_string_from_module
_CONNECTION_SCREEN_MODULE = settings.CONNECTION_SCREEN_MODULE
_GUEST_ENABLED = settings.GUEST_ENABLED

View File

@ -4,6 +4,7 @@ Test menu_login
"""
from evennia.commands.default.tests import BaseEvenniaCommandTest
from . import menu_login

View File

@ -42,6 +42,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet):
"""
from django.conf import settings
from evennia.commands.cmdset import CmdSet
from evennia.commands.default.comms import CmdChannel
from evennia.utils import logger

View File

@ -4,6 +4,7 @@ Legacy Mux comms tests (extracted from 0.9.5)
"""
from evennia.commands.default.tests import BaseEvenniaCommandTest
from . import mux_comms_cmds as comms

View File

@ -4,6 +4,7 @@ Test of the Unixcommand.
"""
from evennia.commands.default.tests import BaseEvenniaCommandTest
from .unixcommand import UnixCommand

View File

@ -28,11 +28,12 @@ Admin/development commands
"""
import re
from django.conf import settings
from evennia import SESSION_HANDLER
from evennia import Command, CmdSet, InterruptCommand, default_cmds
from evennia import syscmdkeys
from evennia import SESSION_HANDLER, CmdSet, Command, InterruptCommand, default_cmds, syscmdkeys
from evennia.utils import variable_from_module
from .utils import create_evscaperoom_object
_AT_SEARCH_RESULT = variable_from_module(*settings.SEARCH_AT_RESULT.rsplit(".", 1))

View File

@ -8,9 +8,9 @@ new room (to start from scratch) or join an existing room (with other players).
"""
from evennia import EvMenu
from evennia.utils import create, justify, list_to_string, logger
from evennia.utils.evmenu import list_node
from evennia.utils import create, justify, list_to_string
from evennia.utils import logger
from .room import EvscapeRoom
from .utils import create_fantasy_word
@ -217,8 +217,8 @@ def node_quit(caller, raw_string, **kwargs):
# we check an Attribute on the caller to see if we should
# leave the game entirely when leaving
if caller.db.evscaperoom_standalone:
from evennia.commands import cmdhandler
from evennia import default_cmds
from evennia.commands import cmdhandler
cmdhandler.cmdhandler(
caller.ndb._menutree._session, "", cmdobj=default_cmds.CmdQuit(), cmdobj_key="@quit"

View File

@ -43,12 +43,13 @@ Available parents:
- Positionable (supports sit/lie/knee/climb at once)
"""
import re
import inspect
import re
from evennia import DefaultObject
from evennia.utils.utils import list_to_string, wrap
from .utils import create_evscaperoom_object
from .utils import parse_for_perspectives, parse_for_things
from .utils import create_evscaperoom_object, parse_for_perspectives, parse_for_things
class EvscaperoomObject(DefaultObject):

View File

@ -7,14 +7,13 @@ that particular escaperoom challenge should be gone.
"""
from evennia import DefaultRoom, DefaultCharacter, DefaultObject
from evennia import utils
from evennia.utils.ansi import strip_ansi
from evennia import logger
from evennia import DefaultCharacter, DefaultObject, DefaultRoom, logger, utils
from evennia.locks.lockhandler import check_lockstring
from evennia.utils.ansi import strip_ansi
from evennia.utils.utils import lazy_property, list_to_string
from .objects import EvscaperoomObject
from .commands import CmdSetEvScapeRoom
from .objects import EvscaperoomObject
from .state import StateHandler

View File

@ -12,14 +12,15 @@ state is identified by its module name.
"""
from django.conf import settings
from functools import wraps
from evennia import utils
from evennia import logger
from django.conf import settings
from evennia import logger, utils
from .objects import EvscaperoomObject
from .utils import create_evscaperoom_object, msg_cinematic, parse_for_things
# state setup
if hasattr(settings, "EVSCAPEROOM_STATE_PACKAGE"):
_ROOMSTATE_PACKAGE = settings.EVSCAPEROOM_STATE_PACKAGE

View File

@ -8,8 +8,8 @@ teleported back to the evscaperoom menu.
"""
from evennia.contrib.full_systems.evscaperoom.state import BaseState
from evennia.contrib.full_systems.evscaperoom import objects
from evennia.contrib.full_systems.evscaperoom.state import BaseState
GREETING = """
This is the situation, {name}:

View File

@ -5,13 +5,14 @@ Unit tests for the Evscaperoom
import inspect
import pkgutil
from os import path
from evennia.commands.default.tests import BaseEvenniaCommandTest
from evennia import InterruptCommand
from evennia.utils.test_resources import BaseEvenniaTest
from evennia.commands.default.tests import BaseEvenniaCommandTest
from evennia.utils import mod_import
from . import commands
from evennia.utils.test_resources import BaseEvenniaTest
from . import commands, objects
from . import state as basestate
from . import objects
from . import utils

View File

@ -8,8 +8,9 @@ and does not need to be imported from here.
import re
from random import choice
from evennia import create_object, search_object
from evennia.utils import justify, inherits_from
from evennia.utils import inherits_from, justify
_BASE_TYPECLASS_PATH = "evscaperoom.objects."
_RE_PERSPECTIVE = re.compile(r"~(\w+)", re.I + re.U + re.M)

View File

@ -94,8 +94,8 @@ in-game.
"""
from evennia.commands.command import Command
from evennia.commands.cmdset import CmdSet
from evennia.commands.command import Command
from evennia.scripts.scripts import DefaultScript
TRADE_TIMEOUT = 60 # timeout for B to accept trade

View File

@ -3,8 +3,10 @@ Test the contrib barter system
"""
from mock import Mock
from evennia.commands.default.tests import BaseEvenniaCommandTest
from evennia.utils.create import create_object
from . import barter

View File

@ -73,12 +73,9 @@ with which to test the system:
"""
from evennia import DefaultObject
from evennia import DefaultCharacter
from evennia import default_cmds
from evennia import DefaultCharacter, DefaultObject, default_cmds
from evennia.commands.default.muxcommand import MuxCommand
from evennia.utils import list_to_string
from evennia.utils import evtable
from evennia.utils import evtable, list_to_string
# Options start here.
# Maximum character length of 'wear style' strings, or None for unlimited.

View File

@ -4,9 +4,10 @@ Testing clothing contrib
"""
from evennia.commands.default.tests import BaseEvenniaCommandTest
from evennia.utils.create import create_object
from evennia.objects.objects import DefaultRoom
from evennia.utils.create import create_object
from evennia.utils.test_resources import BaseEvenniaTest
from . import clothing

View File

@ -4,7 +4,9 @@ Cooldowns tests.
"""
from mock import patch
from evennia.utils.test_resources import BaseEvenniaTest
from . import cooldowns

View File

@ -3,7 +3,7 @@ Crafting - Griatch 2020
"""
from .crafting import craft # noqa
from .crafting import CraftingRecipe # noqa
from .crafting import CraftingRecipeBase # noqa
from .crafting import craft # noqa
from .crafting import CraftingError, CraftingValidationError # noqa

View File

@ -121,11 +121,12 @@ a full example of the components for creating a sword from base components.
import functools
from copy import copy
from evennia.utils.utils import iter_to_str, callables_from_module, inherits_from, make_iter
from evennia.commands.cmdset import CmdSet
from evennia.commands.command import Command
from evennia.prototypes.spawner import spawn
from evennia.utils.create import create_object
from evennia.utils.utils import callables_from_module, inherits_from, iter_to_str, make_iter
_RECIPE_CLASSES = {}

View File

@ -69,10 +69,11 @@ just mocked for the example.
"""
from random import random, randint
from evennia.commands.command import Command, InterruptCommand
from .crafting import craft, CraftingRecipe, CraftingValidationError
from random import randint, random
from evennia.commands.command import Command, InterruptCommand
from .crafting import CraftingRecipe, CraftingValidationError, craft
# ------------------------------------------------------------
# Sword recipe

View File

@ -4,11 +4,14 @@ Unit tests for the crafting system contrib.
"""
from unittest import mock
from django.test import override_settings
from django.core.exceptions import ObjectDoesNotExist
from django.test import override_settings
from evennia.commands.default.tests import BaseEvenniaCommandTest
from evennia.utils.test_resources import BaseEvenniaTestCase
from evennia.utils.create import create_object
from evennia.utils.test_resources import BaseEvenniaTestCase
from . import crafting, example_recipes

View File

@ -42,9 +42,9 @@ default cmdset before it becomes available.
"""
import re
from evennia import Command, DefaultCharacter
from evennia.utils import logger
from evennia import DefaultCharacter
from evennia import Command
# gender maps

View File

@ -4,9 +4,11 @@ Test gendersub contrib.
"""
from mock import patch
from evennia.commands.default.tests import BaseEvenniaCommandTest
from evennia.utils.create import create_object
from mock import patch
from . import gendersub

View File

@ -42,11 +42,10 @@ ic/ooc to switch in and out of IC/OOC modes.
"""
import re
from evennia import ObjectDB, AccountDB
from evennia import default_cmds
from evennia.utils import create, evtable, make_iter, inherits_from, datetime_format
from evennia.comms.models import Msg
from evennia import AccountDB, ObjectDB, default_cmds
from evennia.comms.models import Msg
from evennia.utils import create, datetime_format, evtable, inherits_from, make_iter
_HEAD_CHAR = "|015-|n"
_SUB_HEAD_CHAR = "-"

View File

@ -4,6 +4,7 @@ Test mail contrib
"""
from evennia.commands.default.tests import BaseEvenniaCommandTest
from . import mail

View File

@ -26,10 +26,10 @@ will replace the default `desc` command).
"""
import re
from evennia import default_cmds
from evennia.utils.utils import crop
from evennia.utils.eveditor import EvEditor
from evennia import default_cmds
from evennia.utils.eveditor import EvEditor
from evennia.utils.utils import crop
# regex for the set functionality
_RE_KEYS = re.compile(r"([\w\s]+)(?:\+*?)", re.U + re.I)

View File

@ -4,6 +4,7 @@ Test multidescer contrib.
"""
from evennia.commands.default.tests import BaseEvenniaCommandTest
from . import multidescer

Some files were not shown because too many files have changed in this diff Show More