Globals#

tosclib.tosc.createTemplate(frame=None)[source]#

Generates a root xml Element and adds the base GROUP node to it.

Parameters

frame (Optional[tuple]) –

Return type

xml.etree.ElementTree.Element

tosclib.tosc.findKey(elements, key)[source]#

Iterate through element with children and return child whose key matches

Parameters
Return type

Union[xml.etree.ElementTree.Element, Any]

tosclib.tosc.getTextValueFromKey(properties, key)[source]#

Find the value.text from a known key

Parameters
Return type

Union[str, Any]

tosclib.tosc.pullValueFromKey(inputFile, key, value, targetKey)[source]#

If you know the name of an element but don’t know its other properties. This function uses a .tosc file and gets its root. For passing an element see pullValueFromKey2

Parameters
  • inputFile (str) – File to parse.

  • key (str) – Known key.

  • value (str) – Known value.

  • targetKey (str) – Known key of unknown value.

Returns

Value

Return type

str

tosclib.tosc.pullValueFromKey2(root, key, value, targetKey)[source]#

If you know the name of an element but don’t know its other properties. This parses an Element and has to convert it to string so its slower.

Parameters
  • root (ET.Element) – Parses the whole element, so you can feed the root.

  • key (str) – Known key.

  • value (str) – Known value.

  • targetKey (str) – Known key of unknown value.

Returns

Value

Return type

str

tosclib.tosc.showElement(e)[source]#

Generic print string function, UTF-8, indented 2 spaces

Parameters

e (xml.etree.ElementTree.Element | None) –