def pipette_by_name( self, mount, name_or_model, trash_container='', tip_racks=[], aspirate_flow_rate=None, dispense_flow_rate=None, min_volume=None, max_volume=None, blow_out_flow_rate=None): pipette_model_version, pip_id = self._pipette_details( mount, name_or_model) config = pipette_config.load(pipette_model_version, pip_id) if pip_id and config.backcompat_name == name_or_model: log.warning( f"Using a deprecated constructor for {pipette_model_version}") constructor_config = pipette_config.name_config()[name_or_model] config = config._replace( min_volume=constructor_config['minVolume'], max_volume=constructor_config['maxVolume']) name_or_model = config.name return self._create_pipette_from_config( config=config, mount=mount, name=name_or_model, model=pipette_model_version, trash_container=trash_container, tip_racks=tip_racks, aspirate_flow_rate=aspirate_flow_rate, dispense_flow_rate=dispense_flow_rate, min_volume=min_volume, max_volume=max_volume, blow_out_flow_rate=blow_out_flow_rate)
def test_backwards_compatibility(backcompat, monkeypatch): expected_name, old_name, old_constructor = backcompat robot.reset() fake_pip = { 'left': { 'model': None, 'id': None, 'name': None }, 'right': { 'model': expected_name.split('_gen2')[0] + '_v2.0', 'id': 'FakePip', 'name': expected_name } } monkeypatch.setattr(robot, 'model_by_mount', fake_pip) old_config = pipette_config.name_config()[old_name] pipette = old_constructor(mount='right') assert pipette.name.startswith(expected_name) is True assert pipette.mount == 'right' assert pipette.min_volume == old_config['minVolume'] assert pipette.max_volume == old_config['maxVolume']
def act_as(self, name: PipetteName): """ Reconfigure to act as ``name``. ``name`` must be either the actual name of the pipette, or a name in its back-compatibility config. """ if name == self._acting_as: return assert name in self._config.back_compat_names + [self.name],\ f'{self._name} is not back-compatible with {name}' name_conf = pipette_config.name_config() bc_conf = name_conf[name] self.working_volume = bc_conf['maxVolume'] self.update_config_item('min_volume', bc_conf['minVolume']) self.update_config_item('max_volume', bc_conf['maxVolume'])