Answer product-owner round 1: 0 🔴, 1 🟡 (0 misread); stamp the transcript and trust lines through say
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import hashlib
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import typing
|
||||
|
||||
from transcript_archive.location import chunk_folder, outcomes_of
|
||||
from failure import Failure
|
||||
@@ -11,8 +11,8 @@ from transcript_archive.outcomes import TASK
|
||||
from utc_stamp import utc
|
||||
|
||||
|
||||
def archive(project_archive: pathlib.Path, path: str, task: str, outcome: str, at: float) -> Failure | None:
|
||||
"""Keeps the transcript at path, its outcomes file and its session's files in project_archive, in the layout this package's docstring gives; the failure that stopped it, or None. The outcome is stamped and appended to the outcomes file, which opens with the task only when the copy is new."""
|
||||
def archive(project_archive: pathlib.Path, path: str, task: str, outcome: str, at: float, note: typing.Callable[[str], None] = lambda text: None) -> Failure | None:
|
||||
"""Keeps the transcript at path, its outcomes file and its session's files in project_archive, in the layout this package's docstring gives; the failure that stopped it, or None. The outcome is stamped and appended to the outcomes file, which opens with the task only when the copy is new. Where a new copy lands, note is told where."""
|
||||
try:
|
||||
with open(path, "rb") as handle:
|
||||
raw = handle.read()
|
||||
@@ -32,7 +32,7 @@ def archive(project_archive: pathlib.Path, path: str, task: str, outcome: str, a
|
||||
for dest, data in ((outcomes, f"{TASK}{task}\n\n{stamped}\n".encode()), (copy, raw)):
|
||||
if unwritten := replace_file(dest, data):
|
||||
return unarchived(dest, unwritten.reason)
|
||||
print(f"transcript: {copy}", file=sys.stderr)
|
||||
note(f"transcript: {copy}")
|
||||
return None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user