2.6.4.2. pycsamt.emtf.xml.writer#

Filesystem/stream writer for the EMTF XML serializer.

Functions

write_emtf_xml(document, target, *[, ...])

Convenience wrapper around EMTFXMLWriter.

Classes

EMTFXMLWriter(*[, strict, precision, pretty])

Serialize EMTF documents as EMTF XML.

class pycsamt.emtf.xml.writer.EMTFXMLWriter(*, strict=True, precision=17, pretty=True)[source]

Bases: PyCSAMTObject

Serialize EMTF documents as EMTF XML.

Parameters:
  • strict (bool, default=True) – Reject unsupported/ambiguous scientific content rather than silently dropping it.

  • precision (int, default=17) – Significant digits used for floating-point response data.

  • pretty (bool, default=True) – Indent the generated XML for human readability.

to_element(document)[source]

Return a serialized root element.

Parameters:

document (EMTF)

Return type:

Element

dumps(document, *, xml_declaration=True, encoding='utf-8')[source]

Return a Unicode EMTF XML document.

Parameters:
  • document (EMTF)

  • xml_declaration (bool)

  • encoding (str)

Return type:

str

write(document, target, *, xml_declaration=True, encoding='utf-8')[source]

Write document to a filesystem path or writable stream.

Parameters:
Return type:

Path | IO[str] | IO[bytes]

pycsamt.emtf.xml.writer.write_emtf_xml(document, target, *, strict=True, precision=17, pretty=True, xml_declaration=True, encoding='utf-8')[source]

Convenience wrapper around EMTFXMLWriter.

Parameters:
Return type:

Path | IO[str] | IO[bytes]