mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add some documentation to AwaitRemove
This commit is contained in:
@@ -1,13 +1,23 @@
|
||||
"""Provides the type of an awaitable remove."""
|
||||
|
||||
from asyncio import Event
|
||||
from typing import Generator
|
||||
|
||||
|
||||
class AwaitRemove:
|
||||
"""An awaitable returned by App.remove and DOMQuery.remove."""
|
||||
|
||||
def __init__(self, finished_flag: Event) -> None:
|
||||
"""Initialise the instance of ``AwaitRemove``.
|
||||
|
||||
Args:
|
||||
finished_flag (asyncio.Event): The asyncio event to wait on.
|
||||
"""
|
||||
self.finished_flag = finished_flag
|
||||
|
||||
def __await__(self) -> Generator[None, None, None]:
|
||||
async def await_prune() -> None:
|
||||
"""Wait for the prune operation to finish."""
|
||||
await self.finished_flag.wait()
|
||||
|
||||
return await_prune().__await__()
|
||||
|
||||
Reference in New Issue
Block a user