Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings about invalid escape sequences #135

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stellarisdashboard/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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


Expand Down
2 changes: 1 addition & 1 deletion stellarisdashboard/dashboard_app/visualization_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", {})
Expand Down
2 changes: 1 addition & 1 deletion stellarisdashboard/game_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading