Summary
_atomic_write_text is defined twice in cli/main.py (lines 138 and 519). The second definition shadows the first, making it dead code.
Problem
Line 138:
def _atomic_write_text(path: Path, content: str) -> None:
# wraps OSError in ConfigIOError
Line 519:
def _atomic_write_text(path: Path, content: str, encoding: str = "utf-8") -> None:
# raises bare OSError
Python uses the last definition in module scope. Callers at lines 202, 218, 556, 1037 all hit the second version. The ConfigIOError wrapping at line 138 never fires.
Suggested fix
Delete the first definition (line 138-159). Keep the second (line 519-534) which has the encoding parameter and is the one actually used. Alternatively, consolidate both into a single function with the encoding parameter and ConfigIOError wrapping.
Files involved
- cli/main.py (lines 138-159, 519-534)
Summary
_atomic_write_textis defined twice in cli/main.py (lines 138 and 519). The second definition shadows the first, making it dead code.Problem
Line 138:
Line 519:
Python uses the last definition in module scope. Callers at lines 202, 218, 556, 1037 all hit the second version. The
ConfigIOErrorwrapping at line 138 never fires.Suggested fix
Delete the first definition (line 138-159). Keep the second (line 519-534) which has the encoding parameter and is the one actually used. Alternatively, consolidate both into a single function with the encoding parameter and
ConfigIOErrorwrapping.Files involved