types: narrow BenchResult.engine to GraphEngine, cast topology in engine_factory
Replace BenchResult.engine: object | None with GraphEngine | None via TYPE_CHECKING import (avoids circular import at runtime). Cast the topology argument to TopologyGraph at the GraphEngine call site for the duck-typed engine_factory. Fixes Pylance reportAttributeAccessIssue warnings on op_log and topology arg. Type annotations only; no runtime behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,9 +2,13 @@ from __future__ import annotations
|
||||
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from kernbench.common.types import Completion, Trace
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from kernbench.sim_engine.engine import GraphEngine
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BenchResult:
|
||||
@@ -12,7 +16,7 @@ class BenchResult:
|
||||
correlation_id: str
|
||||
trace: Trace | None = None
|
||||
traces: list[dict] | None = None
|
||||
engine: object | None = None # GraphEngine ref for Phase 2 data access
|
||||
engine: GraphEngine | None = None
|
||||
|
||||
def summary_text(self) -> str:
|
||||
if self.completion.ok:
|
||||
|
||||
Reference in New Issue
Block a user