sway: thread typed Section through RunContext + runner
- SHA
79552feb88edb4918768a3d3fb5057712ec6dd90- Parents
-
31ea572 - Tree
2695e0d
79552fe
79552feb88edb4918768a3d3fb5057712ec6dd9031ea572
2695e0d| Status | File | + | - |
|---|---|---|---|
| M |
src/dlm_sway/probes/base.py
|
2 | 1 |
| M |
src/dlm_sway/suite/runner.py
|
3 | 3 |
src/dlm_sway/probes/base.pymodified@@ -24,6 +24,7 @@ from pydantic import BaseModel, ConfigDict, ValidationError | ||
| 24 | 24 | from dlm_sway.core.errors import SpecValidationError |
| 25 | 25 | from dlm_sway.core.result import ProbeResult |
| 26 | 26 | from dlm_sway.core.scoring import DifferentialBackend |
| 27 | +from dlm_sway.core.sections import Section | |
| 27 | 28 | |
| 28 | 29 | |
| 29 | 30 | class ProbeSpec(BaseModel): |
@@ -70,7 +71,7 @@ class RunContext: | ||
| 70 | 71 | backend: DifferentialBackend |
| 71 | 72 | seed: int = 0 |
| 72 | 73 | top_k: int = 256 |
| 73 | - sections: tuple[Any, ...] | None = None | |
| 74 | + sections: tuple[Section, ...] | None = None | |
| 74 | 75 | doc_text: str | None = None |
| 75 | 76 | null_stats: dict[str, dict[str, float]] = field(default_factory=dict) |
| 76 | 77 | |
src/dlm_sway/suite/runner.pymodified@@ -19,12 +19,12 @@ Runtime contract: | ||
| 19 | 19 | from __future__ import annotations |
| 20 | 20 | |
| 21 | 21 | import time |
| 22 | -from typing import Any | |
| 23 | 22 | |
| 24 | 23 | from dlm_sway import __version__ |
| 25 | 24 | from dlm_sway.core.errors import ProbeError |
| 26 | 25 | from dlm_sway.core.result import ProbeResult, SuiteResult, Verdict, utcnow |
| 27 | 26 | from dlm_sway.core.scoring import DifferentialBackend |
| 27 | +from dlm_sway.core.sections import Section | |
| 28 | 28 | from dlm_sway.probes.base import RunContext, build_probe |
| 29 | 29 | from dlm_sway.probes.null_adapter import NullAdapterSpec, get_null_stats |
| 30 | 30 | from dlm_sway.suite.spec import SwaySpec |
@@ -36,7 +36,7 @@ def run( | ||
| 36 | 36 | *, |
| 37 | 37 | spec_path: str = "<memory>", |
| 38 | 38 | doc_text: str | None = None, |
| 39 | - sections: tuple[Any, ...] | None = None, | |
| 39 | + sections: tuple[Section, ...] | None = None, | |
| 40 | 40 | ) -> SuiteResult: |
| 41 | 41 | """Execute every probe in ``spec`` against ``backend``.""" |
| 42 | 42 | started = utcnow() |
@@ -133,4 +133,4 @@ def _with_duration(result: ProbeResult, duration: float) -> ProbeResult: | ||
| 133 | 133 | ) |
| 134 | 134 | |
| 135 | 135 | |
| 136 | -__all__ = ["run", "get_null_stats"] | |
| 136 | +__all__ = ["get_null_stats", "run"] | |