Use repr instead of manually added single quotes

This commit is contained in:
Gouvernathor 2023-11-15 20:54:03 +01:00
parent 8b6627f588
commit 2ccece1a3d
4 changed files with 7 additions and 7 deletions

View File

@ -62,7 +62,7 @@ init -100 python:
value = renpy.random.choices(self.weather_types, weights=self.weather_weights)[0]
if not value in self.weather_types:
raise ValueError("Unsupported weather type: '{}'".format(value))
raise ValueError("Unsupported weather type: {!r}".format(value))
self._weather = value

View File

@ -58,12 +58,12 @@ init 5 python:
return None
if not isinstance(req, str):
raise TypeError("MirrorEvent '{}' requirement has to be a string, got '{}'.".format(self.id, type(req)))
raise TypeError("MirrorEvent {!r} requirement has to be a string, got {!r}.".format(self.id, type(req)))
output = eval(req)
if not isinstance(output, bool):
raise TypeError("MirrorEvent '{}' requirement must evaluate to a boolean type, got '{}'.".format(self.id, type(output)))
raise TypeError("MirrorEvent {!r} requirement must evaluate to a boolean type, got {!r}.".format(self.id, type(output)))
return req
def play(self):

View File

@ -86,7 +86,7 @@ init python:
elif what == "temp_attr":
setattr(node, "temporary_attributes", tuple(contents))
else:
raise TypeError("Type '{}' is not implemented.".format(what))
raise TypeError("Type {!r} is not implemented.".format(what))
def replace_expression(self, expr, val):
node = self.node

View File

@ -92,7 +92,7 @@ init -1 python:
# Node argument values are (fucking) raw
val = strip(val)
msg = "'{}'".format(key)
msg = repr(key)
fp = f"characters/{SAYERS.get(who)}/poses/default/face/{key}/{val}/"
fn = next((f for f in files if f.startswith(fp)), f"{fp}expression.webp")
@ -137,7 +137,7 @@ init -1 python:
renpy.lint.report_node = node
has_failed = True
msg = "'{}' requires an integer, or a pre-defined named position, not '{}'".format(key, val)
msg = "{!r} requires an integer, or a pre-defined named position, not {!r}".format(key, val)
renpy.lint.report(msg)
# This would require fixing hundreds of calls. Might postpone it...
@ -160,7 +160,7 @@ init -1 python:
val = strip(val)
if key == "emote":
msg = "'{}'".format(key)
msg = repr(key)
fn = "characters/{}/emote/{}.webp".format(SAYERS.get(who), val)
if not has_failed: