def load (self, filenames): """ Loads in and parses out mapping data from the given list of filenames. """ _BaseConfig.load(self, filenames) parser = self._parser for section in ['DEFAULT'] + parser.sections(): if section == 'DEFAULT': target = self.mappings[None] elif section.lower().startswith('device:'): # Store (maybe) device-specific mappings null, name = section.split(':', 1) if name not in self.mappings: self.mappings[name] = {} target = self.mappings[name] else: raise ValueError ('Invalid section: %s' % section) # We convert all the stuff in the file to ReMapping objects for input, output in parser.items(section): # input may have multiple (comma-seperated) values for singleInput in input.split(','): remap = ReMapping (singleInput, output) target[remap.input] = remap
def load(self, filenames): """ Loads in and parses out mapping data from the given list of filenames. """ _BaseConfig.load(self, filenames) parser = self._parser for section in ['DEFAULT'] + parser.sections(): if section == 'DEFAULT': target = self.mappings[None] elif section.lower().startswith('device:'): # Store (maybe) device-specific mappings null, name = section.split(':', 1) if name not in self.mappings: self.mappings[name] = {} target = self.mappings[name] else: raise ValueError('Invalid section: %s' % section) # We convert all the stuff in the file to ReMapping objects for input, output in parser.items(section): # input may have multiple (comma-seperated) values for singleInput in input.split(','): remap = ReMapping(singleInput, output) target[remap.input] = remap
def load(self, filenames): """ Loads in and parses out configuration and mapping data from the given list of filenames. """ _BaseConfig.load(self, filenames) for section in self._parser.sections(): if section.lower().startswith('device:'): self._loadDeviceSection(section) elif section.lower().startswith('map:'): # Store (maybe) device-specific mappings self._loadMapSection(section) else: raise ValueError('Invalid section: %s' % section)
def load (self, filenames): """ Loads in and parses out configuration and mapping data from the given list of filenames. """ _BaseConfig.load(self, filenames) for section in self._parser.sections(): if section.lower().startswith('device:'): self._loadDeviceSection(section) elif section.lower().startswith('map:'): # Store (maybe) device-specific mappings self._loadMapSection(section) else: raise ValueError ('Invalid section: %s' % section)