Ran black on sources

This commit is contained in:
Griatch 2022-09-18 23:58:32 +02:00
parent 6fa68745ba
commit 43378b4c41
30 changed files with 473 additions and 275 deletions

View file

@ -63,7 +63,7 @@ def build_matches(raw_string, cmdset, include_prefixes=False):
try:
orig_string = raw_string
if not include_prefixes and len(raw_string) > 1:
raw_string = raw_string.lstrip(_CMD_IGNORE_PREFIXES)
raw_string = raw_string.lstrip(_CMD_IGNORE_PREFIXES)
search_string = raw_string.lower()
for cmd in cmdset:
cmdname, raw_cmdname = cmd.match(search_string, include_prefixes=include_prefixes)

View file

@ -359,11 +359,15 @@ class Command(metaclass=CommandMeta):
"""
if include_prefixes:
for cmd_key in self._keyaliases:
if cmdname.startswith(cmd_key) and (not self.arg_regex or self.arg_regex.match(cmdname[len(cmd_key) :])):
if cmdname.startswith(cmd_key) and (
not self.arg_regex or self.arg_regex.match(cmdname[len(cmd_key) :])
):
return cmd_key, cmd_key
else:
for k, v in self._noprefix_aliases.items():
if cmdname.startswith(k) and (not self.arg_regex or self.arg_regex.match(cmdname[len(k) :])):
if cmdname.startswith(k) and (
not self.arg_regex or self.arg_regex.match(cmdname[len(k) :])
):
return k, v
return None, None

View file

@ -1950,7 +1950,12 @@ class CmdSetAttribute(ObjManipCommand):
if self.rhs is None:
# no = means we inspect the attribute(s)
if not attrs:
attrs = [attr.key for attr in obj.attributes.get(category=None, return_obj=True, return_list=True)]
attrs = [
attr.key
for attr in obj.attributes.get(
category=None, return_obj=True, return_list=True
)
]
for attr in attrs:
if not self.check_attr(obj, attr, category):
continue
@ -2001,7 +2006,9 @@ class CmdSetAttribute(ObjManipCommand):
result.append(self.set_attr(obj, attr, value, category))
# check if anything was done
if not result:
caller.msg("No valid attributes were found. Usage: set obj/attr[:category] = value. Use empty value to clear.")
caller.msg(
"No valid attributes were found. Usage: set obj/attr[:category] = value. Use empty value to clear."
)
else:
# send feedback
caller.msg("".join(result).strip("\n"))
@ -3732,7 +3739,7 @@ class CmdTeleport(COMMAND_DEFAULT_CLASS):
quiet="quiet" in self.switches,
emit_to_obj=caller,
use_destination="intoexit" not in self.switches,
move_type="teleport"
move_type="teleport",
):
if obj_to_teleport == caller:

View file

@ -1584,8 +1584,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 +1702,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 +1750,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")