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

Method xpath_odd_pseudo

pyquery/cssselectpatch.py:92–103  ·  view source on GitHub ↗

Matches odd elements, zero-indexed:: >>> from pyquery import PyQuery >>> d = PyQuery(' ') >>> d('p:odd') [ ] ..

(self, xpath)

Source from the content-addressed store, hash-verified

90 return xpath
91
92 def xpath_odd_pseudo(self, xpath):
93 """Matches odd elements, zero-indexed::
94
95 >>> from pyquery import PyQuery
96 >>> d = PyQuery('<div><p></p><p class="last"></p></div>')
97 >>> d('p:odd')
98 [<p.last>]
99
100 ..
101 """
102 xpath.add_post_condition('position() mod 2 = 0')
103 return xpath
104
105 def xpath_checked_pseudo(self, xpath):
106 """Matches odd elements, zero-indexed::

Callers

nothing calls this directly

Calls 1

add_post_conditionMethod · 0.80

Tested by

no test coverage detected