Utils

Module containing utility functions

class bertlv.utils.XmlSettings(indent: str = '  ', newl: str = '\n', encoding: str = 'utf-8')[source]

Bases: object

XML settings as expected by the method toprettyxml().

indent: str = '  '

Specifies the indentation string.

newl: str = '\n'

Specifies the string emitted at the end of each line.

encoding: str = 'utf-8'

Specifies the encoding to use for the output.

bertlv.utils.xml_prettify(string: str, settings: bertlv.utils.XmlSettings = XmlSettings(indent='  ', newl='\n', encoding='utf-8'))bytes[source]

Return a pretty-printed XML byte-string for the raw XML string.

bertlv.utils.xml_prettify_element(element: xml.etree.ElementTree.Element, settings: bertlv.utils.XmlSettings = XmlSettings(indent='  ', newl='\n', encoding='utf-8'))bytes[source]

Return a pretty-printed XML byte-string for the element.

bertlv.utils.xml_text2hex(element: xml.etree.ElementTree.Element)bytes[source]

Return a byte-string from the hexadecimal element text.