diff --git a/xml_reader.py b/xml_reader.py index 66634de..45cd30a 100644 --- a/xml_reader.py +++ b/xml_reader.py @@ -41,33 +41,6 @@ class Xml_reader: """ return [device.get("name") for device in self.root.findall('Device')] - def get_value_info(self,device_name: str) -> dict: - """returns the value information for a given device - - Args: - device_name (str): the name of a device - - Returns: - dict: {'type','unit','offset','factor'} - - Raises: - NameError: device_name will be checked against the config XML - """ - #check if a device exists in the config XML - if self.root.find("Device[@name='%s']" % device_name) is None: - raise NameError("unknown device %s" % device_name) - value_info = self.root.find( - "Device[@name='%s']/ValueInfo" % device_name) - #format the output - return { - 'type': value_info.get('type'), - 'unit': value_info.get('unit'), - 'offset': None if value_info.find("Offset") is None - else value_info.find("Offset").text, - 'factor': None if value_info.find("Factor") is None - else value_info.find("Factor").text, - } - def get_port(self,device_name:str) -> dict: """returns the information about a port of a given device