Module csw.EventSubscription

Classes

class EventSubscription (t: _asyncio.Task, f: Callable[[], Awaitable])
Expand source code
class EventSubscription:
    """
    Return value from EventSubscriber.subscribe(): Can be used to unsubscribe from an event.
    """
    def __init__(self, t: Task, f: Callable[[], Awaitable]):
        self.t = t
        self.f = f

    async def unsubscribe(self):
        await self.f()
        self.t.cancel()

Return value from EventSubscriber.subscribe(): Can be used to unsubscribe from an event.

Methods

async def unsubscribe(self)
Expand source code
async def unsubscribe(self):
    await self.f()
    self.t.cancel()