chore: format code
This commit is contained in:
parent
a49fe64be8
commit
7b34426c82
5 changed files with 26 additions and 63 deletions
|
|
@ -1,12 +1,4 @@
|
|||
from typing import (
|
||||
Any,
|
||||
Awaitable,
|
||||
Callable,
|
||||
Generic,
|
||||
Literal,
|
||||
TypeVar,
|
||||
overload,
|
||||
)
|
||||
from typing import Any, Awaitable, Callable, Generic, Literal, TypeVar, overload
|
||||
|
||||
from .base_bindable import BaseBindable, BindableSubscriber, ValueChanged
|
||||
|
||||
|
|
@ -66,25 +58,19 @@ class AsyncBindable(BaseBindable[T], Generic[T]):
|
|||
if run_now:
|
||||
|
||||
async def _run() -> None:
|
||||
await subscriber(
|
||||
ValueChanged(self.__default_value, self.value)
|
||||
)
|
||||
await subscriber(ValueChanged(self.__default_value, self.value))
|
||||
|
||||
return _run()
|
||||
return None
|
||||
|
||||
def unsubscribe(
|
||||
self, subscriber: BindableSubscriber[T, Awaitable[Any]]
|
||||
) -> None:
|
||||
def unsubscribe(self, subscriber: BindableSubscriber[T, Awaitable[Any]]) -> None:
|
||||
"""Unsubscribe from an value."""
|
||||
self.__subscribers.remove(subscriber)
|
||||
|
||||
@overload
|
||||
def on(
|
||||
self, run_now: Literal[True]
|
||||
) -> Callable[
|
||||
[BindableSubscriber[T, Awaitable[Any]]], Awaitable[None]
|
||||
]: ...
|
||||
) -> Callable[[BindableSubscriber[T, Awaitable[Any]]], Awaitable[None]]: ...
|
||||
|
||||
@overload
|
||||
def on(
|
||||
|
|
@ -104,9 +90,7 @@ class AsyncBindable(BaseBindable[T], Generic[T]):
|
|||
if run_now:
|
||||
|
||||
async def _run() -> None:
|
||||
await subscriber(
|
||||
ValueChanged(self.__default_value, self.value)
|
||||
)
|
||||
await subscriber(ValueChanged(self.__default_value, self.value))
|
||||
|
||||
return _run()
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue