Problem
pyhealth/tasks/cardiology_detect.py uses bare open().readlines() calls in 5 places (lines 76, 172, 266, 360, 454). These rely on CPython reference counting for file handle cleanup, which is not guaranteed across all Python implementations.
Solution
Replace label_content = open(path, "r").readlines() with:
with open(path, "r") as f:
label_content = f.readlines()
Affected Files
- pyhealth/tasks/cardiology_detect.py (5 occurrences)
Problem
pyhealth/tasks/cardiology_detect.pyuses bareopen().readlines()calls in 5 places (lines 76, 172, 266, 360, 454). These rely on CPython reference counting for file handle cleanup, which is not guaranteed across all Python implementations.Solution
Replace
label_content = open(path, "r").readlines()with:Affected Files