mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from typing import Any, Callable, ContextManager, Generic, Iterable, Iterator, List, Mapping, Optional, TypeVar
|
||||
from typing import Any, Callable, ContextManager, Generic, Iterable, Iterator, List, Mapping, TypeVar
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
@@ -13,11 +13,11 @@ class ApplyResult(Generic[_T]):
|
||||
def __init__(
|
||||
self,
|
||||
pool: Pool,
|
||||
callback: Optional[Callable[[_T], None]] = ...,
|
||||
error_callback: Optional[Callable[[BaseException], None]] = ...,
|
||||
callback: Callable[[_T], None] | None = ...,
|
||||
error_callback: Callable[[BaseException], None] | None = ...,
|
||||
) -> None: ...
|
||||
def get(self, timeout: Optional[float] = ...) -> _T: ...
|
||||
def wait(self, timeout: Optional[float] = ...) -> None: ...
|
||||
def get(self, timeout: float | None = ...) -> _T: ...
|
||||
def wait(self, timeout: float | None = ...) -> None: ...
|
||||
def ready(self) -> bool: ...
|
||||
def successful(self) -> bool: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -30,19 +30,19 @@ class MapResult(ApplyResult[List[_T]]): ...
|
||||
|
||||
class IMapIterator(Iterator[_T]):
|
||||
def __iter__(self: _S) -> _S: ...
|
||||
def next(self, timeout: Optional[float] = ...) -> _T: ...
|
||||
def __next__(self, timeout: Optional[float] = ...) -> _T: ...
|
||||
def next(self, timeout: float | None = ...) -> _T: ...
|
||||
def __next__(self, timeout: float | None = ...) -> _T: ...
|
||||
|
||||
class IMapUnorderedIterator(IMapIterator[_T]): ...
|
||||
|
||||
class Pool(ContextManager[Pool]):
|
||||
def __init__(
|
||||
self,
|
||||
processes: Optional[int] = ...,
|
||||
initializer: Optional[Callable[..., None]] = ...,
|
||||
processes: int | None = ...,
|
||||
initializer: Callable[..., None] | None = ...,
|
||||
initargs: Iterable[Any] = ...,
|
||||
maxtasksperchild: Optional[int] = ...,
|
||||
context: Optional[Any] = ...,
|
||||
maxtasksperchild: int | None = ...,
|
||||
context: Any | None = ...,
|
||||
) -> None: ...
|
||||
def apply(self, func: Callable[..., _T], args: Iterable[Any] = ..., kwds: Mapping[str, Any] = ...) -> _T: ...
|
||||
def apply_async(
|
||||
@@ -50,30 +50,30 @@ class Pool(ContextManager[Pool]):
|
||||
func: Callable[..., _T],
|
||||
args: Iterable[Any] = ...,
|
||||
kwds: Mapping[str, Any] = ...,
|
||||
callback: Optional[Callable[[_T], None]] = ...,
|
||||
error_callback: Optional[Callable[[BaseException], None]] = ...,
|
||||
callback: Callable[[_T], None] | None = ...,
|
||||
error_callback: Callable[[BaseException], None] | None = ...,
|
||||
) -> AsyncResult[_T]: ...
|
||||
def map(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: Optional[int] = ...) -> List[_T]: ...
|
||||
def map(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = ...) -> List[_T]: ...
|
||||
def map_async(
|
||||
self,
|
||||
func: Callable[[_S], _T],
|
||||
iterable: Iterable[_S],
|
||||
chunksize: Optional[int] = ...,
|
||||
callback: Optional[Callable[[_T], None]] = ...,
|
||||
error_callback: Optional[Callable[[BaseException], None]] = ...,
|
||||
chunksize: int | None = ...,
|
||||
callback: Callable[[_T], None] | None = ...,
|
||||
error_callback: Callable[[BaseException], None] | None = ...,
|
||||
) -> MapResult[_T]: ...
|
||||
def imap(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: Optional[int] = ...) -> IMapIterator[_T]: ...
|
||||
def imap(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = ...) -> IMapIterator[_T]: ...
|
||||
def imap_unordered(
|
||||
self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: Optional[int] = ...
|
||||
self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = ...
|
||||
) -> IMapIterator[_T]: ...
|
||||
def starmap(self, func: Callable[..., _T], iterable: Iterable[Iterable[Any]], chunksize: Optional[int] = ...) -> List[_T]: ...
|
||||
def starmap(self, func: Callable[..., _T], iterable: Iterable[Iterable[Any]], chunksize: int | None = ...) -> List[_T]: ...
|
||||
def starmap_async(
|
||||
self,
|
||||
func: Callable[..., _T],
|
||||
iterable: Iterable[Iterable[Any]],
|
||||
chunksize: Optional[int] = ...,
|
||||
callback: Optional[Callable[[_T], None]] = ...,
|
||||
error_callback: Optional[Callable[[BaseException], None]] = ...,
|
||||
chunksize: int | None = ...,
|
||||
callback: Callable[[_T], None] | None = ...,
|
||||
error_callback: Callable[[BaseException], None] | None = ...,
|
||||
) -> AsyncResult[List[_T]]: ...
|
||||
def close(self) -> None: ...
|
||||
def terminate(self) -> None: ...
|
||||
@@ -82,7 +82,7 @@ class Pool(ContextManager[Pool]):
|
||||
|
||||
class ThreadPool(Pool, ContextManager[ThreadPool]):
|
||||
def __init__(
|
||||
self, processes: Optional[int] = ..., initializer: Optional[Callable[..., Any]] = ..., initargs: Iterable[Any] = ...
|
||||
self, processes: int | None = ..., initializer: Callable[..., Any] | None = ..., initargs: Iterable[Any] = ...
|
||||
) -> None: ...
|
||||
|
||||
# undocumented
|
||||
|
||||
Reference in New Issue
Block a user