Coverage for adrs/search/grid.py: 93%
15 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-08-29 05:07 +0800
« prev ^ index » next coverage.py v7.15.2, created at 2026-08-29 05:07 +0800
1from itertools import product
2from typing import Sequence, override
4from adrs.search import Search, ParameterGrid, Permutation
7class GridSearch(Search):
8 def __init__(self):
9 pass
11 @staticmethod
12 def id() -> str:
13 return "gridsearch"
15 @override
16 def search(self, grid: ParameterGrid) -> Sequence[Permutation]:
17 return [dict(zip(grid, combo)) for combo in product(*grid.values())] # type: ignore
19 @override
20 def filter[T](self, permutations: Sequence[T]) -> Sequence[T]:
21 return permutations