Skip to content

Fix invalid escape sequence SyntaxWarnings in source - #63

Open
MBK-fr wants to merge 1 commit into
EvanLi:masterfrom
MBK-fr:fix/invalid-escape-sequence-syntaxwarning
Open

MBK-fr wants to merge 1 commit into
EvanLi:masterfrom
MBK-fr:fix/invalid-escape-sequence-syntaxwarning

Conversation

@MBK-fr

@MBK-fr MBK-fr commented Sep 13, 2026

Copy link
Copy Markdown

Problem

source/common.py and source/process.py build markdown output using string literals that contain invalid escape sequences:

  • source/common.py - '\|'
  • source/process.py - \#, \+, \- (in languages_md and the table_of_contents block)

On Python 3.12+ these emit SyntaxWarning: invalid escape sequence at import time (previously a silent DeprecationWarning; slated to become a SyntaxError).

Fix

Escape the backslashes so each literal's value is byte-for-byte identical - the generated ranking markdown is unchanged. Mirrors ruff's W605 autofix.

Verification

$ python3 -W error -c "import py_compile; py_compile.compile(f, doraise=True)"  # both files
# clean after; SyntaxWarning->error before

Both modules' ASTs are unchanged (verified with ast.dump before/after).


🤖 Generated with Claude Code

https://claude.ai/code/session_014HBQNzAf5C2E3MiJC48HQw

source/common.py and source/process.py build markdown output using
string literals with invalid escapes (\|, \#, \+, \-). On Python 3.12+
these emit `SyntaxWarning: invalid escape sequence` at import time
(previously a silent DeprecationWarning; slated to become SyntaxError).

Escape the backslashes so each literal's value is byte-for-byte
identical - the generated markdown is unchanged. Mirrors ruff's W605
autofix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014HBQNzAf5C2E3MiJC48HQw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant