MCPcopy Create free account
hub / github.com/clips/pattern / findParent

Method findParent

pattern/web/soup/BeautifulSoup.py:320–329  ·  view source on GitHub ↗

Returns the closest parent of this Tag that matches the given criteria.

(self, name=None, attrs={}, **kwargs)

Source from the content-addressed store, hash-verified

318 fetchPreviousSiblings = findPreviousSiblings # Compatibility with pre-3.x
319
320 def findParent(self, name=None, attrs={}, **kwargs):
321 """Returns the closest parent of this Tag that matches the given
322 criteria."""
323 # NOTE: We can't use _findOne because findParents takes a different
324 # set of arguments.
325 r = None
326 l = self.findParents(name, attrs, 1)
327 if l:
328 r = l[0]
329 return r
330
331 def findParents(self, name=None, attrs={}, limit=None, **kwargs):
332 """Returns the parents of this Tag that match the given

Callers 3

getPropertyValueMethod · 0.80
testParentsMethod · 0.80
testTextNavigationMethod · 0.80

Calls 1

findParentsMethod · 0.95

Tested by 2

testParentsMethod · 0.64
testTextNavigationMethod · 0.64