diff --git a/stdlib/@python2/abc.pyi b/stdlib/@python2/abc.pyi index 0bf046a4d..ac14246d4 100644 --- a/stdlib/@python2/abc.pyi +++ b/stdlib/@python2/abc.pyi @@ -1,4 +1,5 @@ import _weakrefset +from _typeshed import SupportsWrite from typing import Any, Callable, Dict, Set, Tuple, Type, TypeVar _FuncT = TypeVar("_FuncT", bound=Callable[..., Any]) @@ -8,17 +9,16 @@ _FuncT = TypeVar("_FuncT", bound=Callable[..., Any]) def abstractmethod(funcobj: _FuncT) -> _FuncT: ... class ABCMeta(type): - # TODO: FrozenSet - __abstractmethods__: Set[Any] + __abstractmethods__: frozenset[str] _abc_cache: _weakrefset.WeakSet[Any] _abc_invalidation_counter: int _abc_negative_cache: _weakrefset.WeakSet[Any] _abc_negative_cache_version: int _abc_registry: _weakrefset.WeakSet[Any] - def __init__(self, name: str, bases: Tuple[type, ...], namespace: Dict[Any, Any]) -> None: ... + def __init__(self, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> None: ... def __instancecheck__(cls: ABCMeta, instance: Any) -> Any: ... def __subclasscheck__(cls: ABCMeta, subclass: Any) -> Any: ... - def _dump_registry(cls: ABCMeta, *args: Any, **kwargs: Any) -> None: ... + def _dump_registry(cls: ABCMeta, file: SupportsWrite[Any] | None = ...) -> None: ... def register(cls: ABCMeta, subclass: Type[Any]) -> None: ... # TODO: The real abc.abstractproperty inherits from "property". diff --git a/stdlib/abc.pyi b/stdlib/abc.pyi index 5dd21763a..bf98d5364 100644 --- a/stdlib/abc.pyi +++ b/stdlib/abc.pyi @@ -1,10 +1,16 @@ -from typing import Any, Callable, Type, TypeVar +from _typeshed import SupportsWrite +from typing import Any, Callable, Dict, Tuple, Type, TypeVar _T = TypeVar("_T") _FuncT = TypeVar("_FuncT", bound=Callable[..., Any]) # These definitions have special processing in mypy class ABCMeta(type): + __abstractmethods__: frozenset[str] + def __init__(self, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> None: ... + def __instancecheck__(cls: ABCMeta, instance: Any) -> Any: ... + def __subclasscheck__(cls: ABCMeta, subclass: Any) -> Any: ... + def _dump_registry(cls: ABCMeta, file: SupportsWrite[str] | None = ...) -> None: ... def register(cls: ABCMeta, subclass: Type[_T]) -> Type[_T]: ... def abstractmethod(funcobj: _FuncT) -> _FuncT: ...