diff --git a/stellarisdashboard/config.py b/stellarisdashboard/config.py index 7fcda07..d9df2a4 100644 --- a/stellarisdashboard/config.py +++ b/stellarisdashboard/config.py @@ -456,7 +456,7 @@ def _get_mod_data_dir(mod_descriptor_path: pathlib.Path): try: with open(mod_descriptor_path, "r") as f: for line in f: - match = re.match('^\s*path\s*=\s*"(.*)"\s*$', line) + match = re.match(r'^\s*path\s*=\s*"(.*)"\s*$', line) if match: return pathlib.Path(match.group(1)) except Exception as e: @@ -468,7 +468,7 @@ def _get_mod_data_dir(mod_descriptor_path: pathlib.Path): def _localization_file_matches_language(file_path: pathlib.Path, language: str): with open(file_path, "r") as f: first_line = f.readline() - match = re.match(f"^\ufeff\s*{language}\s*:\s*$", first_line) + match = re.match(rf"^\ufeff\s*{language}\s*:\s*$", first_line) return match is not None diff --git a/stellarisdashboard/dashboard_app/visualization_data.py b/stellarisdashboard/dashboard_app/visualization_data.py index 6619944..730be85 100644 --- a/stellarisdashboard/dashboard_app/visualization_data.py +++ b/stellarisdashboard/dashboard_app/visualization_data.py @@ -1775,7 +1775,7 @@ def get_color_by_name(self, country_name: str): @staticmethod def _parse_map_colors(path: pathlib.Path): with open(path, "r") as f: - prepared_str = re.sub("#[^\n]*", "", f.read()) # strip out comments + prepared_str = re.sub(r"#[^\n]*", "", f.read()) # strip out comments data = rust_parser.parse_save_from_string(prepared_str) colors = data.get("colors", {}) diff --git a/stellarisdashboard/game_info.py b/stellarisdashboard/game_info.py index f397bcd..1272b18 100644 --- a/stellarisdashboard/game_info.py +++ b/stellarisdashboard/game_info.py @@ -191,7 +191,7 @@ def _handle_unresolved_variables(self, render_template): if match == "ORD": continue resolved = lookup_key(match) - render_template = re.sub(f"\${match}\$", resolved, render_template) + render_template = re.sub(rf"\${match}\$", resolved, render_template) return render_template