Pass mypy on loop_claude
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user