Skip to content

Commit c62ea52

Browse files
authored
location of child resources is optional (#336)
2 parents 02c6728 + b6ab26f commit c62ea52

File tree

6 files changed

+10
-6
lines changed

6 files changed

+10
-6
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5757
- resource_offset -> pickup_offset
5858
- get_direction -> pickup_direction
5959
- put_direction -> drop_direction
60+
- `location` parameter of `assign_child_resource` is not optional (https://github.com/PyLabRobot/pylabrobot/pull/336)
6061

6162
### Added
6263

pylabrobot/liquid_handling/liquid_handler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2172,7 +2172,7 @@ async def move_channel_z(self, channel: int, z: float):
21722172
def assign_child_resource(
21732173
self,
21742174
resource: Resource,
2175-
location: Coordinate,
2175+
location: Optional[Coordinate],
21762176
reassign: bool = True,
21772177
):
21782178
"""Not implement on LiquidHandler, since the deck is managed by the :attr:`deck` attribute."""

pylabrobot/resources/carrier.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def capacity(self):
5555
def assign_child_resource(
5656
self,
5757
resource: Resource,
58-
location: Coordinate,
58+
location: Optional[Coordinate],
5959
reassign: bool = True,
6060
spot: Optional[int] = None,
6161
):

pylabrobot/resources/opentrons/deck.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def _assign_trash(self):
7575
def assign_child_resource(
7676
self,
7777
resource: Resource,
78-
location: Coordinate,
78+
location: Optional[Coordinate],
7979
reassign: bool = True,
8080
):
8181
"""Assign a resource to a slot.
@@ -84,6 +84,9 @@ def assign_child_resource(
8484
:meth:`assign_child_at_slot` instead.
8585
"""
8686

87+
if location is None:
88+
raise ValueError("location must be provided for resources on the deck")
89+
8790
if location not in self.slot_locations:
8891
super().assign_child_resource(resource, location=location)
8992
else:

pylabrobot/resources/petri_dish.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __init__(
7171
def assign_child_resource(
7272
self,
7373
resource: Resource,
74-
location: Coordinate,
74+
location: Optional[Coordinate],
7575
reassign: bool = True,
7676
):
7777
"""Can only assign a single PetriDish"""

pylabrobot/resources/resource.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def get_absolute_size_z(self) -> float:
268268
def assign_child_resource(
269269
self,
270270
resource: Resource,
271-
location: Coordinate,
271+
location: Optional[Coordinate],
272272
reassign: bool = True,
273273
):
274274
"""Assign a child resource to this resource.
@@ -282,7 +282,7 @@ def assign_child_resource(
282282
283283
Args:
284284
resource: The resource to assign.
285-
location: The location of the resource, relative to this resource.
285+
location: The location of the resource, relative to this resource. None if undefined.
286286
reassign: If `False`, an error will be raised if the resource to be assigned is already
287287
assigned to this resource. Defaults to `True`.
288288
"""

0 commit comments

Comments
 (0)