Compare commits
No commits in common. "d28c7e17c650a356868eaf7f738965dfbd5afbc1" and "58cc57a422459970b2ad78e9dc0e86337a8b6d6d" have entirely different histories.
d28c7e17c6
...
58cc57a422
1118
tractor/_rpc.py
1118
tractor/_rpc.py
File diff suppressed because it is too large
Load Diff
1184
tractor/_runtime.py
1184
tractor/_runtime.py
File diff suppressed because it is too large
Load Diff
|
@ -26,6 +26,7 @@ from contextlib import asynccontextmanager
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from operator import ne
|
from operator import ne
|
||||||
from typing import (
|
from typing import (
|
||||||
|
Optional,
|
||||||
Callable,
|
Callable,
|
||||||
Awaitable,
|
Awaitable,
|
||||||
Any,
|
Any,
|
||||||
|
@ -44,11 +45,6 @@ from tractor.log import get_logger
|
||||||
|
|
||||||
log = get_logger(__name__)
|
log = get_logger(__name__)
|
||||||
|
|
||||||
# TODO: use new type-vars syntax from 3.12
|
|
||||||
# https://realpython.com/python312-new-features/#dedicated-type-variable-syntax
|
|
||||||
# https://docs.python.org/3/whatsnew/3.12.html#whatsnew312-pep695
|
|
||||||
# https://docs.python.org/3/reference/simple_stmts.html#type
|
|
||||||
#
|
|
||||||
# A regular invariant generic type
|
# A regular invariant generic type
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
||||||
|
@ -114,7 +110,7 @@ class BroadcastState(Struct):
|
||||||
|
|
||||||
# broadcast event to wake up all sleeping consumer tasks
|
# broadcast event to wake up all sleeping consumer tasks
|
||||||
# on a newly produced value from the sender.
|
# on a newly produced value from the sender.
|
||||||
recv_ready: tuple[int, trio.Event]|None = None
|
recv_ready: Optional[tuple[int, trio.Event]] = None
|
||||||
|
|
||||||
# if a ``trio.EndOfChannel`` is received on any
|
# if a ``trio.EndOfChannel`` is received on any
|
||||||
# consumer all consumers should be placed in this state
|
# consumer all consumers should be placed in this state
|
||||||
|
@ -168,7 +164,7 @@ class BroadcastReceiver(ReceiveChannel):
|
||||||
|
|
||||||
rx_chan: AsyncReceiver,
|
rx_chan: AsyncReceiver,
|
||||||
state: BroadcastState,
|
state: BroadcastState,
|
||||||
receive_afunc: Callable[[], Awaitable[Any]]|None = None,
|
receive_afunc: Optional[Callable[[], Awaitable[Any]]] = None,
|
||||||
raise_on_lag: bool = True,
|
raise_on_lag: bool = True,
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -456,7 +452,7 @@ def broadcast_receiver(
|
||||||
|
|
||||||
recv_chan: AsyncReceiver,
|
recv_chan: AsyncReceiver,
|
||||||
max_buffer_size: int,
|
max_buffer_size: int,
|
||||||
receive_afunc: Callable[[], Awaitable[Any]]|None = None,
|
receive_afunc: Optional[Callable[[], Awaitable[Any]]] = None,
|
||||||
raise_on_lag: bool = True,
|
raise_on_lag: bool = True,
|
||||||
|
|
||||||
) -> BroadcastReceiver:
|
) -> BroadcastReceiver:
|
||||||
|
|
Loading…
Reference in New Issue