MCPcopy Create free account
hub / github.com/PageBot/PageBot / clearElements

Method clearElements

Lib/pagebot/elements/element.py:1317–1332  ·  view source on GitHub ↗

Properly initializes self._elements and self._eIds. Any existing element will get its parent weakrefs become None and will be garbage collected. >>> e1 = Element(name='Child') >>> e1 = Element(name='Child') >>> e = Element(name='Parent', elements=[e1])

(self)

Source from the content-addressed store, hash-verified

1315 return None
1316
1317 def clearElements(self):
1318 """Properly initializes self._elements and self._eIds. Any existing
1319 element will get its parent weakrefs become None and will be garbage
1320 collected.
1321
1322 >>> e1 = Element(name='Child')
1323 >>> e1 = Element(name='Child')
1324 >>> e = Element(name='Parent', elements=[e1])
1325 >>> len(e)
1326 1
1327 >>> e.clearElements()
1328 >>> len(e)
1329 0
1330 """
1331 self._elements = []
1332 self._eIds = {}
1333
1334 def clear(self):
1335 """Make inheriting classes define a method to clear their content if

Callers 3

__init__Method · 0.95
_set_elementsMethod · 0.95
_set_templateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected