diff --git a/game/scripts/inventory/potions/_potions_.txt b/game/scripts/inventory/potions/_potions_.txt index 055b1763..62a529af 100644 --- a/game/scripts/inventory/potions/_potions_.txt +++ b/game/scripts/inventory/potions/_potions_.txt @@ -331,15 +331,15 @@ init -1 python: def get_store_menu_item(self, disabled=False): if disabled: - return gui.menu_item('-{}-'.format(self.name), None, style="disabled") + return gui.menu_item(f'-{self.name}-', None, style="disabled") else: - return gui.menu_item('-{}-'.format(self.name), self) + return gui.menu_item(f'-{self.name}-', self) def get_craft_menu_item(self, disabled=False): if disabled: - return gui.menu_item('-Craft: "{}"-'.format(self.name), self.ingredients, style="disabled") + return gui.menu_item(f'-Craft: "{self.name}"-', self.ingredients, style="disabled") else: - return gui.menu_item('-Craft: "{}"-'.format(self.name), self.id) + return gui.menu_item(f'-Craft: "{self.name}"-', self.id) def get_mix_text(self): return ">You mix the {i}" + potion_lib.get_name_by_id(self.ingredients[0]) \ diff --git a/game/scripts/utility/devtools.rpy b/game/scripts/utility/devtools.rpy index 6e9510d1..74e5ab4b 100644 --- a/game/scripts/utility/devtools.rpy +++ b/game/scripts/utility/devtools.rpy @@ -15,16 +15,16 @@ python early: return "DirectX" if preferences.renderer == "angle2" else "OpenGL" class stdcol: - PURPLE = '\033[1;35;48m' - CYAN = '\033[1;36;48m' - BOLD = '\033[1;37;48m' - BLUE = '\033[1;34;48m' - GREEN = '\033[1;32;48m' - YELLOW = '\033[1;33;48m' - RED = '\033[1;31;48m' - BLACK = '\033[1;30;48m' - UNDERLINE = '\033[4;37;48m' - END = '\033[1;37;0m' + PURPLE = '\033[1;35;48m' + CYAN = '\033[1;36;48m' + BOLD = '\033[1;37;48m' + BLUE = '\033[1;34;48m' + GREEN = '\033[1;32;48m' + YELLOW = '\033[1;33;48m' + RED = '\033[1;31;48m' + BLACK = '\033[1;30;48m' + UNDERLINE = '\033[4;37;48m' + END = '\033[1;37;0m' if config.developer: # Debug @@ -42,7 +42,7 @@ python early: orphaned.append(i) if orphaned: - raise Exception("Orphaned compiled scripts detected, please delete them before continuing:\n{}".format(orphaned)) + raise Exception(f"Orphaned compiled scripts detected, please delete them before continuing:\n{orphaned}") detect_orphaned_rpyc_files() @@ -91,7 +91,7 @@ init -2 python: return Image(file + ".png") if config.developer: - raise IOError("Missing image: {}".format(path)) + raise IOError(f"Missing image: {path}") return Image("images/blank.webp") def missing_label_func(name): diff --git a/game/scripts/utility/editor.rpy b/game/scripts/utility/editor.rpy index fb3ff8d5..28f2aa3e 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 {!r} is not implemented.".format(what)) + raise TypeError(f"Type {what!r} is not implemented.") def replace_expression(self, expr, val): node = self.node @@ -97,14 +97,14 @@ init python: # We need to make sure not to add quotes # to expressions or variables. if isinstance(val, str): - val = "\"{}\"".format(val) + val = repr(val) # Insert new expression d = self.get_expressions_active(who) d[expr] = val # Convert to list of tuples - # l = [(k, "\"{}\"".format(v)) for k, v in d.items() if not v is None] # This is faster, but not robust enough. + # l = [(k, repr(v)) for k, v in d.items() if not v is None] # This is faster, but not robust enough. l = _list() l2 = _list() diff --git a/game/scripts/utility/engine.rpy b/game/scripts/utility/engine.rpy index d02a4e4a..7e0803df 100644 --- a/game/scripts/utility/engine.rpy +++ b/game/scripts/utility/engine.rpy @@ -39,13 +39,13 @@ init python: if cache_size >= cache_limit: if config.developer: - print("Cache limit reached, purging cache... ({}/{})\n{}".format(cache_size, cache_limit, renpy.get_filename_line())) + print(f"Cache limit reached, purging cache... ({cache_size}/{cache_limit})\n{renpy.get_filename_line()}") cache.clear() if renpy.game.interface is not None: if config.developer: - print("Statements limit reached, cleaning textures... ({})\n{}".format(self.limit, renpy.get_filename_line())) + print(f"Statements limit reached, cleaning textures... ({self.limit})\n{renpy.get_filename_line()}") renpy.game.interface.full_redraw = True renpy.game.interface.restart_interaction = True @@ -144,13 +144,13 @@ python early hide: # return (_CallException, (self.label, self.args, self.kwargs, self.from_current)) # class _JumpException(Exception): - + # def __init__(self, label): # for i in renpy.config._label_callbacks: # i(label) # class _JumpOutException(Exception): - + # def __init__(self, label): # for i in renpy.config._label_callbacks: # i(label) diff --git a/game/scripts/utility/lint.rpy b/game/scripts/utility/lint.rpy index 0124978c..9dfa4b81 100644 --- a/game/scripts/utility/lint.rpy +++ b/game/scripts/utility/lint.rpy @@ -137,7 +137,7 @@ init -1 python: renpy.lint.report_node = node has_failed = True - msg = "{!r} requires an integer, or a pre-defined named position, not {!r}".format(key, val) + msg = f"{key!r} requires an integer, or a pre-defined named position, not {val!r}" renpy.lint.report(msg) # This would require fixing hundreds of calls. Might postpone it... @@ -161,7 +161,7 @@ init -1 python: if key == "emote": msg = repr(key) - fn = "characters/{}/emote/{}.webp".format(SAYERS.get(who), val) + fn = f"characters/{SAYERS.get(who)}/emote/{val}.webp" if not has_failed: # Avoid repeating node destination diff --git a/game/scripts/utility/translation.rpy b/game/scripts/utility/translation.rpy index e2eba6f8..9c67f39a 100644 --- a/game/scripts/utility/translation.rpy +++ b/game/scripts/utility/translation.rpy @@ -75,7 +75,7 @@ init python in cli: for i, s in enumerate(strings): n = round(float(i)/(nstrings)*100) - print("\rGenerating strings for {} ... Total progress:{} % ... Stage 2/2".format(language, n), end="") + print(f"\rGenerating strings for {language} ... Total progress:{n} % ... Stage 2/2", end="") tlfn = renpy.translation.generation.translation_filename(s) @@ -96,17 +96,17 @@ init python in cli: tlfn = os.path.join(renpy.config.gamedir, renpy.config.tl_directory, language, tlfn) f = open_tl_file(tlfn, mode="w") - f.write(u"translate {} strings:\n".format(language)) - f.write(u"\n") + f.write(f"translate {language} strings:\n") + f.write("\n") for s in sl: original = s.text translation = stl.translate(s.text) # Keeps translated strings - f.write(u" # {}:{}\n".format(elide_filename(s.filename), s.line)) - f.write(u" old \"{}\"\n".format(quote_unicode(original))) - f.write(u" new \"{}\"\n".format(quote_unicode(translation))) - f.write(u"\n") + f.write(f" # {elide_filename(s.filename)}:{s.line}\n") + f.write(f" old \"{quote_unicode(original)}\"\n") + f.write(f" new \"{quote_unicode(translation)}\"\n") + f.write("\n") def retranslate(): translator = renpy.game.script.translator @@ -135,7 +135,7 @@ init python in cli: for language in translator.languages: - print("\rGenerating dialogues for {} ... Total progress:{} % ... Stage 1/2".format(language, n), end="") + print(f"\rGenerating dialogues for {language} ... Total progress:{n} % ... Stage 1/2", end="") for _, trans in translator.file_translates[filepath]: @@ -159,9 +159,9 @@ init python in cli: f = open_tl_file(fp, mode="w") - f.write(u"# {}:{}\n".format(trans.filename, trans.linenumber)) - f.write(u"translate {} {}:\n".format(language, trans.identifier.replace(".", "_"))) - f.write(u"\n") + f.write(f"# {trans.filename}:{trans.linenumber}\n") + f.write("translate {} {}:\n".format(language, trans.identifier.replace(".", "_"))) + f.write("\n") for n in trans.block: f.write(u" # " + n.get_code() + "\n") @@ -196,7 +196,7 @@ init python in cli: f.close() if args.dry: - print("Removal required: {}".format(filepath)) + print(f"Removal required: {filepath}") else: os.unlink(filepath) os.unlink(filepath + "c") diff --git a/game/scripts/utility/updater.rpy b/game/scripts/utility/updater.rpy index 80fea2d3..0f43ee80 100644 --- a/game/scripts/utility/updater.rpy +++ b/game/scripts/utility/updater.rpy @@ -106,7 +106,7 @@ init python: current = getattr(store, "version", latest) if current < 1.452: - + for i in states.dolls: doll = getattr(store, i) doll._sprite = DefaultQueue() @@ -121,7 +121,7 @@ init python: # Fix makeup object types inside saved outfits if j.has_type("makeup"): - + objects = [x.parent.clone() for x in j.group] j.group = objects @@ -212,7 +212,7 @@ init python: doll.body.matrix = IdentityMatrix() if current > latest: - raise Exception("Loaded save file is incompatible. (Save Version: {}, Game Version: {})".format(current, latest)) + raise Exception(f"Loaded save file is incompatible. (Save Version: {current}, Game Version: {latest})") if current < latest: setattr(store, "version", latest) @@ -226,7 +226,7 @@ init python: def version_logo(): url = UPDATE_URL - filename = "logo_{}.webp".format(UPDATE_VER) + filename = f"logo_{UPDATE_VER}.webp" path = os.path.join(config.basedir, "update", filename) # Read file if exists diff --git a/game/scripts/wardrobe/studio.rpy b/game/scripts/wardrobe/studio.rpy index 7ff49051..27372133 100644 --- a/game/scripts/wardrobe/studio.rpy +++ b/game/scripts/wardrobe/studio.rpy @@ -30,7 +30,7 @@ init python in studio: fp, fn = os.path.split(f) fn, ext = os.path.splitext(fn) expression = os.path.split(fp)[1] - + if part in ("cheeks", "tears"): expressions = d.setdefault(charname, _dict()).setdefault(part, _list((False,))) @@ -203,7 +203,7 @@ screen studio(): $ bg_blur = studio.choices["background"]["blur"] $ bg_matrix = bg_hue*bg_saturation*bg_brightness $ bg_image = studio.choices["background"]["list"][studio.choices["background"]["image"]] - $ bg_image = "images/rooms/_bg_/{}.webp".format(bg_image) + $ bg_image = f"images/rooms/_bg_/{bg_image}.webp" $ bg = Transform(bg_image, matrixcolor=bg_matrix, blur=bg_blur) $ ov_hue = HueMatrix(studio.choices["overlay"]["hue"]) @@ -214,9 +214,8 @@ screen studio(): $ ov_matrix = ov_hue*ov_saturation*ov_brightness $ ov_image = studio.choices["overlay"]["list"][studio.choices["overlay"]["image"]] - if not ov_image is None: - $ ov_image = "images/rooms/overlays/{}.webp".format(ov_image) - $ ov = Transform(ov_image, matrixcolor=ov_matrix, blur=ov_blur, alpha=ov_alpha) + if ov_image is not None: + $ ov = Transform(f"images/rooms/overlays/{ov_image}.webp", matrixcolor=ov_matrix, blur=ov_blur, alpha=ov_alpha) else: $ ov = None @@ -337,7 +336,7 @@ screen studio(): selected v[1] text_color ("#009900" if active else "#f9d592") text_hover_color "#fff" text_first_indent 20 - background Transform("interface/icons/head/{}.webp".format(k), size=(16, 16), offset=(22, 3)) + background Transform(f"interface/icons/head/{k}.webp", size=(16, 16), offset=(22, 3)) vbox: align (1.0, 1.0) diff --git a/game/scripts/wardrobe/wardrobe.rpy b/game/scripts/wardrobe/wardrobe.rpy index aa4a914a..46002df2 100644 --- a/game/scripts/wardrobe/wardrobe.rpy +++ b/game/scripts/wardrobe/wardrobe.rpy @@ -777,7 +777,7 @@ screen wardrobe_menuitem(xx, yy): pos (12, 108) for subcategory in category_items.keys(): - $ icon = lock_wardrobe_icon("interface/wardrobe/icons/{}.webp".format(subcategory)) + $ icon = lock_wardrobe_icon(f"interface/wardrobe/icons/{subcategory}.webp") button: focus_mask None @@ -830,7 +830,7 @@ screen wardrobe_outfit_menuitem(xx, yy): pos (8, 108) for subcategory in category_items.keys(): - $ icon = lock_wardrobe_icon("interface/wardrobe/icons/{}.webp".format(subcategory)) + $ icon = lock_wardrobe_icon(f"interface/wardrobe/icons/{subcategory}.webp") $ action = Return(["subcategory", subcategory]) if subcategory == "schedule" and not get_character_scheduling(states.active_girl): @@ -903,7 +903,7 @@ screen wardrobe_schedule_menuitem(item): spacing 0 for i in wardrobe_outfit_schedule: $ boolean = "" if item.schedule[i] else "Not " - $ caption = "{}worn during the {}".format(boolean, i) if i in ("day", "night") else "{}worn in {} weather".format(boolean, i) + $ caption = f"{boolean}worn during the {i}" if i in ("day", "night") else f"{boolean}worn in {i} weather" textbutton i: style gui.theme("dropdown") tooltip caption