pychemstation.utils.abc_tables.device
1from __future__ import annotations 2 3from abc import ABC, abstractmethod 4 5from .table import ABCTableController 6from ..table_types import Table, Device 7from ...control.controllers import CommunicationController 8 9 10class DeviceController(ABCTableController, ABC): 11 """Abstract controller representing tables that contain device information. 12 13 :param controller: controller for sending MACROs 14 :param table: contains register keys for accessing table in Chemstation 15 :param offline: whether the communication controller is online. 16 """ 17 18 def get_row(self, row: int): 19 raise NotImplementedError 20 21 def __init__( 22 self, controller: CommunicationController, table: Table | Device, offline: bool 23 ): 24 super().__init__(controller=controller, table=table) 25 self.offline = offline 26 27 def __new__(cls, *args, **kwargs): 28 if cls is ABCTableController: 29 raise TypeError(f"only children of '{cls.__name__}' may be instantiated") 30 return object.__new__(cls) 31 32 def download(self): 33 raise NotImplementedError 34 35 @abstractmethod 36 def turn_off(self): 37 pass 38 39 @abstractmethod 40 def turn_on(self): 41 pass
11class DeviceController(ABCTableController, ABC): 12 """Abstract controller representing tables that contain device information. 13 14 :param controller: controller for sending MACROs 15 :param table: contains register keys for accessing table in Chemstation 16 :param offline: whether the communication controller is online. 17 """ 18 19 def get_row(self, row: int): 20 raise NotImplementedError 21 22 def __init__( 23 self, controller: CommunicationController, table: Table | Device, offline: bool 24 ): 25 super().__init__(controller=controller, table=table) 26 self.offline = offline 27 28 def __new__(cls, *args, **kwargs): 29 if cls is ABCTableController: 30 raise TypeError(f"only children of '{cls.__name__}' may be instantiated") 31 return object.__new__(cls) 32 33 def download(self): 34 raise NotImplementedError 35 36 @abstractmethod 37 def turn_off(self): 38 pass 39 40 @abstractmethod 41 def turn_on(self): 42 pass
Abstract controller representing tables that contain device information.
Parameters
- controller: controller for sending MACROs
- table: contains register keys for accessing table in Chemstation
- offline: whether the communication controller is online.