Skip to content

Commit

Permalink
refactor linting complete
Browse files Browse the repository at this point in the history
  • Loading branch information
TamarZanzouri committed Sep 23, 2024
1 parent 1fa4446 commit 6edf12a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
7 changes: 1 addition & 6 deletions api/src/opentrons/protocol_engine/state/labware.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,7 @@ def _set_labware_location(self, action: Action) -> None:
if new_offset_id != update_types.NO_CHANGE:
self._state.labware_by_id[labware_id].offsetId = new_offset_id

if (
action.state_update.labware_location.new_location
!= update_types.NO_CHANGE
):
if action.state_update.labware_location.new_location:
new_location = action.state_update.labware_location.new_location

if isinstance(
Expand All @@ -279,8 +276,6 @@ def _set_labware_location(self, action: Action) -> None:
# If a labware has been moved into a waste chute it's been chuted away and is now technically off deck
new_location = OFF_DECK_LOCATION

assert new_location != update_types.NO_CHANGE

self._state.labware_by_id[labware_id].location = new_location


Expand Down
25 changes: 8 additions & 17 deletions api/src/opentrons/protocol_engine/state/update_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class LabwareLocationUpdate:

labware_id: str

new_location: LabwareLocation | None | NoChangeType
new_location: LabwareLocation | None
"""The labware's new logical location.
Note: `new_location=None` means "change the location to `None` (unknown)",
Expand Down Expand Up @@ -168,23 +168,14 @@ def set_labware_location( # noqa: D102
self,
*,
labware_id: str,
new_location: LabwareLocation | None | NoChangeType = NO_CHANGE,
new_offset_id: str | None | NoChangeType = NO_CHANGE,
new_location: LabwareLocation,
new_offset_id: str | None,
) -> None:
if new_location != NO_CHANGE:
self.labware_location = LabwareLocationUpdate(
labware_id=labware_id,
new_location=new_location,
offset_id=new_offset_id,
)
else:
assert new_offset_id != NO_CHANGE

self.labware_location = LabwareLocationUpdate(
labware_id=labware_id,
offset_id=new_offset_id,
new_location=_NoChangeEnum.NO_CHANGE,
)
self.labware_location = LabwareLocationUpdate(
labware_id=labware_id,
new_location=new_location,
offset_id=new_offset_id,
)

def set_loaded_labware(
self,
Expand Down

0 comments on commit 6edf12a

Please sign in to comment.