Run black on sources
This commit is contained in:
parent
9ca41b5d0d
commit
9c3ba936e4
27 changed files with 153 additions and 90 deletions
|
|
@ -48,6 +48,10 @@
|
||||||
template properly (InspectorCaracal)
|
template properly (InspectorCaracal)
|
||||||
- [Fix][pull3545]: Fix fallback issue in cmdhandler for local-object cmdsets (InspectorCaracal)
|
- [Fix][pull3545]: Fix fallback issue in cmdhandler for local-object cmdsets (InspectorCaracal)
|
||||||
- [Fix][pull3554]: Fix/readd custom `ic` command to the `character_creator` contrib (InspectorCaracal)
|
- [Fix][pull3554]: Fix/readd custom `ic` command to the `character_creator` contrib (InspectorCaracal)
|
||||||
|
- [Fix][pull3466]: Make sure the `website/base.html` website base is targeted
|
||||||
|
explicitly so it doesn't get overridden by same file name elsewhere in app (InspectorCaracal)
|
||||||
|
- [fix][issue3387]: Update all game template doc strings to be more up-to-date
|
||||||
|
(Griatch)
|
||||||
- [Docs]: Doc fixes (Griatch, chiizujin, InspectorCaracal, iLPDev)
|
- [Docs]: Doc fixes (Griatch, chiizujin, InspectorCaracal, iLPDev)
|
||||||
|
|
||||||
[pull3470]: https://github.com/evennia/evennia/pull/3470
|
[pull3470]: https://github.com/evennia/evennia/pull/3470
|
||||||
|
|
@ -79,7 +83,9 @@
|
||||||
[pull3549]: https://github.com/evennia/evennia/pull/3549
|
[pull3549]: https://github.com/evennia/evennia/pull/3549
|
||||||
[pull3554]: https://github.com/evennia/evennia/pull/3554
|
[pull3554]: https://github.com/evennia/evennia/pull/3554
|
||||||
[pull3523]: https://github.com/evennia/evennia/pull/3523
|
[pull3523]: https://github.com/evennia/evennia/pull/3523
|
||||||
|
[pull3566]: https://github.com/evennia/evennia/pull/3566
|
||||||
[issue3522]: https://github.com/evennia/evennia/issue/3522
|
[issue3522]: https://github.com/evennia/evennia/issue/3522
|
||||||
|
[issue3387]: https://github.com/evennia/evennia/issue/3387
|
||||||
|
|
||||||
|
|
||||||
## Evennia 4.1.1
|
## Evennia 4.1.1
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,14 @@ import time
|
||||||
import typing
|
import typing
|
||||||
from random import getrandbits
|
from random import getrandbits
|
||||||
|
|
||||||
import evennia
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth import authenticate, password_validation
|
from django.contrib.auth import authenticate, password_validation
|
||||||
from django.core.exceptions import ImproperlyConfigured, ValidationError
|
from django.core.exceptions import ImproperlyConfigured, ValidationError
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
import evennia
|
||||||
from evennia.accounts.manager import AccountManager
|
from evennia.accounts.manager import AccountManager
|
||||||
from evennia.accounts.models import AccountDB
|
from evennia.accounts.models import AccountDB
|
||||||
from evennia.commands.cmdsethandler import CmdSetHandler
|
from evennia.commands.cmdsethandler import CmdSetHandler
|
||||||
|
|
@ -30,17 +31,24 @@ from evennia.comms.models import ChannelDB
|
||||||
from evennia.objects.models import ObjectDB
|
from evennia.objects.models import ObjectDB
|
||||||
from evennia.scripts.scripthandler import ScriptHandler
|
from evennia.scripts.scripthandler import ScriptHandler
|
||||||
from evennia.server.models import ServerConfig
|
from evennia.server.models import ServerConfig
|
||||||
from evennia.server.signals import (SIGNAL_ACCOUNT_POST_CREATE,
|
from evennia.server.signals import (
|
||||||
|
SIGNAL_ACCOUNT_POST_CREATE,
|
||||||
SIGNAL_ACCOUNT_POST_LOGIN_FAIL,
|
SIGNAL_ACCOUNT_POST_LOGIN_FAIL,
|
||||||
SIGNAL_OBJECT_POST_PUPPET,
|
SIGNAL_OBJECT_POST_PUPPET,
|
||||||
SIGNAL_OBJECT_POST_UNPUPPET)
|
SIGNAL_OBJECT_POST_UNPUPPET,
|
||||||
|
)
|
||||||
from evennia.server.throttle import Throttle
|
from evennia.server.throttle import Throttle
|
||||||
from evennia.typeclasses.attributes import ModelAttributeBackend, NickHandler
|
from evennia.typeclasses.attributes import ModelAttributeBackend, NickHandler
|
||||||
from evennia.typeclasses.models import TypeclassBase
|
from evennia.typeclasses.models import TypeclassBase
|
||||||
from evennia.utils import class_from_module, create, logger
|
from evennia.utils import class_from_module, create, logger
|
||||||
from evennia.utils.optionhandler import OptionHandler
|
from evennia.utils.optionhandler import OptionHandler
|
||||||
from evennia.utils.utils import (is_iter, lazy_property, make_iter, to_str,
|
from evennia.utils.utils import (
|
||||||
variable_from_module)
|
is_iter,
|
||||||
|
lazy_property,
|
||||||
|
make_iter,
|
||||||
|
to_str,
|
||||||
|
variable_from_module,
|
||||||
|
)
|
||||||
|
|
||||||
__all__ = ("DefaultAccount", "DefaultGuest")
|
__all__ = ("DefaultAccount", "DefaultGuest")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,10 @@
|
||||||
|
|
||||||
|
|
||||||
import django.core.validators
|
import django.core.validators
|
||||||
import evennia.accounts.manager
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
import evennia.accounts.manager
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,18 @@
|
||||||
from random import randint
|
from random import randint
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
import evennia
|
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
from evennia.accounts.accounts import (AccountSessionHandler, DefaultAccount,
|
from mock import MagicMock, Mock, patch
|
||||||
DefaultGuest)
|
|
||||||
|
import evennia
|
||||||
|
from evennia.accounts.accounts import (
|
||||||
|
AccountSessionHandler,
|
||||||
|
DefaultAccount,
|
||||||
|
DefaultGuest,
|
||||||
|
)
|
||||||
from evennia.utils import create
|
from evennia.utils import create
|
||||||
from evennia.utils.test_resources import BaseEvenniaTest
|
from evennia.utils.test_resources import BaseEvenniaTest
|
||||||
from evennia.utils.utils import uses_database
|
from evennia.utils.utils import uses_database
|
||||||
from mock import MagicMock, Mock, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestAccountSessionHandler(TestCase):
|
class TestAccountSessionHandler(TestCase):
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ Communication commands:
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from evennia.accounts import bots
|
from evennia.accounts import bots
|
||||||
from evennia.accounts.models import AccountDB
|
from evennia.accounts.models import AccountDB
|
||||||
from evennia.comms.comms import DefaultChannel
|
from evennia.comms.comms import DefaultChannel
|
||||||
|
|
@ -1412,9 +1413,7 @@ class CmdPage(COMMAND_DEFAULT_CLASS):
|
||||||
message = f"{caller.key} {message.strip(':').strip()}"
|
message = f"{caller.key} {message.strip(':').strip()}"
|
||||||
|
|
||||||
# create the persistent message object
|
# create the persistent message object
|
||||||
target_perms = " or ".join(
|
target_perms = " or ".join([f"id({target.id})" for target in targets + [caller]])
|
||||||
[f"id({target.id})" for target in targets + [caller]]
|
|
||||||
)
|
|
||||||
create.create_message(
|
create.create_message(
|
||||||
caller,
|
caller,
|
||||||
message,
|
message,
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,11 @@ Base typeclass for in-game Channels.
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import evennia
|
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
|
|
||||||
|
import evennia
|
||||||
from evennia.comms.managers import ChannelManager
|
from evennia.comms.managers import ChannelManager
|
||||||
from evennia.comms.models import ChannelDB
|
from evennia.comms.models import ChannelDB
|
||||||
from evennia.typeclasses.models import TypeclassBase
|
from evennia.typeclasses.models import TypeclassBase
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ necessary to easily be able to delete connections on the fly).
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from evennia.comms import managers
|
from evennia.comms import managers
|
||||||
from evennia.locks.lockhandler import LockHandler
|
from evennia.locks.lockhandler import LockHandler
|
||||||
from evennia.typeclasses.models import TypedObject
|
from evennia.typeclasses.models import TypedObject
|
||||||
|
|
|
||||||
|
|
@ -15,16 +15,17 @@ class BaseComponent(type):
|
||||||
This is the metaclass for components,
|
This is the metaclass for components,
|
||||||
responsible for registering components to the listing.
|
responsible for registering components to the listing.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __new__(cls, name, parents, attrs):
|
def __new__(cls, name, parents, attrs):
|
||||||
"""
|
"""
|
||||||
Every class that uses this metaclass will be registered
|
Every class that uses this metaclass will be registered
|
||||||
as a component in the Component Listing using its name.
|
as a component in the Component Listing using its name.
|
||||||
All of them require a unique name.
|
All of them require a unique name.
|
||||||
"""
|
"""
|
||||||
attrs_name = attrs.get('name')
|
attrs_name = attrs.get("name")
|
||||||
if attrs_name and not COMPONENT_LISTING.get(attrs_name):
|
if attrs_name and not COMPONENT_LISTING.get(attrs_name):
|
||||||
new_fields = {}
|
new_fields = {}
|
||||||
attrs['_fields'] = new_fields
|
attrs["_fields"] = new_fields
|
||||||
for parent in parents:
|
for parent in parents:
|
||||||
_parent_fields = getattr(parent, "_fields")
|
_parent_fields = getattr(parent, "_fields")
|
||||||
if _parent_fields:
|
if _parent_fields:
|
||||||
|
|
|
||||||
|
|
@ -87,23 +87,23 @@ class TestComponents(EvenniaTest):
|
||||||
|
|
||||||
def test_character_components_set_fields_properly(self):
|
def test_character_components_set_fields_properly(self):
|
||||||
test_a_fields = self.char1.test_a._fields
|
test_a_fields = self.char1.test_a._fields
|
||||||
self.assertIn('my_int', test_a_fields)
|
self.assertIn("my_int", test_a_fields)
|
||||||
self.assertIn('my_list', test_a_fields)
|
self.assertIn("my_list", test_a_fields)
|
||||||
self.assertEqual(len(test_a_fields), 2)
|
self.assertEqual(len(test_a_fields), 2)
|
||||||
|
|
||||||
test_b_fields = self.char1.test_b._fields
|
test_b_fields = self.char1.test_b._fields
|
||||||
self.assertIn('my_int', test_b_fields)
|
self.assertIn("my_int", test_b_fields)
|
||||||
self.assertIn('my_list', test_b_fields)
|
self.assertIn("my_list", test_b_fields)
|
||||||
self.assertIn('default_tag', test_b_fields)
|
self.assertIn("default_tag", test_b_fields)
|
||||||
self.assertIn('single_tag', test_b_fields)
|
self.assertIn("single_tag", test_b_fields)
|
||||||
self.assertIn('multiple_tags', test_b_fields)
|
self.assertIn("multiple_tags", test_b_fields)
|
||||||
self.assertIn('default_single_tag', test_b_fields)
|
self.assertIn("default_single_tag", test_b_fields)
|
||||||
self.assertEqual(len(test_b_fields), 6)
|
self.assertEqual(len(test_b_fields), 6)
|
||||||
|
|
||||||
test_ic_a_fields = self.char1.ic_a._fields
|
test_ic_a_fields = self.char1.ic_a._fields
|
||||||
self.assertIn('my_int', test_ic_a_fields)
|
self.assertIn("my_int", test_ic_a_fields)
|
||||||
self.assertIn('my_list', test_ic_a_fields)
|
self.assertIn("my_list", test_ic_a_fields)
|
||||||
self.assertIn('my_other_int', test_ic_a_fields)
|
self.assertIn("my_other_int", test_ic_a_fields)
|
||||||
self.assertEqual(len(test_ic_a_fields), 3)
|
self.assertEqual(len(test_ic_a_fields), 3)
|
||||||
|
|
||||||
def test_inherited_typeclass_does_not_include_child_class_components(self):
|
def test_inherited_typeclass_does_not_include_child_class_components(self):
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
from .achievements import (
|
from .achievements import (
|
||||||
get_achievement,
|
|
||||||
search_achievement,
|
|
||||||
all_achievements,
|
|
||||||
track_achievements,
|
|
||||||
get_achievement_progress,
|
|
||||||
CmdAchieve,
|
CmdAchieve,
|
||||||
|
all_achievements,
|
||||||
|
get_achievement,
|
||||||
|
get_achievement_progress,
|
||||||
|
search_achievement,
|
||||||
|
track_achievements,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -50,11 +50,18 @@ Example:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia.utils import logger
|
|
||||||
from evennia.utils.utils import all_from_module, is_iter, make_iter, string_partial_matching
|
|
||||||
from evennia.utils.evmore import EvMore
|
|
||||||
from evennia.commands.default.muxcommand import MuxCommand
|
from evennia.commands.default.muxcommand import MuxCommand
|
||||||
|
from evennia.utils import logger
|
||||||
|
from evennia.utils.evmore import EvMore
|
||||||
|
from evennia.utils.utils import (
|
||||||
|
all_from_module,
|
||||||
|
is_iter,
|
||||||
|
make_iter,
|
||||||
|
string_partial_matching,
|
||||||
|
)
|
||||||
|
|
||||||
# this is either a string of the attribute name, or a tuple of strings of the attribute name and category
|
# this is either a string of the attribute name, or a tuple of strings of the attribute name and category
|
||||||
_ACHIEVEMENT_ATTR = make_iter(getattr(settings, "ACHIEVEMENT_CONTRIB_ATTRIBUTE", "achievements"))
|
_ACHIEVEMENT_ATTR = make_iter(getattr(settings, "ACHIEVEMENT_CONTRIB_ATTRIBUTE", "achievements"))
|
||||||
|
|
@ -327,7 +334,7 @@ class CmdAchieve(MuxCommand):
|
||||||
if is_iter(achievement_data["progress"]):
|
if is_iter(achievement_data["progress"]):
|
||||||
# we'll display progress as how many items have been completed
|
# we'll display progress as how many items have been completed
|
||||||
completed = Counter(val >= count for val in achievement_data["progress"])[True]
|
completed = Counter(val >= count for val in achievement_data["progress"])[True]
|
||||||
pct = (completed * 100) // len(achievement_data['progress'])
|
pct = (completed * 100) // len(achievement_data["progress"])
|
||||||
else:
|
else:
|
||||||
# we display progress as the percent of the total count
|
# we display progress as the percent of the total count
|
||||||
pct = (achievement_data["progress"] * 100) // count
|
pct = (achievement_data["progress"] * 100) // count
|
||||||
|
|
@ -379,8 +386,7 @@ class CmdAchieve(MuxCommand):
|
||||||
elif "all" in self.switches:
|
elif "all" in self.switches:
|
||||||
# we merge our progress data into the full dict of achievements
|
# we merge our progress data into the full dict of achievements
|
||||||
achievement_data = {
|
achievement_data = {
|
||||||
key: data | progress_data.get(key, {})
|
key: data | progress_data.get(key, {}) for key, data in achievements.items()
|
||||||
for key, data in achievements.items()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# we show all of the currently available achievements regardless of progress status
|
# we show all of the currently available achievements regardless of progress status
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
from evennia.utils.test_resources import BaseEvenniaTest, BaseEvenniaCommandTest
|
|
||||||
from mock import patch
|
from mock import patch
|
||||||
|
|
||||||
|
from evennia.utils.test_resources import BaseEvenniaCommandTest, BaseEvenniaTest
|
||||||
|
|
||||||
from . import achievements
|
from . import achievements
|
||||||
|
|
||||||
_dummy_achievements = {
|
_dummy_achievements = {
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,17 @@ from collections import deque
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from evennia import (CmdSet, DefaultRoom, EvEditor, FuncParser,
|
|
||||||
InterruptCommand, default_cmds, gametime, utils)
|
from evennia import (
|
||||||
|
CmdSet,
|
||||||
|
DefaultRoom,
|
||||||
|
EvEditor,
|
||||||
|
FuncParser,
|
||||||
|
InterruptCommand,
|
||||||
|
default_cmds,
|
||||||
|
gametime,
|
||||||
|
utils,
|
||||||
|
)
|
||||||
from evennia.typeclasses.attributes import AttributeProperty
|
from evennia.typeclasses.attributes import AttributeProperty
|
||||||
from evennia.utils.utils import list_to_string, repeat
|
from evennia.utils.utils import list_to_string, repeat
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@ from random import choices
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from evennia import DefaultAccount
|
from evennia import DefaultAccount
|
||||||
from evennia.commands.default.muxcommand import MuxAccountCommand
|
|
||||||
from evennia.commands.default.account import CmdIC
|
|
||||||
from evennia.commands.cmdset import CmdSet
|
from evennia.commands.cmdset import CmdSet
|
||||||
|
from evennia.commands.default.account import CmdIC
|
||||||
|
from evennia.commands.default.muxcommand import MuxAccountCommand
|
||||||
from evennia.objects.models import ObjectDB
|
from evennia.objects.models import ObjectDB
|
||||||
from evennia.utils.evmenu import EvMenu
|
from evennia.utils.evmenu import EvMenu
|
||||||
from evennia.utils.utils import is_iter, string_partial_matching
|
from evennia.utils.utils import is_iter, string_partial_matching
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
|
|
||||||
from evennia.help.manager import HelpEntryManager
|
from evennia.help.manager import HelpEntryManager
|
||||||
from evennia.locks.lockhandler import LockHandler
|
from evennia.locks.lockhandler import LockHandler
|
||||||
from evennia.typeclasses.models import AliasHandler, Tag, TagHandler
|
from evennia.typeclasses.models import AliasHandler, Tag, TagHandler
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,11 @@ import time
|
||||||
import typing
|
import typing
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
import evennia
|
|
||||||
import inflect
|
import inflect
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
import evennia
|
||||||
from evennia.commands import cmdset
|
from evennia.commands import cmdset
|
||||||
from evennia.commands.cmdsethandler import CmdSetHandler
|
from evennia.commands.cmdsethandler import CmdSetHandler
|
||||||
from evennia.objects.manager import ObjectManager
|
from evennia.objects.manager import ObjectManager
|
||||||
|
|
@ -23,9 +24,17 @@ from evennia.server.signals import SIGNAL_EXIT_TRAVERSED
|
||||||
from evennia.typeclasses.attributes import ModelAttributeBackend, NickHandler
|
from evennia.typeclasses.attributes import ModelAttributeBackend, NickHandler
|
||||||
from evennia.typeclasses.models import TypeclassBase
|
from evennia.typeclasses.models import TypeclassBase
|
||||||
from evennia.utils import ansi, create, funcparser, logger, search
|
from evennia.utils import ansi, create, funcparser, logger, search
|
||||||
from evennia.utils.utils import (class_from_module, compress_whitespace, dbref,
|
from evennia.utils.utils import (
|
||||||
is_iter, iter_to_str, lazy_property,
|
class_from_module,
|
||||||
make_iter, to_str, variable_from_module)
|
compress_whitespace,
|
||||||
|
dbref,
|
||||||
|
is_iter,
|
||||||
|
iter_to_str,
|
||||||
|
lazy_property,
|
||||||
|
make_iter,
|
||||||
|
to_str,
|
||||||
|
variable_from_module,
|
||||||
|
)
|
||||||
|
|
||||||
_INFLECT = inflect.engine()
|
_INFLECT = inflect.engine()
|
||||||
_MULTISESSION_MODE = settings.MULTISESSION_MODE
|
_MULTISESSION_MODE = settings.MULTISESSION_MODE
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,13 @@ ability to run timers.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
from twisted.internet.defer import Deferred, maybeDeferred
|
||||||
|
from twisted.internet.task import LoopingCall
|
||||||
|
|
||||||
from evennia.scripts.manager import ScriptManager
|
from evennia.scripts.manager import ScriptManager
|
||||||
from evennia.scripts.models import ScriptDB
|
from evennia.scripts.models import ScriptDB
|
||||||
from evennia.typeclasses.models import TypeclassBase
|
from evennia.typeclasses.models import TypeclassBase
|
||||||
from evennia.utils import create, logger
|
from evennia.utils import create, logger
|
||||||
from twisted.internet.defer import Deferred, maybeDeferred
|
|
||||||
from twisted.internet.task import LoopingCall
|
|
||||||
|
|
||||||
__all__ = ["DefaultScript", "DoNothing", "Store"]
|
__all__ = ["DefaultScript", "DoNothing", "Store"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -474,7 +474,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, _BASE_SESSION_CLASS):
|
||||||
_RE_N.sub("", prompt) + ("||n" if prompt.endswith("|") else "|n"),
|
_RE_N.sub("", prompt) + ("||n" if prompt.endswith("|") else "|n"),
|
||||||
strip_ansi=nocolor,
|
strip_ansi=nocolor,
|
||||||
xterm256=xterm256,
|
xterm256=xterm256,
|
||||||
truecolor=truecolor
|
truecolor=truecolor,
|
||||||
)
|
)
|
||||||
if mxp:
|
if mxp:
|
||||||
prompt = mxp_parse(prompt)
|
prompt = mxp_parse(prompt)
|
||||||
|
|
@ -511,7 +511,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, _BASE_SESSION_CLASS):
|
||||||
strip_ansi=nocolor,
|
strip_ansi=nocolor,
|
||||||
xterm256=xterm256,
|
xterm256=xterm256,
|
||||||
mxp=mxp,
|
mxp=mxp,
|
||||||
truecolor=truecolor
|
truecolor=truecolor,
|
||||||
)
|
)
|
||||||
if mxp:
|
if mxp:
|
||||||
linetosend = mxp_parse(linetosend)
|
linetosend = mxp_parse(linetosend)
|
||||||
|
|
|
||||||
|
|
@ -149,11 +149,7 @@ class Ttype:
|
||||||
|
|
||||||
# use name to identify support for xterm truecolor
|
# use name to identify support for xterm truecolor
|
||||||
truecolor = False
|
truecolor = False
|
||||||
if (clientname.endswith("-TRUECOLOR") or
|
if clientname.endswith("-TRUECOLOR") or clientname in ("AXMUD", "TINTIN"):
|
||||||
clientname in (
|
|
||||||
"AXMUD",
|
|
||||||
"TINTIN"
|
|
||||||
)):
|
|
||||||
truecolor = True
|
truecolor = True
|
||||||
|
|
||||||
# all clients supporting TTYPE at all seem to support ANSI
|
# all clients supporting TTYPE at all seem to support ANSI
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ these to create custom managers.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import evennia
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
|
@ -37,21 +36,30 @@ from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.encoding import smart_str
|
from django.utils.encoding import smart_str
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
|
|
||||||
|
import evennia
|
||||||
from evennia.locks.lockhandler import LockHandler
|
from evennia.locks.lockhandler import LockHandler
|
||||||
from evennia.server.signals import SIGNAL_TYPED_OBJECT_POST_RENAME
|
from evennia.server.signals import SIGNAL_TYPED_OBJECT_POST_RENAME
|
||||||
from evennia.typeclasses import managers
|
from evennia.typeclasses import managers
|
||||||
from evennia.typeclasses.attributes import (Attribute, AttributeHandler,
|
from evennia.typeclasses.attributes import (
|
||||||
AttributeProperty, DbHolder,
|
Attribute,
|
||||||
|
AttributeHandler,
|
||||||
|
AttributeProperty,
|
||||||
|
DbHolder,
|
||||||
InMemoryAttributeBackend,
|
InMemoryAttributeBackend,
|
||||||
ModelAttributeBackend)
|
ModelAttributeBackend,
|
||||||
from evennia.typeclasses.tags import (AliasHandler, PermissionHandler, Tag,
|
)
|
||||||
TagCategoryProperty, TagHandler,
|
from evennia.typeclasses.tags import (
|
||||||
TagProperty)
|
AliasHandler,
|
||||||
from evennia.utils.idmapper.models import (SharedMemoryModel,
|
PermissionHandler,
|
||||||
SharedMemoryModelBase)
|
Tag,
|
||||||
|
TagCategoryProperty,
|
||||||
|
TagHandler,
|
||||||
|
TagProperty,
|
||||||
|
)
|
||||||
|
from evennia.utils.idmapper.models import SharedMemoryModel, SharedMemoryModelBase
|
||||||
from evennia.utils.logger import log_trace
|
from evennia.utils.logger import log_trace
|
||||||
from evennia.utils.utils import (class_from_module, inherits_from, is_iter,
|
from evennia.utils.utils import class_from_module, inherits_from, is_iter, lazy_property
|
||||||
lazy_property)
|
|
||||||
|
|
||||||
__all__ = ("TypedObject",)
|
__all__ = ("TypedObject",)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,8 @@ from collections import OrderedDict
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from evennia.utils import logger, utils
|
from evennia.utils import logger, utils
|
||||||
from evennia.utils.utils import to_str
|
|
||||||
from evennia.utils.hex_colors import HexColors
|
from evennia.utils.hex_colors import HexColors
|
||||||
|
from evennia.utils.utils import to_str
|
||||||
|
|
||||||
hex2truecolor = HexColors()
|
hex2truecolor = HexColors()
|
||||||
hex_sub = HexColors.hex_sub
|
hex_sub = HexColors.hex_sub
|
||||||
|
|
|
||||||
|
|
@ -722,7 +722,7 @@ class CmdEditorGroup(CmdEditorBase):
|
||||||
}
|
}
|
||||||
align_name = {"f": "Full", "c": "Center", "l": "Left", "r": "Right"}
|
align_name = {"f": "Full", "c": "Center", "l": "Left", "r": "Right"}
|
||||||
# shift width arg right if no alignment specified
|
# shift width arg right if no alignment specified
|
||||||
if self.arg1.startswith('='):
|
if self.arg1.startswith("="):
|
||||||
self.arg2 = self.arg1
|
self.arg2 = self.arg1
|
||||||
self.arg1 = None
|
self.arg1 = None
|
||||||
if self.arg1 and self.arg1.lower() not in align_map:
|
if self.arg1 and self.arg1.lower() not in align_map:
|
||||||
|
|
|
||||||
|
|
@ -272,17 +272,28 @@ from fnmatch import fnmatch
|
||||||
from inspect import getfullargspec, isfunction
|
from inspect import getfullargspec, isfunction
|
||||||
from math import ceil
|
from math import ceil
|
||||||
|
|
||||||
import evennia
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
# i18n
|
# i18n
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
import evennia
|
||||||
from evennia import CmdSet, Command
|
from evennia import CmdSet, Command
|
||||||
from evennia.commands import cmdhandler
|
from evennia.commands import cmdhandler
|
||||||
from evennia.utils import logger
|
from evennia.utils import logger
|
||||||
from evennia.utils.ansi import strip_ansi
|
from evennia.utils.ansi import strip_ansi
|
||||||
from evennia.utils.evtable import EvColumn, EvTable
|
from evennia.utils.evtable import EvColumn, EvTable
|
||||||
from evennia.utils.utils import (crop, dedent, inherits_from, is_iter, m_len,
|
from evennia.utils.utils import (
|
||||||
make_iter, mod_import, pad, to_str)
|
crop,
|
||||||
|
dedent,
|
||||||
|
inherits_from,
|
||||||
|
is_iter,
|
||||||
|
m_len,
|
||||||
|
make_iter,
|
||||||
|
mod_import,
|
||||||
|
pad,
|
||||||
|
to_str,
|
||||||
|
)
|
||||||
|
|
||||||
# read from protocol NAWS later?
|
# read from protocol NAWS later?
|
||||||
_MAX_TEXT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
|
_MAX_TEXT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,11 @@ from ast import literal_eval
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
from evennia.utils import funcparser, test_resources
|
|
||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
from simpleeval import simple_eval
|
from simpleeval import simple_eval
|
||||||
|
|
||||||
|
from evennia.utils import funcparser, test_resources
|
||||||
|
|
||||||
|
|
||||||
def _test_callable(*args, **kwargs):
|
def _test_callable(*args, **kwargs):
|
||||||
kwargs.pop("funcparser", None)
|
kwargs.pop("funcparser", None)
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,7 @@ class TestText2Html(TestCase):
|
||||||
# True Color
|
# True Color
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
'<span class="" style="color: #ff0000;">red</span>foo',
|
'<span class="" style="color: #ff0000;">red</span>foo',
|
||||||
parser.format_styles(
|
parser.format_styles(f"\x1b[38;2;255;0;0m" + "red" + ansi.ANSI_NORMAL + "foo"),
|
||||||
f'\x1b[38;2;255;0;0m' + "red" + ansi.ANSI_NORMAL + "foo"
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_remove_bells(self):
|
def test_remove_bells(self):
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from evennia.utils.ansi import ANSIString as AN, ANSIParser
|
from evennia.utils.ansi import ANSIParser
|
||||||
|
from evennia.utils.ansi import ANSIString as AN
|
||||||
|
|
||||||
parser = ANSIParser().parse_ansi
|
parser = ANSIParser().parse_ansi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import re
|
||||||
from html import escape as html_escape
|
from html import escape as html_escape
|
||||||
|
|
||||||
from .ansi import *
|
from .ansi import *
|
||||||
|
|
||||||
from .hex_colors import HexColors
|
from .hex_colors import HexColors
|
||||||
|
|
||||||
# All xterm256 RGB equivalents
|
# All xterm256 RGB equivalents
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue