Ran black on sources
This commit is contained in:
parent
edcd06d531
commit
25a0de12d7
4 changed files with 30 additions and 24 deletions
|
|
@ -2100,20 +2100,16 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
|
||||||
if "prototype" in self.switches:
|
if "prototype" in self.switches:
|
||||||
diff, _ = spawner.prototype_diff_from_object(prototype, obj)
|
diff, _ = spawner.prototype_diff_from_object(prototype, obj)
|
||||||
txt, options = _format_diff_text_and_options(diff, objects=[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" % \
|
prompt = (
|
||||||
(
|
"Applying prototype '%s' over '%s' will cause the follow changes:\n%s\n"
|
||||||
prototype["key"],
|
% (prototype["key"], obj.name, "\n".join(txt))
|
||||||
obj.name,
|
|
||||||
"\n".join(txt)
|
|
||||||
)
|
)
|
||||||
if not reset:
|
if not reset:
|
||||||
prompt += "\n|yWARNING:|n Use the /reset switch to apply the prototype over a blank state."
|
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?"
|
prompt += "\nAre you sure you want to apply these changes [yes]/no?"
|
||||||
answer = yield (prompt)
|
answer = yield (prompt)
|
||||||
if answer and answer in ("no", "n"):
|
if answer and answer in ("no", "n"):
|
||||||
caller.msg(
|
caller.msg("Canceled: No changes were applied.")
|
||||||
"Canceled: No changes were applied."
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# we let this raise exception if needed
|
# we let this raise exception if needed
|
||||||
|
|
@ -2144,7 +2140,10 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
|
||||||
else:
|
else:
|
||||||
string += " Attributes set before swap were not removed."
|
string += " Attributes set before swap were not removed."
|
||||||
if "prototype" in self.switches and prototype_success:
|
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)
|
caller.msg(string)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -992,15 +992,22 @@ class TestBuilding(CommandTest):
|
||||||
)
|
)
|
||||||
|
|
||||||
from evennia.prototypes.prototypes import homogenize_prototype
|
from evennia.prototypes.prototypes import homogenize_prototype
|
||||||
test_prototype = [homogenize_prototype(
|
|
||||||
{"prototype_key": "testkey",
|
test_prototype = [
|
||||||
|
homogenize_prototype(
|
||||||
|
{
|
||||||
|
"prototype_key": "testkey",
|
||||||
"prototype_tags": [],
|
"prototype_tags": [],
|
||||||
"typeclass": "typeclasses.objects.Object",
|
"typeclass": "typeclasses.objects.Object",
|
||||||
"key":"replaced_obj",
|
"key": "replaced_obj",
|
||||||
"attrs": [("foo", "bar", None, ""),
|
"attrs": [("foo", "bar", None, ""), ("desc", "protdesc", None, "")],
|
||||||
("desc", "protdesc", None, "")]})]
|
}
|
||||||
with mock.patch("evennia.commands.default.building.protlib.search_prototype",
|
)
|
||||||
new=mock.MagicMock(return_value=test_prototype)) as mprot:
|
]
|
||||||
|
with mock.patch(
|
||||||
|
"evennia.commands.default.building.protlib.search_prototype",
|
||||||
|
new=mock.MagicMock(return_value=test_prototype),
|
||||||
|
) as mprot:
|
||||||
self.call(
|
self.call(
|
||||||
building.CmdTypeclass(),
|
building.CmdTypeclass(),
|
||||||
"/prototype Obj=testkey",
|
"/prototype Obj=testkey",
|
||||||
|
|
@ -1008,7 +1015,7 @@ class TestBuilding(CommandTest):
|
||||||
"evennia.objects.objects.DefaultObject to "
|
"evennia.objects.objects.DefaultObject to "
|
||||||
"typeclasses.objects.Object.\nAll object creation hooks were "
|
"typeclasses.objects.Object.\nAll object creation hooks were "
|
||||||
"run. Attributes set before swap were not removed. Prototype "
|
"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"
|
assert self.obj1.db.desc == "protdesc"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,10 @@ class ScriptHandler(object):
|
||||||
script.start()
|
script.start()
|
||||||
if not script.id:
|
if not script.id:
|
||||||
# this can happen if the script has repeats=1 or calls stop() in at_repeat.
|
# 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; "
|
logger.log_info(
|
||||||
"it could probably be a normal function." % scriptclass)
|
"Script %s started and then immediately stopped; "
|
||||||
|
"it could probably be a normal function." % scriptclass
|
||||||
|
)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def start(self, key):
|
def start(self, key):
|
||||||
|
|
|
||||||
|
|
@ -388,8 +388,6 @@ if WEBSERVER_ENABLED:
|
||||||
webclientstr = "webclient-websocket%s: %s" % (w_ifacestr, port)
|
webclientstr = "webclient-websocket%s: %s" % (w_ifacestr, port)
|
||||||
INFO_DICT["webclient"].append(webclientstr)
|
INFO_DICT["webclient"].append(webclientstr)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if WEB_PLUGINS_MODULE:
|
if WEB_PLUGINS_MODULE:
|
||||||
try:
|
try:
|
||||||
web_root = WEB_PLUGINS_MODULE.at_webproxy_root_creation(web_root)
|
web_root = WEB_PLUGINS_MODULE.at_webproxy_root_creation(web_root)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue