-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'edge' of https://github.com/Opentrons/opentrons into pd…
…-flex-pipette-selection
- Loading branch information
Showing
57 changed files
with
1,755 additions
and
804 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
api/src/opentrons/protocol_engine/commands/dispense_in_place.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
api/src/opentrons/protocol_engine/commands/drop_tip_in_place.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
"""Drop tip in place command request, result, and implementation models.""" | ||
from __future__ import annotations | ||
from pydantic import Field, BaseModel | ||
from typing import TYPE_CHECKING, Optional, Type | ||
from typing_extensions import Literal | ||
|
||
from .pipetting_common import PipetteIdMixin | ||
from .command import AbstractCommandImpl, BaseCommand, BaseCommandCreate | ||
|
||
if TYPE_CHECKING: | ||
from ..execution import TipHandler | ||
|
||
|
||
DropTipInPlaceCommandType = Literal["dropTipInPlace"] | ||
|
||
|
||
class DropTipInPlaceParams(PipetteIdMixin): | ||
"""Payload required to drop a tip in place.""" | ||
|
||
homeAfter: Optional[bool] = Field( | ||
None, | ||
description=( | ||
"Whether to home this pipette's plunger after dropping the tip." | ||
" You should normally leave this unspecified to let the robot choose" | ||
" a safe default depending on its hardware." | ||
), | ||
) | ||
|
||
|
||
class DropTipInPlaceResult(BaseModel): | ||
"""Result data from the execution of a DropTipInPlace command.""" | ||
|
||
pass | ||
|
||
|
||
class DropTipInPlaceImplementation( | ||
AbstractCommandImpl[DropTipInPlaceParams, DropTipInPlaceResult] | ||
): | ||
"""Drop tip in place command implementation.""" | ||
|
||
def __init__( | ||
self, | ||
tip_handler: TipHandler, | ||
**kwargs: object, | ||
) -> None: | ||
self._tip_handler = tip_handler | ||
|
||
async def execute(self, params: DropTipInPlaceParams) -> DropTipInPlaceResult: | ||
"""Drop a tip using the requested pipette.""" | ||
await self._tip_handler.drop_tip( | ||
pipette_id=params.pipetteId, home_after=params.homeAfter | ||
) | ||
|
||
return DropTipInPlaceResult() | ||
|
||
|
||
class DropTipInPlace(BaseCommand[DropTipInPlaceParams, DropTipInPlaceResult]): | ||
"""Drop tip in place command model.""" | ||
|
||
commandType: DropTipInPlaceCommandType = "dropTipInPlace" | ||
params: DropTipInPlaceParams | ||
result: Optional[DropTipInPlaceResult] | ||
|
||
_ImplementationCls: Type[ | ||
DropTipInPlaceImplementation | ||
] = DropTipInPlaceImplementation | ||
|
||
|
||
class DropTipInPlaceCreate(BaseCommandCreate[DropTipInPlaceParams]): | ||
"""Drop tip in place command creation request model.""" | ||
|
||
commandType: DropTipInPlaceCommandType = "dropTipInPlace" | ||
params: DropTipInPlaceParams | ||
|
||
_CommandCls: Type[DropTipInPlace] = DropTipInPlace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""Test pick up tip commands.""" | ||
"""Test drop tip commands.""" | ||
import pytest | ||
from decoy import Decoy | ||
|
||
|
36 changes: 36 additions & 0 deletions
36
api/tests/opentrons/protocol_engine/commands/test_drop_tip_in_place.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Test drop tip in place commands.""" | ||
import pytest | ||
from decoy import Decoy | ||
|
||
from opentrons.protocol_engine.execution import TipHandler | ||
|
||
from opentrons.protocol_engine.commands.drop_tip_in_place import ( | ||
DropTipInPlaceParams, | ||
DropTipInPlaceResult, | ||
DropTipInPlaceImplementation, | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def mock_tip_handler(decoy: Decoy) -> TipHandler: | ||
"""Get a mock TipHandler.""" | ||
return decoy.mock(cls=TipHandler) | ||
|
||
|
||
async def test_drop_tip_implementation( | ||
decoy: Decoy, | ||
mock_tip_handler: TipHandler, | ||
) -> None: | ||
"""A DropTip command should have an execution implementation.""" | ||
subject = DropTipInPlaceImplementation(tip_handler=mock_tip_handler) | ||
|
||
params = DropTipInPlaceParams(pipetteId="abc", homeAfter=False) | ||
|
||
result = await subject.execute(params) | ||
|
||
assert result == DropTipInPlaceResult() | ||
|
||
decoy.verify( | ||
await mock_tip_handler.drop_tip(pipette_id="abc", home_after=False), | ||
times=1, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.