stoner_measurement.instruments.driver_manager.InstrumentDriverManager¶
- class stoner_measurement.instruments.driver_manager.InstrumentDriverManager[source]¶
Bases:
objectDiscover and provide access to concrete instrument driver classes.
Discovery combines:
Built-in drivers found by scanning
stoner_measurement.instrumentsmodules.Third-party drivers exposed via the
stoner_measurement.instrumentsentry-point group.
- property driver_classes: dict[str, type[BaseInstrument]]¶
Return a copy of discovered driver classes.
- drivers_by_type(instrument_type: type[BaseInstrument], *, include_abstract: bool = False) dict[str, type[BaseInstrument]][source]¶
Return discovered drivers that subclass a specific instrument type.
- Parameters:
instrument_type (type[BaseInstrument]) – Base class/interface to filter by, for example
MagnetControllerorTemperatureController.- Keyword Parameters:
include_abstract (bool) – If
True, include abstract classes in results. Defaults toFalse.- Returns:
Mapping of driver name to driver class.
- Return type:
(dict[str, type[BaseInstrument]])
- Raises:
TypeError – If instrument_type is not a
BaseInstrumentsubclass.
- get(name: str) type[BaseInstrument] | None[source]¶
Return a discovered driver class by name, or
None.
- register(name: str, driver_cls: type[BaseInstrument]) None[source]¶
Manually register a driver class.
- Parameters:
name (str) – Unique identifier for the driver.
driver_cls (type[BaseInstrument]) – Driver class to register.
- Raises:
TypeError – If driver_cls is not a
BaseInstrumentsubclass.