eliasdoehne / stellaris-dashboard

A graph dashboard and event log for Stellaris.
123 stars 14 forks source link

Fix warnings about invalid escape sequences #135

Closed chennin closed 4 months ago

chennin commented 4 months ago

I received the following warnings on Python 3.10.12. (Python 3.12 changes them to SyntaxWarning). This PR changes multiple strings fed to re in to raw strings (and yes, f and r can be combined like that).

stellarisdashboard/config.py:459
  /home/.../stellaris-dashboard/stellarisdashboard/config.py:459: DeprecationWarning: invalid escape sequence '\s'
    match = re.match('^\s*path\s*=\s*"(.*)"\s*$', line)

stellarisdashboard/config.py:471
stellarisdashboard/config.py:471
  /home/.../stellaris-dashboard/stellarisdashboard/config.py:471: DeprecationWarning: invalid escape sequence '\s'
    match = re.match(f"^\ufeff\s*{language}\s*:\s*$", first_line)

test/parser_test.py::test_real_save
test/parser_test.py::test_real_save
  /home/.../stellaris-dashboard/stellarisdashboard/game_info.py:194: DeprecationWarning: invalid escape sequence '\$'
    render_template = re.sub(f"\${match}\$", resolved, render_template)