def _detect_family(self): ''' Discover what sensor family this device belongs is ''' with open(W1_UEVENT.substitute(dev=self.device), 'r') as f: lines = [l for l in f] family = lines[1].split('=')[1].upper().strip() self.family = family
def _detect_family(self): """ Discover what sensor family this device belongs is """ with open(W1_UEVENT.substitute(dev=self.device), "r") as f: lines = [l for l in f] family = lines[1].split("=")[1].upper().strip() self.family = family
def __create_devices(self, devices): ''' Create the appropriate devices from a list of device ids Arguments: devices should be an iterable of strings containing device ids ''' created_devices = [] for d in devices: family = '' with open(W1_UEVENT.substitute(dev=d), 'r') as f: lines = [l for l in f] family = lines[1].split('=')[1].upper().strip() if family in Thermal.FAMILIES: created_devices.append(Thermal(d, family)) return set(created_devices)