Gzip loop-claude's archive and the review folders 30 days after each file was last written, and read gzipped files by their plain name
CI / tests (pull_request) Failing after 2m59s
CI / tests (pull_request) Failing after 2m59s
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import io
|
||||
import json
|
||||
import pathlib
|
||||
import typing
|
||||
|
||||
from claude_code.entries import AssistantTurn, Entry, HumanTurn, LoopPrompt, parse_entry, Text, ToolCall
|
||||
from failure import Failure
|
||||
from text_files.compressed import read_stored
|
||||
|
||||
JUDGED_TOOL_INPUT = 400
|
||||
|
||||
@@ -14,9 +17,9 @@ class Typed(typing.NamedTuple):
|
||||
|
||||
|
||||
def read_transcript(path: str) -> list[Entry] | Failure:
|
||||
"""The entries of the transcript at path, or of its gzip where the archive compressed it."""
|
||||
try:
|
||||
with open(path, "rb") as handle:
|
||||
return [entry for raw in handle if (entry := parse_entry(raw))]
|
||||
return [entry for raw in io.BytesIO(read_stored(pathlib.Path(path))) if (entry := parse_entry(raw))]
|
||||
except OSError as failure:
|
||||
return Failure(f"could not read the transcript {path}: {failure.strerror}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user