opentrons 8.5.0a4__py2.py3-none-any.whl → 8.5.0a7__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of opentrons might be problematic. Click here for more details.

@@ -1,5 +1,5 @@
1
1
  from dataclasses import dataclass
2
- from typing import List, Union, Sequence, Optional
2
+ from typing import List, Union, Sequence, Optional, Tuple
3
3
 
4
4
  from opentrons.types import Location, NozzleMapInterface
5
5
  from opentrons.protocols.api_support import instrument
@@ -13,6 +13,7 @@ from opentrons.protocols.advanced_control.transfers.common import (
13
13
 
14
14
  from .disposal_locations import TrashBin, WasteChute
15
15
  from .labware import Labware, Well
16
+ from .core.common import WellCore
16
17
  from . import validation
17
18
 
18
19
 
@@ -24,13 +25,14 @@ class TransferInfo:
24
25
  tip_policy: TransferTipPolicyV2
25
26
  tip_racks: List[Labware]
26
27
  trash_location: Union[Location, TrashBin, WasteChute]
28
+ last_tip_location: Optional[Tuple[Location, WellCore]]
27
29
 
28
30
 
29
31
  def verify_and_normalize_transfer_args(
30
32
  source: Union[Well, Sequence[Well], Sequence[Sequence[Well]]],
31
33
  dest: Union[Well, Sequence[Well], Sequence[Sequence[Well]], TrashBin, WasteChute],
32
34
  tip_policy: TransferTipPolicyV2Type,
33
- last_tip_picked_up_from: Optional[Well],
35
+ last_tip_well: Optional[Well],
34
36
  tip_racks: List[Labware],
35
37
  nozzle_map: NozzleMapInterface,
36
38
  group_wells_for_multi_channel: bool,
@@ -45,10 +47,10 @@ def verify_and_normalize_transfer_args(
45
47
  flat_dests_list = []
46
48
  if group_wells_for_multi_channel and nozzle_map.tip_count > 1:
47
49
  flat_sources_list = tx_liquid_utils.group_wells_for_multi_channel_transfer(
48
- flat_sources_list, nozzle_map
50
+ flat_sources_list, nozzle_map, "source"
49
51
  )
50
52
  flat_dests_list = tx_liquid_utils.group_wells_for_multi_channel_transfer(
51
- flat_dests_list, nozzle_map
53
+ flat_dests_list, nozzle_map, "destination"
52
54
  )
53
55
  for well in flat_sources_list + flat_dests_list:
54
56
  instrument.validate_takes_liquid(
@@ -59,14 +61,14 @@ def verify_and_normalize_transfer_args(
59
61
 
60
62
  valid_new_tip = validation.ensure_new_tip_policy(tip_policy)
61
63
  if valid_new_tip == TransferTipPolicyV2.NEVER:
62
- if last_tip_picked_up_from is None:
64
+ if last_tip_well is None:
63
65
  raise RuntimeError(
64
66
  "Pipette has no tip attached to perform transfer."
65
67
  " Either do a pick_up_tip beforehand or specify a new_tip parameter"
66
68
  " of 'once' or 'always'."
67
69
  )
68
70
  else:
69
- valid_tip_racks = [last_tip_picked_up_from.parent]
71
+ valid_tip_racks = [last_tip_well.parent]
70
72
  else:
71
73
  valid_tip_racks = tip_racks
72
74
  if current_volume != 0:
@@ -86,10 +88,33 @@ def verify_and_normalize_transfer_args(
86
88
  trash_location=_trash_location
87
89
  )
88
90
 
91
+ if last_tip_well is not None:
92
+ parent_tip_rack = last_tip_well.parent
93
+ last_tip_location = (
94
+ Location(last_tip_well.top().point, parent_tip_rack),
95
+ last_tip_well._core,
96
+ )
97
+ else:
98
+ last_tip_location = None
99
+
89
100
  return TransferInfo(
90
101
  source=flat_sources_list,
91
102
  dest=flat_dests_list if not isinstance(dest, (TrashBin, WasteChute)) else dest,
92
103
  tip_policy=valid_new_tip,
93
104
  tip_racks=valid_tip_racks,
94
105
  trash_location=valid_trash_location,
106
+ last_tip_location=last_tip_location,
95
107
  )
108
+
109
+
110
+ def resolve_keep_last_tip(
111
+ keep_last_tip: Optional[bool], tip_strategy: TransferTipPolicyV2
112
+ ) -> bool:
113
+ """Resolve the liquid class transfer argument `keep_last_tip`
114
+
115
+ If set to a boolean value, maintains that setting. Otherwise, default to
116
+ `True` if tip policy is `NEVER`, otherwise default to `False`
117
+ """
118
+ if keep_last_tip is not None:
119
+ return keep_last_tip
120
+ return tip_strategy == TransferTipPolicyV2.NEVER