MCPcopy
hub / github.com/csev/py4e / unwrap

Method unwrap

code3/bs4/element.py:236–246  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

234 replaceWith = replace_with # BS3
235
236 def unwrap(self):
237 my_parent = self.parent
238 if not self.parent:
239 raise ValueError(
240 "Cannot replace an element with its contents when that"
241 "element is not part of a tree.")
242 my_index = self.parent.index(self)
243 self.extract()
244 for child in reversed(self.contents[:]):
245 my_parent.insert(my_index, child)
246 return self
247 replace_with_children = unwrap
248 replaceWithChildren = unwrap # BS3
249

Callers 7

foundation.min.jsFile · 0.45
foundation.jsFile · 0.45
foundation.min.jsFile · 0.45
foundation.min.jsFile · 0.45
foundation.min.jsFile · 0.45
test_unwrapMethod · 0.45

Calls 3

extractMethod · 0.95
indexMethod · 0.45
insertMethod · 0.45

Tested by 2

test_unwrapMethod · 0.36