SlotSet (inherits from dataclass)
Description
Represents a collection of slots on the Jubilee deck. Provides access to individual slots either by their key (slot index) or by position, and summarizes the deck's bed type.
Constructor
python
SlotSet(slots: Dict[str, Slot])Initializes a SlotSet with a dictionary of slot objects.
Properties
| Property | Type | Description |
|---|---|---|
slots | Dict[str, Slot] | Dictionary mapping slot indices to Slot objects. |
Methods
| Method | Returns | Description |
|---|---|---|
__getitem__(id_: str or int) | Slot | Retrieves a Slot object by its key or by list index if key not found. |
__repr__() | str | Returns a string representation of the bed type. |
Short Example
python
# Suppose you have some slots
slots_dict = {
"0": Slot(slot_index=0, offset=(0, 0), has_labware=False, labware=None),
"1": Slot(slot_index=1, offset=(50, 0), has_labware=False, labware=None),
}
# Create a SlotSet
slot_set = SlotSet(slots=slots_dict)
# Access a Slot by key
slot0 = slot_set["0"]
# Access a Slot by position (fallback to list index)
slot1 = slot_set[1]Important Notes
SlotSetallows flexible access: by string key (e.g.,"0") or by integer index (e.g.,1).SlotSet's__repr__()method assumes that abedTypeproperty exists, although it's normally provided by subclasses likeDeck.- Direct modification of
slotsdictionary is possible but should be done carefully to maintain consistency with the physical deck layout.