MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / clear_element

Function clear_element

apps/epg/tasks.py:4315–4325  ·  view source on GitHub ↗

Clear an XML element and its parent to free memory.

(elem)

Source from the content-addressed store, hash-verified

4313
4314
4315def clear_element(elem):
4316 """Clear an XML element and its parent to free memory."""
4317 try:
4318 elem.clear()
4319 parent = elem.getparent()
4320 if parent is not None:
4321 while elem.getprevious() is not None:
4322 del parent[0]
4323 parent.remove(elem)
4324 except Exception as e:
4325 logger.warning(f"Error clearing XML element: {e}", exc_info=True)
4326
4327
4328def detect_file_format(file_path=None, content=None):

Callers 3

parse_channels_onlyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected