Skip to content
Snippets Groups Projects

More code improvements

Merged wkwk requested to merge wkwk/lr2mods:more_code_fixes into develop
3 files
+ 12
6
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -15,10 +15,12 @@ def convert_field_override(self, value, conversion):
return value
if not conversion:
raise ValueError("Conversion specifier can't be empty.")
msg = "Conversion specifier can't be empty."
raise ValueError(msg)
if set(conversion) - set("rstqulci!"):
raise ValueError("Unknown symbols in conversion specifier, this must use only the \"rstqulci\".")
msg = 'Unknown symbols in conversion specifier, this must use only the "rstqulci".'
raise ValueError(msg)
if "r" in conversion:
value = repr(value)
@@ -41,7 +43,8 @@ def convert_field_override(self, value, conversion):
try:
value = self.vformat(value, (), kwargs)
except RuntimeError as exc: # PY3 RecursionError
raise ValueError("Substitution {!r} refers to itself in a loop.".format(value)) from exc
msg = "Substitution {!r} refers to itself in a loop.".format(value)
raise ValueError(msg) from exc
if "q" in conversion:
value = value.replace("{", "{{")
Loading