Skip to content

fix: use raw docstrings for LaTeX math to avoid invalid escape warnings#300

Open
Creeken-Harrans wants to merge 1 commit intolabmlai:masterfrom
Creeken-Harrans:fix/raw-docstrings-for-latex
Open

fix: use raw docstrings for LaTeX math to avoid invalid escape warnings#300
Creeken-Harrans wants to merge 1 commit intolabmlai:masterfrom
Creeken-Harrans:fix/raw-docstrings-for-latex

Conversation

@Creeken-Harrans
Copy link
Copy Markdown

Summary

  • Convert """ to r""" for 271 docstrings across 89 files that contain LaTeX math formulas
  • Fixes reportInvalidStringEscapeSequence Pylance diagnostics in Python 3.12+
  • Backslash sequences like \l (from \lambda), \b (from \bar) are invalid Python escape sequences — raw strings preserve them as literal text

Test plan

  • python3 -W all -m compileall labml_nn/ yields zero SyntaxWarning: invalid escape
  • No behavioral changes — raw strings produce identical values at runtime for these docstrings

🤖 Generated with Claude Code

… warnings

Convert """ to r""" for docstrings containing LaTeX formulas. In Python 3.12+,
backslash sequences like \l (from \lambda), \b (from \bar), \t (from \theta)
trigger SyntaxWarning or are misinterpreted. Raw strings preserve the backslash
as literal text, fixing Pylance reportInvalidStringEscapeSequence diagnostics.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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