upload
This commit is contained in:
10
utils/modules/pycaption/utils.py
Normal file
10
utils/modules/pycaption/utils.py
Normal file
@@ -0,0 +1,10 @@
|
||||
def is_leaf(element):
|
||||
"""
|
||||
Return True if the element is a leaf, False otherwise. The element is
|
||||
considered a leaf if it is either NavigableString or the "br" tag
|
||||
:param element: A BeautifulSoup tag or NavigableString
|
||||
"""
|
||||
name = getattr(element, 'name', None)
|
||||
if not name or name == 'br':
|
||||
return True
|
||||
return False
|
||||
Reference in New Issue
Block a user