Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Commit cd8118e

Browse files
committed
fix: tighten _to_int typing for curated mypy
1 parent 4d8f976 commit cd8118e

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/app/workflow.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,19 @@ def log_diff_report_summary(diff_report: dict[str, object], logger: logging.Logg
170170
def _to_int(value: object) -> int | None:
171171
if value is None:
172172
return None
173-
try:
173+
if isinstance(value, bool):
174+
return int(value)
175+
if isinstance(value, int):
176+
return value
177+
if isinstance(value, float):
174178
return int(value)
179+
if isinstance(value, (str, bytes, bytearray)):
180+
try:
181+
return int(value)
182+
except ValueError:
183+
return None
184+
try:
185+
return int(str(value))
175186
except (TypeError, ValueError):
176187
return None
177188

0 commit comments

Comments
 (0)