diff --git a/stubs/contextvars/contextvars.pyi b/stubs/contextvars/contextvars.pyi index bf2139c62..4c9011993 100644 --- a/stubs/contextvars/contextvars.pyi +++ b/stubs/contextvars/contextvars.pyi @@ -1,6 +1,6 @@ import sys from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar -from typing_extensions import ParamSpec +from typing_extensions import ParamSpec, final if sys.version_info >= (3, 9): from types import GenericAlias @@ -8,6 +8,7 @@ if sys.version_info >= (3, 9): _T = TypeVar("_T") _P = ParamSpec("_P") +@final class ContextVar(Generic[_T]): def __init__(self, name: str, *, default: _T = ...) -> None: ... @property @@ -18,6 +19,7 @@ class ContextVar(Generic[_T]): if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... +@final class Token(Generic[_T]): @property def var(self) -> ContextVar[_T]: ... @@ -31,6 +33,7 @@ def copy_context() -> Context: ... # It doesn't make sense to make this generic, because for most Contexts each ContextVar will have # a different value. +@final class Context(Mapping[ContextVar[Any], Any]): def __init__(self) -> None: ... def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ... diff --git a/stubs/pycurl/pycurl.pyi b/stubs/pycurl/pycurl.pyi index e73b4e125..c1f0bdcfc 100644 --- a/stubs/pycurl/pycurl.pyi +++ b/stubs/pycurl/pycurl.pyi @@ -1,6 +1,5 @@ -# TODO(MichalPokorny): more precise types - from typing import Any, Text +from typing_extensions import final GLOBAL_ACK_EINTR: int GLOBAL_ALL: int @@ -18,6 +17,7 @@ def version_info() -> tuple[int, str, int, str, int, str, int, str, tuple[str, . class error(Exception): ... +@final class Curl: def close(self) -> None: ... def setopt(self, option: int, value: Any) -> None: ... @@ -34,6 +34,7 @@ class Curl: # TODO(MichalPokorny): wat? USERPWD: int +@final class CurlMulti: def close(self) -> None: ... def add_handle(self, obj: Curl) -> None: ... @@ -44,6 +45,7 @@ class CurlMulti: def info_read(self, max_objects: int = ...) -> tuple[int, list[Any], list[Any]]: ... def socket_action(self, sockfd: int, ev_bitmask: int) -> tuple[int, int]: ... +@final class CurlShare: def close(self) -> None: ... def setopt(self, option: int, value: Any) -> Any: ...