Answer principles round 1: 0 🔴, 5 🟡 (0 misread); make a move a union with ToStatus, take only parsed events in figures, catch OSError at each file operation, pass progress through the bench, type the sides, and split the README bullet
CI / tests (pull_request) Successful in 5m4s
CI / tests (pull_request) Successful in 5m4s
This commit is contained in:
@@ -84,9 +84,14 @@ def parse_entry(raw: str | bytes) -> Entry | None:
|
||||
return None if found is None else entry_from(found)
|
||||
|
||||
|
||||
def json_objects(raw: bytes) -> list[dict]:
|
||||
"""The lines of a transcript or a stream-json stream that are JSON objects, parsed."""
|
||||
return [found for line in raw.splitlines() if (found := json_object(line))]
|
||||
|
||||
|
||||
def entries_of(raw: bytes) -> list[Entry]:
|
||||
"""The entries of a transcript or a stream-json stream, one per line that is a JSON object."""
|
||||
return [entry for line in raw.splitlines() if (entry := parse_entry(line))]
|
||||
return [entry_from(found) for found in json_objects(raw)]
|
||||
|
||||
|
||||
def entry_from(found: dict) -> Entry:
|
||||
|
||||
Reference in New Issue
Block a user