Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(api): Enable more type-checking inside pipette_handler.py #16523

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
Sequence,
Iterator,
TypeVar,
overload,
)
import numpy

Expand Down Expand Up @@ -495,25 +494,12 @@ def plunger_flowrate(
ul_per_s = mm_per_s * instr.ul_per_mm(instr.liquid_class.max_volume, action)
return round(ul_per_s, 6)

@overload
def plan_check_aspirate(
self, mount: top_types.Mount, volume: Optional[float], rate: float
) -> Optional[LiquidActionSpec]:
...

@overload
def plan_check_aspirate(
self, mount: OT3Mount, volume: Optional[float], rate: float
) -> Optional[LiquidActionSpec]:
...

# note on this type ignore: see motion_utilities
def plan_check_aspirate( # type: ignore[no-untyped-def]
self,
mount,
volume,
rate,
):
mount: MountType,
volume: Optional[float],
rate: float,
) -> Optional[LiquidActionSpec]:
"""Check preconditions for aspirate, parse args, and calculate positions.

While the mechanics of issuing an aspirate move itself are left to child
Expand Down Expand Up @@ -572,28 +558,12 @@ def plan_check_aspirate( # type: ignore[no-untyped-def]
current=instrument.plunger_motor_current.run,
)

@overload
def plan_check_dispense(
self,
mount: top_types.Mount,
volume: Optional[float],
rate: float,
push_out: Optional[float],
) -> Optional[LiquidActionSpec]:
...

@overload
def plan_check_dispense(
self,
mount: OT3Mount,
mount: MountType,
volume: Optional[float],
rate: float,
push_out: Optional[float],
) -> Optional[LiquidActionSpec]:
...

def plan_check_dispense( # type: ignore[no-untyped-def]
self, mount, volume, rate, push_out
) -> Optional[LiquidActionSpec]:
"""Check preconditions for dispense, parse args, and calculate positions.

Expand Down Expand Up @@ -687,15 +657,7 @@ def plan_check_dispense( # type: ignore[no-untyped-def]
current=instrument.plunger_motor_current.run,
)

@overload
def plan_check_blow_out(self, mount: top_types.Mount) -> LiquidActionSpec:
...

@overload
def plan_check_blow_out(self, mount: OT3Mount) -> LiquidActionSpec:
...

def plan_check_blow_out(self, mount): # type: ignore[no-untyped-def]
def plan_check_blow_out(self, mount: MountType) -> LiquidActionSpec:
"""Check preconditions and calculate values for blowout."""
instrument = self.get_pipette(mount)
speed = self.plunger_speed(
Expand Down Expand Up @@ -743,33 +705,13 @@ def build_one_shake() -> List[Tuple[top_types.Point, Optional[float]]]:
else:
return []

@overload
def plan_check_pick_up_tip(
self,
mount: top_types.Mount,
presses: Optional[int],
increment: Optional[float],
tip_length: float = 0,
) -> Tuple[PickUpTipSpec, Callable[[], None]]:
...

@overload
def plan_check_pick_up_tip(
self,
mount: OT3Mount,
mount: MountType,
presses: Optional[int],
increment: Optional[float],
tip_length: float = 0,
) -> Tuple[PickUpTipSpec, Callable[[], None]]:
...

def plan_check_pick_up_tip( # type: ignore[no-untyped-def]
self,
mount,
presses,
increment,
tip_length=0,
):
# Prechecks: ready for pickup tip and press/increment are valid
instrument = self.get_pipette(mount)
if instrument.has_tip:
Expand Down Expand Up @@ -917,25 +859,13 @@ def build() -> List[DropTipMove]:

return build

@overload
def plan_check_drop_tip(
self, mount: top_types.Mount, home_after: bool
) -> Tuple[DropTipSpec, Callable[[], None]]:
...

@overload
def plan_check_drop_tip(
self, mount: OT3Mount, home_after: bool
) -> Tuple[DropTipSpec, Callable[[], None]]:
...

# todo(mm, 2024-10-17): The returned _remove_tips() callable is not used by anything
# anymore. Delete it.
def plan_check_drop_tip( # type: ignore[no-untyped-def]
def plan_check_drop_tip(
self,
mount,
home_after,
):
mount: MountType,
home_after: bool,
) -> Tuple[DropTipSpec, Callable[[], None]]:
instrument = self.get_pipette(mount)

if not instrument.drop_configurations.plunger_eject:
Expand Down
Loading