forked from goodboy/tractor
1
0
Fork 0

Change all `| None` -> `|None` in `._runtime`

asyncio_debug_mode
Tyler Goodlet 2024-03-25 14:15:36 -04:00
parent 2588e54867
commit 507cd96904
1 changed files with 20 additions and 20 deletions

View File

@ -140,16 +140,16 @@ class Actor:
msg_buffer_size: int = 2**6 msg_buffer_size: int = 2**6
# nursery placeholders filled in by `async_main()` after fork # nursery placeholders filled in by `async_main()` after fork
_root_n: Nursery | None = None _root_n: Nursery|None = None
_service_n: Nursery | None = None _service_n: Nursery|None = None
_server_n: Nursery | None = None _server_n: Nursery|None = None
# Information about `__main__` from parent # Information about `__main__` from parent
_parent_main_data: dict[str, str] _parent_main_data: dict[str, str]
_parent_chan_cs: CancelScope | None = None _parent_chan_cs: CancelScope|None = None
# syncs for setup/teardown sequences # syncs for setup/teardown sequences
_server_down: trio.Event | None = None _server_down: trio.Event|None = None
# user toggled crash handling (including monkey-patched in # user toggled crash handling (including monkey-patched in
# `trio.open_nursery()` via `.trionics._supervisor` B) # `trio.open_nursery()` via `.trionics._supervisor` B)
@ -178,7 +178,7 @@ class Actor:
spawn_method: str|None = None, spawn_method: str|None = None,
# TODO: remove! # TODO: remove!
arbiter_addr: tuple[str, int] | None = None, arbiter_addr: tuple[str, int]|None = None,
) -> None: ) -> None:
''' '''
@ -193,7 +193,7 @@ class Actor:
) )
self._cancel_complete = trio.Event() self._cancel_complete = trio.Event()
self._cancel_called_by_remote: tuple[str, tuple] | None = None self._cancel_called_by_remote: tuple[str, tuple]|None = None
self._cancel_called: bool = False self._cancel_called: bool = False
# retreive and store parent `__main__` data which # retreive and store parent `__main__` data which
@ -249,11 +249,11 @@ class Actor:
] = {} ] = {}
self._listeners: list[trio.abc.Listener] = [] self._listeners: list[trio.abc.Listener] = []
self._parent_chan: Channel | None = None self._parent_chan: Channel|None = None
self._forkserver_info: tuple | None = None self._forkserver_info: tuple|None = None
self._actoruid2nursery: dict[ self._actoruid2nursery: dict[
tuple[str, str], tuple[str, str],
ActorNursery | None, ActorNursery|None,
] = {} # type: ignore # noqa ] = {} # type: ignore # noqa
# when provided, init the registry addresses property from # when provided, init the registry addresses property from
@ -779,7 +779,7 @@ class Actor:
# #
# side: str|None = None, # side: str|None = None,
msg_buffer_size: int | None = None, msg_buffer_size: int|None = None,
allow_overruns: bool = False, allow_overruns: bool = False,
) -> Context: ) -> Context:
@ -844,7 +844,7 @@ class Actor:
kwargs: dict, kwargs: dict,
# IPC channel config # IPC channel config
msg_buffer_size: int | None = None, msg_buffer_size: int|None = None,
allow_overruns: bool = False, allow_overruns: bool = False,
load_nsf: bool = False, load_nsf: bool = False,
@ -918,11 +918,11 @@ class Actor:
async def _from_parent( async def _from_parent(
self, self,
parent_addr: tuple[str, int] | None, parent_addr: tuple[str, int]|None,
) -> tuple[ ) -> tuple[
Channel, Channel,
list[tuple[str, int]] | None, list[tuple[str, int]]|None,
]: ]:
''' '''
Bootstrap this local actor's runtime config from its parent by Bootstrap this local actor's runtime config from its parent by
@ -943,7 +943,7 @@ class Actor:
# Initial handshake: swap names. # Initial handshake: swap names.
await self._do_handshake(chan) await self._do_handshake(chan)
accept_addrs: list[tuple[str, int]] | None = None accept_addrs: list[tuple[str, int]]|None = None
if self._spawn_method == "trio": if self._spawn_method == "trio":
# Receive runtime state from our parent # Receive runtime state from our parent
parent_data: dict[str, Any] parent_data: dict[str, Any]
@ -1007,7 +1007,7 @@ class Actor:
handler_nursery: Nursery, handler_nursery: Nursery,
*, *,
# (host, port) to bind for channel server # (host, port) to bind for channel server
listen_sockaddrs: list[tuple[str, int]] | None = None, listen_sockaddrs: list[tuple[str, int]]|None = None,
task_status: TaskStatus[Nursery] = trio.TASK_STATUS_IGNORED, task_status: TaskStatus[Nursery] = trio.TASK_STATUS_IGNORED,
) -> None: ) -> None:
@ -1464,7 +1464,7 @@ class Actor:
async def async_main( async def async_main(
actor: Actor, actor: Actor,
accept_addrs: tuple[str, int] | None = None, accept_addrs: tuple[str, int]|None = None,
# XXX: currently ``parent_addr`` is only needed for the # XXX: currently ``parent_addr`` is only needed for the
# ``multiprocessing`` backend (which pickles state sent to # ``multiprocessing`` backend (which pickles state sent to
@ -1473,7 +1473,7 @@ async def async_main(
# change this to a simple ``is_subactor: bool`` which will # change this to a simple ``is_subactor: bool`` which will
# be False when running as root actor and True when as # be False when running as root actor and True when as
# a subactor. # a subactor.
parent_addr: tuple[str, int] | None = None, parent_addr: tuple[str, int]|None = None,
task_status: TaskStatus[None] = trio.TASK_STATUS_IGNORED, task_status: TaskStatus[None] = trio.TASK_STATUS_IGNORED,
) -> None: ) -> None:
@ -1496,7 +1496,7 @@ async def async_main(
try: try:
# establish primary connection with immediate parent # establish primary connection with immediate parent
actor._parent_chan: Channel | None = None actor._parent_chan: Channel|None = None
if parent_addr is not None: if parent_addr is not None:
( (
@ -1795,7 +1795,7 @@ class Arbiter(Actor):
self, self,
name: str, name: str,
) -> tuple[str, int] | None: ) -> tuple[str, int]|None:
for uid, sockaddr in self._registry.items(): for uid, sockaddr in self._registry.items():
if name in uid: if name in uid: