Skip to content

Commit

Permalink
remove needlessly fancy filtering with lambda function
Browse files Browse the repository at this point in the history
  • Loading branch information
sanni-t committed Oct 17, 2024
1 parent f1e8ffa commit 29795ab
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions api/src/opentrons/protocol_api/_liquid.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,20 @@ def display_name(self) -> str:

def get_for(self, pipette: str, tiprack: str) -> TransferProperties:
"""Get liquid class transfer properties for the specified pipette and tip."""
settings_for_pipette: Sequence[ByPipetteSetting] = list(
filter(
lambda pip_setting: pip_setting.pipetteModel == pipette,
self._by_pipette_setting,
)
)
settings_for_pipette: Sequence[ByPipetteSetting] = [
pip_setting
for pip_setting in self._by_pipette_setting
if pip_setting.pipetteModel == pipette
]
if len(settings_for_pipette) == 0:
raise ValueError(
f"No properties found for {pipette} in {self._name} liquid class"
)
settings_for_tip: Sequence[ByTipTypeSetting] = list(
filter(
lambda tip_setting: tip_setting.tiprack == tiprack,
settings_for_pipette[0].byTipType,
)
)
settings_for_tip: Sequence[ByTipTypeSetting] = [
tip_setting
for tip_setting in settings_for_pipette[0].byTipType
if tip_setting.tiprack == tiprack
]
if len(settings_for_tip) == 0:
raise ValueError(
f"No properties found for {tiprack} in {self._name} liquid class"
Expand Down

0 comments on commit 29795ab

Please sign in to comment.