def __init_wells(self): c_specs = self.specs.well_specs containers = [] cp_map = {} # We fetch all the rack positions in one query to speed up things. shape = self.specs.shape agg = get_root_aggregate(IRackPosition) agg.filter = lt(_row_index=shape.number_rows) \ & lt(_column_index=shape.number_columns) iterator = agg.iterator() while True: try: rack_pos = iterator.next() except StopIteration: break else: well = Well.create_from_rack_and_position( c_specs, self.status, self, rack_pos) containers.append(well) cp_map[rack_pos] = well self.containers = containers return cp_map
def initialize_cache(cls): """ By default, we initialise all positions from 384-rack-shape in a one-step query. This is faster than fetching a potentially large number of positions one by one. """ cls._initialize_aggregate() shape_384 = get_384_rack_shape() cls._aggregate.filter = lt(_row_index=shape_384.number_rows) \ & lt(_column_index=shape_384.number_columns) iterator = cls._aggregate.iterator() while True: try: rack_pos = iterator.next() except StopIteration: break else: cls._cache[rack_pos.label] = rack_pos coords = (rack_pos.row_index, rack_pos.column_index) cls.__coordinate_cache[coords] = rack_pos cls._aggregate.filter = None
def __init_wells(self): c_specs = self.specs.well_specs containers = [] cp_map = {} # We fetch all the rack positions in one query to speed up things. shape = self.specs.shape agg = get_root_aggregate(IRackPosition) agg.filter = lt(_row_index=shape.number_rows) \ & lt(_column_index=shape.number_columns) iterator = agg.iterator() while True: try: rack_pos = iterator.next() except StopIteration: break else: well = Well.create_from_rack_and_position(c_specs, self.status, self, rack_pos) containers.append(well) cp_map[rack_pos] = well self.containers = containers return cp_map
def test_generator_or(self): spec = lt(number_attr=1) | gt(number_attr=1) self.assert_true(spec.is_satisfied_by(self.candidate))
def test_generator_or(self, specification_candidate): #pylint: disable=W0621 spec = lt(number_attr=NUMBER_VALUE + 1) \ | gt(number_attr=NUMBER_VALUE + 1) assert spec.is_satisfied_by(specification_candidate)