MCPcopy Create free account
hub / github.com/gawel/pyquery / prepend

Method prepend

pyquery/pyquery.py:1248–1264  ·  view source on GitHub ↗

prepend value to nodes

(self, value)

Source from the content-addressed store, hash-verified

1246 return self
1247
1248 def prepend(self, value):
1249 """prepend value to nodes
1250 """
1251 root, root_text = self._get_root(value)
1252 for i, tag in enumerate(self):
1253 if not tag.text:
1254 tag.text = ''
1255 if len(root) > 0:
1256 root[-1].tail = tag.text
1257 tag.text = root_text
1258 else:
1259 tag.text = root_text + tag.text
1260 if i > 0:
1261 root = deepcopy(list(root))
1262 tag[:0] = root
1263 root = tag[:len(root)]
1264 return self
1265
1266 @with_camel_case_alias
1267 def prepend_to(self, value):

Callers 1

prepend_toMethod · 0.80

Calls 1

_get_rootMethod · 0.95

Tested by

no test coverage detected