Ran black on sources
This commit is contained in:
parent
24d52f229f
commit
f6b43b0416
125 changed files with 355 additions and 329 deletions
|
|
@ -462,7 +462,6 @@ def _search_object(caller):
|
|||
is_account = searchstring.startswith("*")
|
||||
|
||||
if is_dbref or is_account:
|
||||
|
||||
if is_dbref:
|
||||
# a dbref search
|
||||
results = caller.search(searchstring, global_search=True, quiet=True)
|
||||
|
|
@ -508,14 +507,12 @@ def _object_search_actions(caller, raw_inp, **kwargs):
|
|||
raw_inp = raw_inp.strip()
|
||||
|
||||
if obj_entry:
|
||||
|
||||
num = choices.index(obj_entry)
|
||||
matches = caller.ndb._menutree.olc_search_object_matches
|
||||
obj = matches[num]
|
||||
prot = spawner.prototype_from_object(obj)
|
||||
|
||||
if action == "examine":
|
||||
|
||||
if not obj.access(caller, "examine"):
|
||||
caller.msg("\n|rYou don't have 'examine' access on this object.|n")
|
||||
del caller.ndb._menutree.olc_search_object_term
|
||||
|
|
@ -738,7 +735,6 @@ def _check_prototype_key(caller, key):
|
|||
|
||||
|
||||
def node_prototype_key(caller):
|
||||
|
||||
text = """
|
||||
The |cPrototype-Key|n uniquely identifies the prototype and is |wmandatory|n. It is used to
|
||||
find and use the prototype to spawn new entities. It is not case sensitive.
|
||||
|
|
@ -840,7 +836,6 @@ def _prototype_parent_actions(caller, raw_inp, **kwargs):
|
|||
|
||||
|
||||
def _prototype_parent_select(caller, new_parent):
|
||||
|
||||
ret = None
|
||||
prototype_parent = protlib.search_prototype(new_parent)
|
||||
try:
|
||||
|
|
@ -1090,7 +1085,6 @@ def _aliases_actions(caller, raw_inp, **kwargs):
|
|||
|
||||
@list_node(_all_aliases, _aliases_select)
|
||||
def node_aliases(caller):
|
||||
|
||||
text = """
|
||||
|cAliases|n are alternative ways to address an object, next to its |cKey|n. Aliases are not
|
||||
case sensitive.
|
||||
|
|
@ -1393,7 +1387,6 @@ def _add_tag(caller, tag_string, **kwargs):
|
|||
old_tag = _get_tup_by_tagname(caller, tag)
|
||||
|
||||
if "delete" in kwargs:
|
||||
|
||||
if old_tag:
|
||||
tags.pop(tags.index(old_tag))
|
||||
text = "Removed Tag '{}'.".format(tag)
|
||||
|
|
@ -1745,7 +1738,6 @@ def node_permissions(caller):
|
|||
|
||||
|
||||
def node_location(caller):
|
||||
|
||||
text = """
|
||||
The |cLocation|n of this object in the world. If not given, the object will spawn in the
|
||||
inventory of |c{caller}|n by default.
|
||||
|
|
@ -1782,7 +1774,6 @@ def node_location(caller):
|
|||
|
||||
|
||||
def node_home(caller):
|
||||
|
||||
text = """
|
||||
The |cHome|n location of an object is often only used as a backup - this is where the object
|
||||
will be moved to if its location is deleted. The home location can also be used as an actual
|
||||
|
|
@ -1823,7 +1814,6 @@ def node_home(caller):
|
|||
|
||||
|
||||
def node_destination(caller):
|
||||
|
||||
text = """
|
||||
The object's |cDestination|n is generally only used by Exit-like objects to designate where
|
||||
the exit 'leads to'. It's usually unset for all other types of objects.
|
||||
|
|
@ -1859,7 +1849,6 @@ def node_destination(caller):
|
|||
|
||||
|
||||
def node_prototype_desc(caller):
|
||||
|
||||
text = """
|
||||
The |cPrototype-Description|n briefly describes the prototype when it's viewed in listings.
|
||||
|
||||
|
|
@ -1967,7 +1956,6 @@ def _prototype_tags_actions(caller, raw_inp, **kwargs):
|
|||
|
||||
@list_node(_caller_prototype_tags, _prototype_tag_select)
|
||||
def node_prototype_tags(caller):
|
||||
|
||||
text = """
|
||||
|cPrototype-Tags|n can be used to classify and find prototypes in listings Tag names are not
|
||||
case-sensitive and can have not have a custom category.
|
||||
|
|
@ -2067,7 +2055,6 @@ def _prototype_locks_actions(caller, raw_inp, **kwargs):
|
|||
|
||||
@list_node(_caller_prototype_locks, _prototype_lock_select)
|
||||
def node_prototype_locks(caller):
|
||||
|
||||
text = """
|
||||
|cPrototype-Locks|n are used to limit access to this prototype when someone else is trying
|
||||
to access it. By default any prototype can be edited only by the creator and by Admins while
|
||||
|
|
@ -2608,7 +2595,6 @@ def _prototype_load_actions(caller, raw_inp, **kwargs):
|
|||
)
|
||||
|
||||
if prototype:
|
||||
|
||||
# which action to apply on the selection
|
||||
if action == "examine":
|
||||
# examine the prototype
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ from django.conf import settings
|
|||
from django.core.paginator import Paginator
|
||||
from django.db.models import Q
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from evennia.locks.lockhandler import check_lockstring, validate_lockstring
|
||||
from evennia.objects.models import ObjectDB
|
||||
from evennia.scripts.scripts import DefaultScript
|
||||
|
|
|
|||
|
|
@ -137,9 +137,10 @@ import copy
|
|||
import hashlib
|
||||
import time
|
||||
|
||||
import evennia
|
||||
from django.conf import settings
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
import evennia
|
||||
from evennia.objects.models import ObjectDB
|
||||
from evennia.prototypes import prototypes as protlib
|
||||
from evennia.prototypes.prototypes import (
|
||||
|
|
@ -396,7 +397,6 @@ def prototype_diff(prototype1, prototype2, maxdepth=2, homogenize=False, implici
|
|||
_unset = Unset()
|
||||
|
||||
def _recursive_diff(old, new, depth=0):
|
||||
|
||||
old_type = type(old)
|
||||
new_type = type(new)
|
||||
|
||||
|
|
@ -693,7 +693,6 @@ def batch_update_objects_with_prototype(
|
|||
|
||||
try:
|
||||
for key, directive in diff.items():
|
||||
|
||||
if key not in new_prototype and not exact:
|
||||
# we don't update the object if the prototype does not actually
|
||||
# contain the key (the diff will report REMOVE but we ignore it
|
||||
|
|
@ -701,7 +700,6 @@ def batch_update_objects_with_prototype(
|
|||
continue
|
||||
|
||||
if directive in ("UPDATE", "REPLACE"):
|
||||
|
||||
if key in _PROTOTYPE_META_NAMES:
|
||||
# prototype meta keys are not stored on-object
|
||||
continue
|
||||
|
|
@ -855,7 +853,6 @@ def batch_create_object(*objparams):
|
|||
|
||||
objs = []
|
||||
for objparam in objparams:
|
||||
|
||||
obj = ObjectDB(**objparam[0])
|
||||
|
||||
# setup
|
||||
|
|
@ -930,7 +927,6 @@ def spawn(*prototypes, caller=None, **kwargs):
|
|||
|
||||
objsparams = []
|
||||
for prototype in prototypes:
|
||||
|
||||
# run validation and homogenization of provided prototypes
|
||||
protlib.validate_prototype(
|
||||
prototype, None, protparents=custom_protparents, is_prototype_base=True
|
||||
|
|
@ -996,7 +992,7 @@ def spawn(*prototypes, caller=None, **kwargs):
|
|||
|
||||
val = prot.pop("tags", [])
|
||||
tags = []
|
||||
for (tag, category, *data) in val:
|
||||
for tag, category, *data in val:
|
||||
tags.append(
|
||||
(
|
||||
init_spawn_value(tag, str, **init_spawn_kwargs),
|
||||
|
|
@ -1026,7 +1022,7 @@ def spawn(*prototypes, caller=None, **kwargs):
|
|||
# the rest are attribute tuples (attrname, value, category, locks)
|
||||
val = make_iter(prot.pop("attrs", []))
|
||||
attributes = []
|
||||
for (attrname, value, *rest) in val:
|
||||
for attrname, value, *rest in val:
|
||||
attributes.append(
|
||||
(
|
||||
attrname,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ from time import time
|
|||
import mock
|
||||
from anything import Something
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from evennia.commands.default import building
|
||||
from evennia.objects.models import ObjectDB
|
||||
from evennia.prototypes import menus as olc_menus
|
||||
|
|
@ -135,7 +136,6 @@ class TestUtils(BaseEvenniaTest):
|
|||
)
|
||||
|
||||
def test_update_objects_from_prototypes(self):
|
||||
|
||||
self.maxDiff = None
|
||||
self.obj1.attributes.add("oldtest", "to_keep")
|
||||
|
||||
|
|
@ -438,7 +438,6 @@ class TestPrototypeStorage(BaseEvenniaTest):
|
|||
self.prot3["prototype_tags"] = [("foo1", _PROTOTYPE_TAG_META_CATEGORY)]
|
||||
|
||||
def test_prototype_storage(self):
|
||||
|
||||
# from evennia import set_trace;set_trace(term_size=(180, 50))
|
||||
prot1 = protlib.create_prototype(self.prot1)
|
||||
|
||||
|
|
@ -500,7 +499,6 @@ class _MockMenu(object):
|
|||
|
||||
|
||||
class TestMenuModule(BaseEvenniaTest):
|
||||
|
||||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -518,7 +516,6 @@ class TestMenuModule(BaseEvenniaTest):
|
|||
}
|
||||
|
||||
def test_helpers(self):
|
||||
|
||||
caller = self.caller
|
||||
|
||||
# general helpers
|
||||
|
|
@ -579,7 +576,6 @@ class TestMenuModule(BaseEvenniaTest):
|
|||
self.assertEqual(olc_menus._default_parse("f5", choices, *actions), (None, None))
|
||||
|
||||
def test_node_helpers(self):
|
||||
|
||||
caller = self.caller
|
||||
|
||||
with mock.patch(
|
||||
|
|
@ -820,7 +816,6 @@ class TestMenuModule(BaseEvenniaTest):
|
|||
new=mock.MagicMock(return_value={"TypeclassTest": None}),
|
||||
)
|
||||
class TestOLCMenu(TestEvMenu):
|
||||
|
||||
maxDiff = None
|
||||
menutree = "evennia.prototypes.menus"
|
||||
startnode = "node_index"
|
||||
|
|
@ -941,7 +936,6 @@ class TestOLCMenu(TestEvMenu):
|
|||
|
||||
|
||||
class PrototypeCrashTest(BaseEvenniaTest):
|
||||
|
||||
# increase this to 1000 for optimization testing
|
||||
num_prototypes = 10
|
||||
|
||||
|
|
@ -1038,7 +1032,6 @@ class TestIssue2908(BaseEvenniaTest):
|
|||
"""
|
||||
|
||||
def test_spawn_with_protfunc(self):
|
||||
|
||||
self.room1.tags.add("beach", category="zone")
|
||||
|
||||
prot = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue