Pass mypy on loop_claude

This commit is contained in:
2026-09-29 15:47:41 +02:00
parent 099e9e19a5
commit 6e643cc87c
10 changed files with 18 additions and 17 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ def archive(project, path, note, paths) -> Failure | None:
# The copy lands last, so a copy on disk always has its verdict beside it.
if not copy.exists():
for dest, data in ((copy.with_suffix(".verdict.md"), f"{note}\n".encode()), (copy, raw)):
if failure := replace_file(dest, data):
return Failure(f"could not archive the transcript: {dest}: {failure.reason}")
if unwritten := replace_file(dest, data):
return Failure(f"could not archive the transcript: {dest}: {unwritten.reason}")
print(f"transcript: {copy}", file=sys.stderr)
return None
+3 -2
View File
@@ -1,4 +1,3 @@
import itertools
import sys
import time
import typing
@@ -9,7 +8,9 @@ T = typing.TypeVar("T")
def retried(who, attempt: typing.Callable[[], T | Failure]) -> T | Stop:
for failures in itertools.count(1):
failures = 0
while True:
failures += 1
result = attempt()
if not isinstance(result, Failure):
return result
+1 -1
View File
@@ -12,7 +12,7 @@ def run_worker(root, args) -> Failure | None:
return Failure(f"could not start claude: {failure.strerror}")
with proc:
done = False
for raw in proc.stdout:
for raw in proc.stdout or ():
event = parse(raw) or {}
done = done or ends_stream(event)
for part in assistant_parts(event):