Ran black on sources

This commit is contained in:
Griatch 2020-02-29 12:25:00 +01:00
parent edcd06d531
commit 25a0de12d7
4 changed files with 30 additions and 24 deletions

View file

@ -2100,20 +2100,16 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
if "prototype" in self.switches:
diff, _ = spawner.prototype_diff_from_object(prototype, obj)
txt, options = _format_diff_text_and_options(diff, objects=[obj])
prompt = "Applying prototype '%s' over '%s' will cause the follow changes:\n%s\n" % \
(
prototype["key"],
obj.name,
"\n".join(txt)
)
prompt = (
"Applying prototype '%s' over '%s' will cause the follow changes:\n%s\n"
% (prototype["key"], obj.name, "\n".join(txt))
)
if not reset:
prompt += "\n|yWARNING:|n Use the /reset switch to apply the prototype over a blank state."
prompt += "\nAre you sure you want to apply these changes [yes]/no?"
answer = yield (prompt)
if answer and answer in ("no", "n"):
caller.msg(
"Canceled: No changes were applied."
)
caller.msg("Canceled: No changes were applied.")
return
# we let this raise exception if needed
@ -2144,7 +2140,10 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
else:
string += " Attributes set before swap were not removed."
if "prototype" in self.switches and prototype_success:
string += " Prototype '%s' was successfully applied over the object type." % prototype["key"]
string += (
" Prototype '%s' was successfully applied over the object type."
% prototype["key"]
)
caller.msg(string)

View file

@ -992,15 +992,22 @@ class TestBuilding(CommandTest):
)
from evennia.prototypes.prototypes import homogenize_prototype
test_prototype = [homogenize_prototype(
{"prototype_key": "testkey",
"prototype_tags": [],
"typeclass": "typeclasses.objects.Object",
"key":"replaced_obj",
"attrs": [("foo", "bar", None, ""),
("desc", "protdesc", None, "")]})]
with mock.patch("evennia.commands.default.building.protlib.search_prototype",
new=mock.MagicMock(return_value=test_prototype)) as mprot:
test_prototype = [
homogenize_prototype(
{
"prototype_key": "testkey",
"prototype_tags": [],
"typeclass": "typeclasses.objects.Object",
"key": "replaced_obj",
"attrs": [("foo", "bar", None, ""), ("desc", "protdesc", None, "")],
}
)
]
with mock.patch(
"evennia.commands.default.building.protlib.search_prototype",
new=mock.MagicMock(return_value=test_prototype),
) as mprot:
self.call(
building.CmdTypeclass(),
"/prototype Obj=testkey",
@ -1008,7 +1015,7 @@ class TestBuilding(CommandTest):
"evennia.objects.objects.DefaultObject to "
"typeclasses.objects.Object.\nAll object creation hooks were "
"run. Attributes set before swap were not removed. Prototype "
"'replaced_obj' was successfully applied over the object type."
"'replaced_obj' was successfully applied over the object type.",
)
assert self.obj1.db.desc == "protdesc"

View file

@ -88,8 +88,10 @@ class ScriptHandler(object):
script.start()
if not script.id:
# this can happen if the script has repeats=1 or calls stop() in at_repeat.
logger.log_info("Script %s started and then immediately stopped; "
"it could probably be a normal function." % scriptclass)
logger.log_info(
"Script %s started and then immediately stopped; "
"it could probably be a normal function." % scriptclass
)
return True
def start(self, key):

View file

@ -388,8 +388,6 @@ if WEBSERVER_ENABLED:
webclientstr = "webclient-websocket%s: %s" % (w_ifacestr, port)
INFO_DICT["webclient"].append(webclientstr)
if WEB_PLUGINS_MODULE:
try:
web_root = WEB_PLUGINS_MODULE.at_webproxy_root_creation(web_root)