remove children func
This commit is contained in:
parent
894b517447
commit
fa9c3dc2e1
1 changed files with 4 additions and 7 deletions
|
|
@ -63,11 +63,6 @@ class EntryParent(BaseEntry):
|
||||||
"""This parent's children that are entries"""
|
"""This parent's children that are entries"""
|
||||||
return self._entry_children
|
return self._entry_children
|
||||||
|
|
||||||
@property
|
|
||||||
def children(self) -> List[TBaseEntry]:
|
|
||||||
"""Children, both entries and parent entries, cast as BaseEntry"""
|
|
||||||
return self._parent_children + self._entry_children
|
|
||||||
|
|
||||||
def num_children(self) -> int:
|
def num_children(self) -> int:
|
||||||
"""
|
"""
|
||||||
Returns
|
Returns
|
||||||
|
|
@ -210,7 +205,7 @@ class EntryParent(BaseEntry):
|
||||||
if not playlist_id:
|
if not playlist_id:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return self.uid == playlist_id or any([item in child for child in self.parent_children()])
|
return self.uid == playlist_id or any(item in child for child in self.parent_children())
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_disconnected_root_parent(
|
def _get_disconnected_root_parent(
|
||||||
|
|
@ -224,7 +219,9 @@ class EntryParent(BaseEntry):
|
||||||
return webpage_url in url or url in webpage_url
|
return webpage_url in url or url in webpage_url
|
||||||
|
|
||||||
top_level_parents = [
|
top_level_parents = [
|
||||||
parent for parent in parents if not parent.children and _url_matches(parent.webpage_url)
|
parent
|
||||||
|
for parent in parents
|
||||||
|
if parent.num_children() == 0 and _url_matches(parent.webpage_url)
|
||||||
]
|
]
|
||||||
|
|
||||||
match len(top_level_parents):
|
match len(top_level_parents):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue