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

Method each

pyquery/pyquery.py:694–706  ·  view source on GitHub ↗

apply func on each nodes

(self, func)

Source from the content-addressed store, hash-verified

692 return self._copy(items, parent=self)
693
694 def each(self, func):
695 """apply func on each nodes
696 """
697 try:
698 for i, element in enumerate(self):
699 func.__globals__['this'] = element
700 if callback(func, i, element) is False:
701 break
702 finally:
703 f_globals = func.__globals__
704 if 'this' in f_globals:
705 del f_globals['this']
706 return self
707
708 def map(self, func):
709 """Returns a new PyQuery after transforming current items with func.

Callers 3

_set_valueMethod · 0.80
make_links_absoluteMethod · 0.80
test_eachMethod · 0.80

Calls 1

callbackFunction · 0.85

Tested by 1

test_eachMethod · 0.64