pytams.xmlutils

Module Contents

Functions

manualCast(elem)

Manually cast XML elements reads.

dict_to_xml(→ xml.etree.ElementTree.Element)

Return an Element from a dictionnary.

xml_to_dict(→ dict)

Return an dictionnary an Element.

new_element(→ xml.etree.ElementTree.Element)

Return an Element from two args.

make_xml_snapshot(→ xml.etree.ElementTree.Element)

Return a snapshot in XML elemt format.

read_xml_snapshot(snap)

Return snapshot data from an XML snapshot elemt.

exception pytams.xmlutils.XMLUtilsError[source]

Bases: Exception

Exception class for the xmlutils.

pytams.xmlutils.manualCast(elem: xml.etree.ElementTree.Element)[source]

Manually cast XML elements reads.

pytams.xmlutils.dict_to_xml(tag: str, d) xml.etree.ElementTree.Element[source]

Return an Element from a dictionnary.

Parameters:
  • tag – a root tag

  • d – a dictionary

pytams.xmlutils.xml_to_dict(elem: xml.etree.ElementTree.Element) dict[source]

Return an dictionnary an Element.

Parameters:
  • tag – a root tag

  • elem – an etree element

pytams.xmlutils.new_element(key: str, val) xml.etree.ElementTree.Element[source]

Return an Element from two args.

Parameters:
  • key – the element key

  • val – the element value

pytams.xmlutils.make_xml_snapshot(idx: int, time: float, score: float, state) xml.etree.ElementTree.Element[source]

Return a snapshot in XML elemt format.

Parameters:
  • idx – snapshot index

  • time – the time stamp

  • score – the snapshot score function

  • state – the associated state

pytams.xmlutils.read_xml_snapshot(snap: xml.etree.ElementTree.Element)[source]

Return snapshot data from an XML snapshot elemt.

Parameters:

snap – an XML snapshot elemt