Answer architecture round 1: 2 🔴, 8 🟡 (0 misread); split task-bench's benched into phases and its table into one column list, parse each stream once, move do-epic's parking out with pure move and news decisions, share the round summaries, rename scoring_due, and file the version question as item 517
CI / tests (pull_request) Successful in 5m2s
CI / tests (pull_request) Successful in 5m2s
This commit is contained in:
@@ -86,6 +86,23 @@ def mutated(source: bytes, mutant: Mutant) -> bytes | None:
|
||||
return b"\n".join(lines)
|
||||
|
||||
|
||||
def bug_at_sides(mutant: Mutant, diff: str, sources: dict[str, bytes | None]) -> dict[str, bytes] | None:
|
||||
"""The file of mutant with the bug in it, at the base and at the head, from the file at each side, None where the side has
|
||||
none, and the diff of it from base to head. None where the mutant doesn't become a bug at one side or the other.
|
||||
|
||||
The bug is the same change to the same line at both sides, so only the code around it differs between them."""
|
||||
at_head = line_at_head(diff, mutant.line)
|
||||
if at_head is None:
|
||||
return None
|
||||
bugs = {}
|
||||
for side, placed in (("base", mutant), ("head", mutant._replace(line=at_head))):
|
||||
changed = None if (source := sources[side]) is None else mutated(source, placed)
|
||||
if changed is None:
|
||||
return None
|
||||
bugs[side] = changed
|
||||
return bugs
|
||||
|
||||
|
||||
def line_at_head(diff: str, line: int) -> int | None:
|
||||
"""The number at the head of a file's line `line` at the base, or None where the head changed or removed that line.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user