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

Method append

pyquery/pyquery.py:1222–1239  ·  view source on GitHub ↗

append value to each nodes

(self, value)

Source from the content-addressed store, hash-verified

1220 return root, root_text
1221
1222 def append(self, value):
1223 """append value to each nodes
1224 """
1225 root, root_text = self._get_root(value)
1226 for i, tag in enumerate(self):
1227 if len(tag) > 0: # if the tag has children
1228 last_child = tag[-1]
1229 if not last_child.tail:
1230 last_child.tail = ''
1231 last_child.tail += root_text
1232 else:
1233 if not tag.text:
1234 tag.text = ''
1235 tag.text += root_text
1236 if i > 0:
1237 root = deepcopy(list(root))
1238 tag.extend(root)
1239 return self
1240
1241 @with_camel_case_alias
1242 def append_to(self, value):

Callers 15

_squash_artifical_nlFunction · 0.80
flushFunction · 0.80
_merge_original_partsFunction · 0.80
extract_text_arrayFunction · 0.80
__repr__Method · 0.80
_filter_onlyMethod · 0.80
closestMethod · 0.80
filterMethod · 0.80
mapMethod · 0.80
cssMethod · 0.80
append_toMethod · 0.80

Calls 2

_get_rootMethod · 0.95
extendMethod · 0.80

Tested by

no test coverage detected