Skip to content

Commit a3f1c5c

Browse files
committed
relax the checks
1 parent 15a6a27 commit a3f1c5c

File tree

6 files changed

+11
-17
lines changed

6 files changed

+11
-17
lines changed

pylabrobot/liquid_handling/liquid_handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,6 +2326,7 @@ async def move_resource(
23262326
)
23272327
drop_kwargs = {k: v for k, v in backend_kwargs.items() if k not in extra}
23282328

2329+
print("moving to", to)
23292330
await self.drop_resource(
23302331
destination=to,
23312332
offset=destination_offset,

pylabrobot/plate_reading/byonoy/byonoy_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ async def test_move_reader_to_base(self):
2727
await self.lh.move_resource(self.reader, to=Coordinate(x=400, y=209.995, z=100))
2828

2929
# move reader to base
30+
print("moving")
3031
await self.lh.move_resource(
3132
self.reader,
3233
self.base.reader_holder,

pylabrobot/resources/carrier.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ def __init__(
151151
class PlateHolder(ResourceHolder):
152152
"""A single site within a plate carrier."""
153153

154-
_accepted_child_types = (Plate, PlateAdapter, Lid)
155-
156154
def __init__(
157155
self,
158156
name: str,
@@ -192,11 +190,6 @@ def assign_child_resource(
192190
"If a ResourceStack is assigned to a PlateHolder, the items "
193191
+ f"must be Plates, not {type(resource.children[-1])}"
194192
)
195-
elif not isinstance(resource, self._accepted_child_types):
196-
raise TypeError(
197-
"PlateHolder can only store Plate, PlateAdapter or ResourceStack "
198-
+ f"resources, not {type(resource)}"
199-
)
200193
if isinstance(resource, Plate) and resource.plate_type != "skirted":
201194
raise ValueError("PlateHolder can only store plates that are skirted")
202195
return super().assign_child_resource(resource, location, reassign)
@@ -256,15 +249,6 @@ def serialize(self) -> dict:
256249
"pedestal_size_z": self.pedestal_size_z,
257250
}
258251

259-
def check_can_drop_resource_here(self, resource: Resource) -> None:
260-
if not isinstance(resource, PlateHolder._accepted_child_types):
261-
raise TypeError(
262-
f"Cannot drop resource {resource.name} onto plate holder {self.name}. "
263-
f"Only {self._accepted_child_types} resources are allowed."
264-
)
265-
266-
super().check_can_drop_resource_here(resource)
267-
268252

269253
class PlateCarrier(Carrier):
270254
r"""Base class for plate carriers.

pylabrobot/resources/plate.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,3 +308,7 @@ def get_quadrant(
308308
wells.sort(key=lambda well: (well.location.x, -well.location.y)) # type: ignore
309309

310310
return wells
311+
312+
def check_can_drop_resource_here(self, resource: Resource) -> None:
313+
if not isinstance(resource, Lid):
314+
raise RuntimeError(f"Can only drop Lid resources onto Plate '{self.name}'.")

pylabrobot/resources/resource_holder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def serialize(self):
7878
return {**super().serialize(), "child_location": serialize(self.child_location)}
7979

8080
def check_can_drop_resource_here(self, resource: Resource) -> None:
81-
if self.resource is not None:
81+
if self.resource is not None and resource is not self.resource:
8282
raise RuntimeError(
8383
f"Cannot drop resource {resource.name} onto resource holder {self.name} while it already has a resource. "
8484
"Please remove the resource before dropping a new one."

pylabrobot/resources/resource_stack.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,7 @@ def get_top_item(self) -> Resource:
145145
raise ValueError("Stack is empty")
146146

147147
return self.children[-1]
148+
149+
def check_can_drop_resource_here(self, resource: Resource) -> None:
150+
# for now, any resource can be dropped onto a stack.
151+
pass

0 commit comments

Comments
 (0)