11import functools
22import warnings
33from collections .abc import Callable , Generator , Mapping , Sequence
4- from typing import Any , cast
4+ from typing import Any , TypeVar , cast
55
66import bluesky .plan_stubs as bps
77import bluesky .plans as bp
8- from ax .api .types import TParameterization
98from bluesky .protocols import Movable , NamedMovable , Readable , Reading
109from bluesky .utils import Msg , MsgGenerator , plan
1110from ophyd import Signal # type: ignore[import-untyped]
1211
1312from .dofs import DOF
1413from .protocols import OptimizationProblem
1514
15+ _NamedMovableT = TypeVar ("_NamedMovableT" , bound = NamedMovable )
1616
17- def _unpack_for_list_scan (movables : Mapping [NamedMovable , Sequence [Any ]]) -> list [NamedMovable | Any ]:
17+
18+ def _unpack_for_list_scan (movables : Mapping [_NamedMovableT , Sequence [Any ]]) -> list [_NamedMovableT | Any ]:
1819 """Unpack the movables and inputs into Bluesky list_scan plan arguments."""
1920 unpacked_list = []
2021 for movable , values in movables .items ():
@@ -26,7 +27,7 @@ def _unpack_for_list_scan(movables: Mapping[NamedMovable, Sequence[Any]]) -> lis
2627
2728@plan
2829def default_acquire (
29- movables : Mapping [NamedMovable , Sequence [Any ]],
30+ movables : Mapping [_NamedMovableT , Sequence [Any ]],
3031 readables : Sequence [Readable ] | None = None ,
3132 * ,
3233 per_step : bp .PerStep | None = None ,
@@ -37,12 +38,10 @@ def default_acquire(
3738
3839 Parameters
3940 ----------
40- movables: Mapping[NamedMovable , Sequence[Any]]
41+ movables: Mapping[_NamedMovableT , Sequence[Any]]
4142 The movables to move and the inputs to move them to.
4243 readables: Sequence[Readable]
4344 The readables to trigger and read.
44- trials: dict[int, TParameterization]
45- A dictionary mapping trial indices to their suggested parameterizations. Typically only a single trial is provided.
4645 per_step: bp.PerStep | None = None
4746 The plan to execute for each step of the scan.
4847 **kwargs: Any
@@ -310,7 +309,7 @@ def per_step_background_read(
310309
311310@plan
312311def acquire_with_background (
313- movables : Mapping [NamedMovable , Sequence [Any ]],
312+ movables : Mapping [_NamedMovableT , Sequence [Any ]],
314313 readables : Sequence [Readable ] | None = None ,
315314 * ,
316315 block_beam : Callable [[], MsgGenerator [None ]],
@@ -322,7 +321,7 @@ def acquire_with_background(
322321
323322 Parameters
324323 ----------
325- movables: Mapping[NamedMovable , Sequence[Any]]
324+ movables: Mapping[_NamedMovableT , Sequence[Any]]
326325 The movables and the inputs to move them to.
327326 readables: Sequence[Readable] | None = None
328327 The readables that produce data to evaluate.
0 commit comments