MCPcopy Create free account
hub / github.com/csev/py4e / findParent

Method findParent

code/BeautifulSoup.py:305–314  ·  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

303 fetchPreviousSiblings = findPreviousSiblings # Compatibility with pre-3.x
304
305 def findParent(self, name=None, attrs={}, **kwargs):
306 """Returns the closest parent of this Tag that matches the given
307 criteria."""
308 # NOTE: We can't use _findOne because findParents takes a different
309 # set of arguments.
310 r = None
311 l = self.findParents(name, attrs, 1)
312 if l:
313 r = l[0]
314 return r
315
316 def findParents(self, name=None, attrs={}, limit=None, **kwargs):
317 """Returns the parents of this Tag that match the given

Callers

nothing calls this directly

Calls 1

findParentsMethod · 0.95

Tested by

no test coverage detected