Formatting, refactoring, __repr__

This commit is contained in:
Elijah Lopez
2020-08-14 09:07:56 -04:00
parent 7351623e3a
commit add390c0a0
9 changed files with 85 additions and 97 deletions

View File

@@ -1,4 +1,4 @@
#import xml.etree.ElementTree as ET
# import xml.etree.ElementTree as ET
from lxml import etree as ET
import io
from collections import namedtuple
@@ -6,6 +6,7 @@ from collections import namedtuple
IXMLTrack = namedtuple('IXMLTrack', ['channel_index', 'interleave_index', 'name', 'function'])
class WavIXMLFormat:
"""
iXML recorder metadata.
@@ -16,9 +17,9 @@ class WavIXMLFormat:
:param xml: A bytes-like object containing the iXML payload.
"""
self.source = xml
xmlBytes = io.BytesIO(xml)
xml_bytes = io.BytesIO(xml)
parser = ET.XMLParser(recover=True)
self.parsed = ET.parse(xmlBytes, parser=parser)
self.parsed = ET.parse(xml_bytes, parser=parser)
def _get_text_value(self, xpath):
e = self.parsed.find("./" + xpath)
@@ -87,5 +88,3 @@ class WavIXMLFormat:
The name of this file's file family.
"""
return self._get_text_value("FILE_SET/FAMILY_NAME")