Mapper¶
- 
exception 
bertlv.mapper.MapperError(message: str, *, element: Optional[xml.etree.ElementTree.Element] = None, mapping: Optional[xml.etree.ElementTree.Element] = None)[source]¶ Bases:
bertlv.tree.TlvError
- 
class 
bertlv.mapper.XmlMapping(root: xml.etree.ElementTree.Element)[source]¶ Bases:
object- 
TYPE_MAP= {'': 'Hex', 'Hex': 'Hex', 'String': 'ASCII'}¶ 
- 
lookup(tag: str) → Optional[xml.etree.ElementTree.Element][source]¶ Look up the tag in the mapping and return the element.
- 
decode(element: xml.etree.ElementTree.Element) → bool[source]¶ Process the mapping for the given element.
- 
encode(element: xml.etree.ElementTree.Element) → bool[source]¶ Process the mapping for the given element.
- 
classmethod 
parse(filename: pathlib.Path) → bertlv.mapper.XmlMapping[source]¶ Parse the given mapping file.
- 
 
- 
bertlv.mapper.init(mappings: Iterable[bertlv.mapper.XmlMapping])[source]¶ Init the mappings list.
- 
bertlv.mapper.parse(filenames: Iterable[pathlib.Path])[source]¶ Parse the given mapping files.
- 
bertlv.mapper.lookup(tag: str) → Optional[xml.etree.ElementTree.Element][source]¶ Look up the tag in the mappings and return the element.
Returns None if the tag is not found.
- 
bertlv.mapper.is_constructed(tag: str) → Optional[bool][source]¶ Look up the tag in the mappings and return True if it’s constructed.
Returns None if the tag is not found.
- 
bertlv.mapper.encode(element: xml.etree.ElementTree.Element)[source]¶ Encode the given element using the mappings.
- 
bertlv.mapper.decode(element: xml.etree.ElementTree.Element)[source]¶ Decode the given element using the mappings.
- 
bertlv.mapper.encode_tree(root: xml.etree.ElementTree.Element)[source]¶ Encode all elements in the given tree using the mappings.
- 
bertlv.mapper.decode_tree(root: xml.etree.ElementTree.Element)[source]¶ Decode all elements in the given tree using the mappings.