Skip to content

Fix invalid escape sequences in calibration.py docstrings#1141

Open
rbalachandar wants to merge 1 commit intosunlabuiuc:masterfrom
rbalachandar:fix-calibration-escape-sequences
Open

Fix invalid escape sequences in calibration.py docstrings#1141
rbalachandar wants to merge 1 commit intosunlabuiuc:masterfrom
rbalachandar:fix-calibration-escape-sequences

Conversation

@rbalachandar
Copy link
Copy Markdown

@rbalachandar rbalachandar commented May 3, 2026

Summary

  • Fixed SyntaxWarning about invalid escape sequences in LaTeX math notation
  • Changed docstrings to raw strings (r"""...""") to preserve backslashes

Fixes #1142

Changes

  • ece_confidence_multiclass(): Changed opening docstring from """ to r"""
  • ece_confidence_binary(): Changed opening docstring from """ to r"""

Issue

This fixes SyntaxWarnings that appeared when running tests:

SyntaxWarning: invalid escape sequence "\c"

Which occurred in LaTeX expressions like \frac and \cdot within the docstrings.

Testing

Verified with:

python -W error::SyntaxWarning -c "import pyhealth.metrics.calibration; print(\"No syntax warnings - fix successful\")"

Output: No syntax warnings - fix successful

- Changed docstrings to raw strings (r"""...""") to preserve backslashes
- Fixes SyntaxWarning about invalid escape sequences in LaTeX math notation
- Lines affected: ece_confidence_multiclass() and ece_confidence_binary()

This resolves the syntax warnings that appeared when running tests,
such as: "SyntaxWarning: invalid escape sequence '\c'" which occurred
in LaTeX expressions like \frac and \cdot within the docstrings.
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.

SyntaxWarning: Invalid escape sequences in calibration.py docstrings

1 participant