forked from goodboy/tractor
				
			Fix typing
							parent
							
								
									7c151bed48
								
							
						
					
					
						commit
						8901272854
					
				| 
						 | 
					@ -18,8 +18,7 @@
 | 
				
			||||||
Actor discovery API.
 | 
					Actor discovery API.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
import typing
 | 
					from typing import Tuple, Optional, Union, AsyncGenerator
 | 
				
			||||||
from typing import Tuple, Optional, Union
 | 
					 | 
				
			||||||
from contextlib import asynccontextmanager as acm
 | 
					from contextlib import asynccontextmanager as acm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from ._ipc import _connect_chan, Channel
 | 
					from ._ipc import _connect_chan, Channel
 | 
				
			||||||
| 
						 | 
					@ -37,7 +36,7 @@ async def get_arbiter(
 | 
				
			||||||
    host: str,
 | 
					    host: str,
 | 
				
			||||||
    port: int,
 | 
					    port: int,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
) -> typing.AsyncGenerator[Union[Portal, LocalPortal], None]:
 | 
					) -> AsyncGenerator[Union[Portal, LocalPortal], None]:
 | 
				
			||||||
    '''Return a portal instance connected to a local or remote
 | 
					    '''Return a portal instance connected to a local or remote
 | 
				
			||||||
    arbiter.
 | 
					    arbiter.
 | 
				
			||||||
    '''
 | 
					    '''
 | 
				
			||||||
| 
						 | 
					@ -61,7 +60,7 @@ async def get_arbiter(
 | 
				
			||||||
@acm
 | 
					@acm
 | 
				
			||||||
async def get_root(
 | 
					async def get_root(
 | 
				
			||||||
    **kwargs,
 | 
					    **kwargs,
 | 
				
			||||||
) -> typing.AsyncGenerator[Portal, None]:
 | 
					) -> AsyncGenerator[Portal, None]:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    host, port = _runtime_vars['_root_mailbox']
 | 
					    host, port = _runtime_vars['_root_mailbox']
 | 
				
			||||||
    assert host is not None
 | 
					    assert host is not None
 | 
				
			||||||
| 
						 | 
					@ -74,9 +73,9 @@ async def get_root(
 | 
				
			||||||
@acm
 | 
					@acm
 | 
				
			||||||
async def query_actor(
 | 
					async def query_actor(
 | 
				
			||||||
    name: str,
 | 
					    name: str,
 | 
				
			||||||
    arbiter_sockaddr: Tuple[str, int] = None,
 | 
					    arbiter_sockaddr: Optional[tuple[str, int]] = None,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
) -> tuple[str, int]:
 | 
					) -> AsyncGenerator[tuple[str, int], None]:
 | 
				
			||||||
    '''
 | 
					    '''
 | 
				
			||||||
    Simple address lookup for a given actor name.
 | 
					    Simple address lookup for a given actor name.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,7 +106,7 @@ async def find_actor(
 | 
				
			||||||
    name: str,
 | 
					    name: str,
 | 
				
			||||||
    arbiter_sockaddr: Tuple[str, int] = None
 | 
					    arbiter_sockaddr: Tuple[str, int] = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
) -> typing.AsyncGenerator[Optional[Portal], None]:
 | 
					) -> AsyncGenerator[Optional[Portal], None]:
 | 
				
			||||||
    '''
 | 
					    '''
 | 
				
			||||||
    Ask the arbiter to find actor(s) by name.
 | 
					    Ask the arbiter to find actor(s) by name.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -132,7 +131,7 @@ async def find_actor(
 | 
				
			||||||
async def wait_for_actor(
 | 
					async def wait_for_actor(
 | 
				
			||||||
    name: str,
 | 
					    name: str,
 | 
				
			||||||
    arbiter_sockaddr: Tuple[str, int] = None
 | 
					    arbiter_sockaddr: Tuple[str, int] = None
 | 
				
			||||||
) -> typing.AsyncGenerator[Portal, None]:
 | 
					) -> AsyncGenerator[Portal, None]:
 | 
				
			||||||
    """Wait on an actor to register with the arbiter.
 | 
					    """Wait on an actor to register with the arbiter.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    A portal to the first registered actor is returned.
 | 
					    A portal to the first registered actor is returned.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue