Allow passing lambdas as init arguments in multiprocessing (#1416)

* Use NoReturn in multiprocessing init functions
* Use Any for init functions
This commit is contained in:
Luka Sterbic
2017-06-19 14:45:57 +01:00
committed by Matthias Kramm
parent d5eb32d67e
commit 4a8a20f04e
3 changed files with 3 additions and 4 deletions

View File

@@ -49,14 +49,13 @@ class BaseContext(object):
def JoinableQueue(self, maxsize: int = ...) -> Any: ...
# TODO: change return to SimpleQueue once a stub exists in multiprocessing.queues
def SimpleQueue(self) -> Any: ...
# TODO: change return to Pool once a stub exists in multiprocessing.pool
def Pool(
self,
processes: Optional[int] = ...,
initializer: Optional[Callable[..., Any]] = ...,
initargs: Tuple = ...,
maxtasksperchild: Optional[int] = ...
) -> Any: ...
) -> multiprocessing.Pool: ...
# TODO: typecode_or_type param is a ctype with a base class of _SimpleCData or array.typecode Need to figure out
# how to handle the ctype
# TODO: change return to RawValue once a stub exists in multiprocessing.sharedctypes

View File

@@ -19,7 +19,7 @@ _Namespace = Namespace
class BaseManager:
def register(self, typeid: str, callable: Any = ...) -> None: ...
def shutdown(self) -> None: ...
def start(self, initializer: Optional[Callable[..., None]] = ...,
def start(self, initializer: Optional[Callable[..., Any]] = ...,
initargs: Iterable[Any] = ...) -> None: ...
def __enter__(self) -> 'BaseManager': ...
def __exit__(self, exc_type, exc_value, tb) -> None: ...

View File

@@ -12,7 +12,7 @@ class AsyncResult():
class ThreadPool():
def __init__(self, processes: Optional[int] = None,
initializer: Optional[Callable[..., None]] = None,
initializer: Optional[Callable[..., Any]] = None,
initargs: Iterable[Any] = ...) -> None: ...
def apply(self,
func: Callable[..., Any],