Skip to content

Commit

Permalink
Simplifying - dont use optional awaitables where not required
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Oct 12, 2023
1 parent 2539df9 commit 842bdf8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/textual/widgets/_tabbed_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,8 @@ def remove_pane(self, pane_id: str) -> AwaitComplete:
# other means; so allow that to be a no-op.
pass

await_complete = AwaitComplete(gather(*removals))

async def _remove_content(cleared_message: TabbedContent.Cleared) -> None:
await await_complete
await gather(*removals)
if self.tab_count == 0:
self.post_message(cleared_message)

Expand All @@ -339,11 +337,9 @@ def clear_panes(self) -> AwaitComplete:
An optionally awaitable object which waits for all panes to be removed
and the Cleared message to be posted.
"""
await_clear = AwaitComplete(
gather(
self.get_child_by_type(Tabs).clear(),
self.get_child_by_type(ContentSwitcher).remove_children(),
)
await_clear = gather(
self.get_child_by_type(Tabs).clear(),
self.get_child_by_type(ContentSwitcher).remove_children(),
)

async def _clear_content(cleared_message: TabbedContent.Cleared) -> None:
Expand Down

0 comments on commit 842bdf8

Please sign in to comment.