From edb51fdd98a83a8d78f8a6d42ff5b5d5fdd8b996 Mon Sep 17 00:00:00 2001 From: Max Marrone Date: Thu, 26 Sep 2024 16:31:49 -0400 Subject: [PATCH] refactor(api): Hide implementation details from absorbance reader results (#16359) --- .../commands/absorbance_reader/__init__.py | 1 - .../commands/absorbance_reader/close_lid.py | 7 ++---- .../commands/absorbance_reader/open_lid.py | 9 ++----- .../commands/absorbance_reader/types.py | 25 ------------------- 4 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 api/src/opentrons/protocol_engine/commands/absorbance_reader/types.py diff --git a/api/src/opentrons/protocol_engine/commands/absorbance_reader/__init__.py b/api/src/opentrons/protocol_engine/commands/absorbance_reader/__init__.py index 09307e85230..2ed24ae23c3 100644 --- a/api/src/opentrons/protocol_engine/commands/absorbance_reader/__init__.py +++ b/api/src/opentrons/protocol_engine/commands/absorbance_reader/__init__.py @@ -1,5 +1,4 @@ """Command models for Absorbance Reader commands.""" -from .types import MoveLidResult from .close_lid import ( CloseLidCommandType, CloseLidParams, diff --git a/api/src/opentrons/protocol_engine/commands/absorbance_reader/close_lid.py b/api/src/opentrons/protocol_engine/commands/absorbance_reader/close_lid.py index f7d7b999104..b5131d76bcf 100644 --- a/api/src/opentrons/protocol_engine/commands/absorbance_reader/close_lid.py +++ b/api/src/opentrons/protocol_engine/commands/absorbance_reader/close_lid.py @@ -11,7 +11,6 @@ from opentrons.protocol_engine.types import AddressableAreaLocation from opentrons.protocol_engine.resources import labware_validation -from .types import MoveLidResult from ...state.update_types import StateUpdate @@ -34,7 +33,7 @@ class CloseLidParams(BaseModel): moduleId: str = Field(..., description="Unique ID of the absorbance reader.") -class CloseLidResult(MoveLidResult): +class CloseLidResult(BaseModel): """Result data from closing the lid on an aborbance reading.""" @@ -142,9 +141,7 @@ async def execute( ) return SuccessData( - public=CloseLidResult( - lidId=loaded_lid.id, newLocation=new_location, offsetId=new_offset_id - ), + public=CloseLidResult(), private=None, state_update=state_update, ) diff --git a/api/src/opentrons/protocol_engine/commands/absorbance_reader/open_lid.py b/api/src/opentrons/protocol_engine/commands/absorbance_reader/open_lid.py index 39fa4ce6ad4..7a048a69b52 100644 --- a/api/src/opentrons/protocol_engine/commands/absorbance_reader/open_lid.py +++ b/api/src/opentrons/protocol_engine/commands/absorbance_reader/open_lid.py @@ -9,7 +9,6 @@ from ...errors.error_occurrence import ErrorOccurrence from ...errors import CannotPerformModuleAction -from .types import MoveLidResult from opentrons.protocol_engine.resources import labware_validation from opentrons.protocol_engine.types import AddressableAreaLocation @@ -35,7 +34,7 @@ class OpenLidParams(BaseModel): moduleId: str = Field(..., description="Unique ID of the absorbance reader.") -class OpenLidResult(MoveLidResult): +class OpenLidResult(BaseModel): """Result data from opening the lid on an aborbance reading.""" @@ -137,11 +136,7 @@ async def execute(self, params: OpenLidParams) -> SuccessData[OpenLidResult, Non ) return SuccessData( - public=OpenLidResult( - lidId=loaded_lid.id, - newLocation=new_location, - offsetId=new_offset_id, - ), + public=OpenLidResult(), private=None, state_update=state_update, ) diff --git a/api/src/opentrons/protocol_engine/commands/absorbance_reader/types.py b/api/src/opentrons/protocol_engine/commands/absorbance_reader/types.py deleted file mode 100644 index 5595502d6a1..00000000000 --- a/api/src/opentrons/protocol_engine/commands/absorbance_reader/types.py +++ /dev/null @@ -1,25 +0,0 @@ -"""Move Lid Result model.""" - -from typing import Optional -from pydantic import BaseModel, Field -from opentrons.protocol_engine.types import LabwareLocation - - -class MoveLidResult(BaseModel): - """Input parameters to open the lid on an absorbance reading.""" - - lidId: str = Field(..., description="Unique ID of the absorbance reader lid.") - newLocation: LabwareLocation = Field(..., description="New location of the lid") - offsetId: Optional[str] = Field( - # Default `None` instead of `...` so this field shows up as non-required in - # OpenAPI. The server is allowed to omit it or make it null. - None, - description=( - "An ID referencing the labware offset that will apply to this labware" - " now that it's in the new location." - " This offset will be in effect until the labware is moved" - " with another `moveLabware` command." - " Null or undefined means no offset applies," - " so the default of (0, 0, 0) will be used." - ), - )