MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / commit_xml_string

Method commit_xml_string

dm_control/mjcf/debugging.py:203–219  ·  view source on GitHub ↗

Commits the XML string associated with this debug context. This function also formats the XML string to make sure that the debugging metadata appears on the same line as the corresponding XML element. Args: xml_string: A pretty-printed XML string. Returns: A reformatte

(self, xml_string)

Source from the content-addressed store, hash-verified

201 return etree.Comment('{}:{}'.format(DEBUG_METADATA_PREFIX, id(elem)))
202
203 def commit_xml_string(self, xml_string):
204 """Commits the XML string associated with this debug context.
205
206 This function also formats the XML string to make sure that the debugging
207 metadata appears on the same line as the corresponding XML element.
208
209 Args:
210 xml_string: A pretty-printed XML string.
211
212 Returns:
213 A reformatted XML string where all debugging metadata appears on the same
214 line as the corresponding XML element.
215 """
216 formatted = re.sub(r'\n\s*' + _DEBUG_METADATA_TAG_PREFIX,
217 _DEBUG_METADATA_TAG_PREFIX, xml_string)
218 self._xml_string = formatted
219 return formatted
220
221 def process_and_raise_last_exception(self):
222 """Processes and re-raises the last ValueError caught.

Callers 1

to_xml_stringMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected