From 2ccece1a3de0dc5595d4adf8b49fe4a681733d63 Mon Sep 17 00:00:00 2001 From: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Date: Wed, 15 Nov 2023 20:54:03 +0100 Subject: [PATCH] Use repr instead of manually added single quotes --- game/scripts/inventory/game.rpy | 2 +- game/scripts/minigames/mirror/classes.rpy | 4 ++-- game/scripts/utility/editor.rpy | 2 +- game/scripts/utility/lint.rpy | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/game/scripts/inventory/game.rpy b/game/scripts/inventory/game.rpy index 78979c24..e4ff5df2 100644 --- a/game/scripts/inventory/game.rpy +++ b/game/scripts/inventory/game.rpy @@ -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 diff --git a/game/scripts/minigames/mirror/classes.rpy b/game/scripts/minigames/mirror/classes.rpy index 74c99e4e..d485f897 100644 --- a/game/scripts/minigames/mirror/classes.rpy +++ b/game/scripts/minigames/mirror/classes.rpy @@ -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): diff --git a/game/scripts/utility/editor.rpy b/game/scripts/utility/editor.rpy index dfed9c18..8583bf6a 100644 --- a/game/scripts/utility/editor.rpy +++ b/game/scripts/utility/editor.rpy @@ -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 diff --git a/game/scripts/utility/lint.rpy b/game/scripts/utility/lint.rpy index cf704884..0124978c 100644 --- a/game/scripts/utility/lint.rpy +++ b/game/scripts/utility/lint.rpy @@ -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: