11import uuid
22from collections .abc import Generator
3- from typing import Any , TypeVar , cast
3+ from typing import Any
44
55from bluesky import plan_stubs as bps
66from bluesky .preprocessors import finalize_wrapper , pchain
77from bluesky .utils import Msg , MsgGenerator , make_decorator
88from ophyd_async .core import Device
99from ophyd_async .epics .motor import Motor
1010
11- from dodal .utils import MovableReadable
12-
13- MovableReadableDevice = TypeVar ("MovableReadableDevice" , bound = MovableReadable )
14-
1511
1612class MoveTooLarge (Exception ):
1713 def __init__ (
18- self , axis : MovableReadable , maximum_move : float , position : float , * args : object
14+ self ,
15+ axis : Motor ,
16+ maximum_move : float ,
17+ position : float ,
18+ * args : object ,
1919 ) -> None :
2020 self .axis = axis
2121 self .maximum_move = maximum_move
@@ -24,10 +24,10 @@ def __init__(
2424
2525
2626def check_and_cache_values (
27- devices_and_positions : dict [MovableReadableDevice , float ],
27+ devices_and_positions : dict [Motor , float ],
2828 smallest_move : float ,
2929 maximum_move : float ,
30- ) -> Generator [Msg , Any , dict [MovableReadableDevice , float ]]:
30+ ) -> Generator [Msg , Any , dict [Motor , float ]]:
3131 """Caches the positions of all Motors on specified device if they are within
3232 smallest_move of home_position. Throws MoveTooLarge if they are outside maximum_move
3333 of the home_position
@@ -51,9 +51,7 @@ def home_and_reset_wrapper(
5151 wait_for_all : bool = True ,
5252) -> MsgGenerator :
5353 home_positions = {
54- cast (MovableReadable , axis ): 0.0
55- for _ , axis in device .children ()
56- if isinstance (axis , Motor )
54+ axis : 0.0 for _ , axis in device .children () if isinstance (axis , Motor )
5755 }
5856 return move_and_reset_wrapper (
5957 plan , home_positions , smallest_move , maximum_move , group , wait_for_all
@@ -62,7 +60,7 @@ def home_and_reset_wrapper(
6260
6361def move_and_reset_wrapper (
6462 plan : MsgGenerator ,
65- device_and_positions : dict [MovableReadable , float ],
63+ device_and_positions : dict [Motor , float ],
6664 smallest_move : float ,
6765 maximum_move : float ,
6866 group : str | None = None ,
0 commit comments