mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-26 05:41:11 +08:00
stdlib: Add many missing dunder overrides (#7231)
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import queue
|
||||
import sys
|
||||
import threading
|
||||
from contextlib import AbstractContextManager
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import Any, AnyStr, Callable, Generic, Iterable, Mapping, Sequence, TypeVar
|
||||
|
||||
from .connection import Connection
|
||||
@@ -69,7 +70,7 @@ class Server:
|
||||
def serve_forever(self) -> None: ...
|
||||
def accept_connection(self, c: Connection, name: str) -> None: ...
|
||||
|
||||
class BaseManager(AbstractContextManager[BaseManager]):
|
||||
class BaseManager:
|
||||
def __init__(
|
||||
self, address: Any | None = ..., authkey: bytes | None = ..., serializer: str = ..., ctx: BaseContext | None = ...
|
||||
) -> None: ...
|
||||
@@ -90,12 +91,14 @@ class BaseManager(AbstractContextManager[BaseManager]):
|
||||
method_to_typeid: Mapping[str, str] | None = ...,
|
||||
create_method: bool = ...,
|
||||
) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, exc_type: type[BaseException], exc_val: BaseException, exc_tb: TracebackType) -> None: ...
|
||||
|
||||
# Conflicts with method names
|
||||
_dict = dict
|
||||
_list = list
|
||||
|
||||
class SyncManager(BaseManager, AbstractContextManager[SyncManager]):
|
||||
class SyncManager(BaseManager):
|
||||
def BoundedSemaphore(self, value: Any = ...) -> threading.BoundedSemaphore: ...
|
||||
def Condition(self, lock: Any = ...) -> threading.Condition: ...
|
||||
def Event(self) -> threading.Event: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from contextlib import AbstractContextManager
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, TypeVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
@@ -67,7 +67,7 @@ class IMapIterator(Iterator[_T]):
|
||||
|
||||
class IMapUnorderedIterator(IMapIterator[_T]): ...
|
||||
|
||||
class Pool(AbstractContextManager[Pool]):
|
||||
class Pool:
|
||||
def __init__(
|
||||
self,
|
||||
processes: int | None = ...,
|
||||
@@ -111,8 +111,9 @@ class Pool(AbstractContextManager[Pool]):
|
||||
def terminate(self) -> None: ...
|
||||
def join(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, exc_type: type[BaseException], exc_val: BaseException, exc_tb: TracebackType) -> None: ...
|
||||
|
||||
class ThreadPool(Pool, AbstractContextManager[ThreadPool]):
|
||||
class ThreadPool(Pool):
|
||||
def __init__(
|
||||
self, processes: int | None = ..., initializer: Callable[..., Any] | None = ..., initargs: Iterable[Any] = ...
|
||||
) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user