mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Remove some duplication of effort
No need to set the keyword to True when I can just pass the parameter's value in anyway. This reads a bit nicer.
This commit is contained in:
@@ -169,7 +169,7 @@ class TreeNode(Generic[TreeDataType]):
|
||||
self._updates += 1
|
||||
if expand_all:
|
||||
for child in self.children:
|
||||
child._expand(expand_all=True)
|
||||
child._expand(expand_all)
|
||||
|
||||
def expand(self, *, expand_all: bool = False) -> None:
|
||||
"""Expand a node (show its children).
|
||||
@@ -189,7 +189,7 @@ class TreeNode(Generic[TreeDataType]):
|
||||
self._expanded = False
|
||||
if collapse_all:
|
||||
for child in self.children:
|
||||
child._collapse(collapse_all=True)
|
||||
child._collapse(collapse_all)
|
||||
self._updates += 1
|
||||
|
||||
def collapse(self, *, collapse_all: bool = True) -> None:
|
||||
@@ -210,7 +210,7 @@ class TreeNode(Generic[TreeDataType]):
|
||||
self._expanded = not self._expanded
|
||||
if toggle_all:
|
||||
for child in self.children:
|
||||
child._toggle(toggle_all=True)
|
||||
child._toggle(toggle_all)
|
||||
self._updates += 1
|
||||
|
||||
def toggle(self, *, toggle_all: bool = True) -> None:
|
||||
|
||||
Reference in New Issue
Block a user