Skip to content

fix: clean up __init__.py exports and fix invalid escape sequence#938

Open
haoyu-haoyu wants to merge 1 commit intosunlabuiuc:masterfrom
haoyu-haoyu:fix/init-exports-and-escapes
Open

fix: clean up __init__.py exports and fix invalid escape sequence#938
haoyu-haoyu wants to merge 1 commit intosunlabuiuc:masterfrom
haoyu-haoyu:fix/init-exports-and-escapes

Conversation

@haoyu-haoyu
Copy link
Copy Markdown
Contributor

Summary

Three housekeeping fixes found via codebase audit:

1. pyhealth/models/__init__.py

  • Remove duplicate import: MedLink was imported on both line 18 and line 45
  • Sort imports alphabetically for consistency and easier maintenance
  • Add __all__ list (47 entries) to make the public API explicit — previously all imports were implicitly exported, making the API surface unclear for IDE autocompletion and from pyhealth.models import *

2. pyhealth/processors/__init__.py

  • Add 7 missing processors to __all__: BinaryLabelProcessor, MultiClassLabelProcessor, MultiLabelProcessor, RegressionLabelProcessor, DeepNestedFloatsProcessor, DeepNestedSequenceProcessor, IgnoreProcessor
  • Remove non-existent entry: "LabelProcessor" was in __all__ but no such class exists (the actual classes are BinaryLabelProcessor, MultiClassLabelProcessor, etc.)
  • Sort entries alphabetically

3. pyhealth/metrics/calibration.py

  • Fix invalid escape sequence \c (backslash-c) in docstring LaTeX formula → \\cdot
  • This triggers DeprecationWarning in Python 3.12 and will become SyntaxError in Python 3.14

All changes are non-behavioral (imports, exports, docstrings only).

models/__init__.py:
- Remove duplicate MedLink import (was on lines 18 and 45)
- Sort imports alphabetically for consistency
- Add __all__ list to make the public API explicit

processors/__init__.py:
- Add 6 missing processors to __all__: BinaryLabelProcessor,
  MultiClassLabelProcessor, MultiLabelProcessor,
  RegressionLabelProcessor, DeepNestedFloatsProcessor,
  DeepNestedSequenceProcessor, IgnoreProcessor
- Remove non-existent "LabelProcessor" from __all__
- Sort __all__ entries alphabetically

metrics/calibration.py:
- Fix invalid escape sequence \c (backslash-c) in docstring
  math formula -- use \\cdot for LaTeX multiplication dot
  (triggers DeprecationWarning in Python 3.12, SyntaxError in 3.14)
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