Skip to content

Commit eb8e9dd

Browse files
ZeroIntensityAkuli
andauthored
Add stubs for operator.is_none and operator.is_not_none (#12535)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
1 parent 82da1e1 commit eb8e9dd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

stdlib/_operator.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import sys
22
from _typeshed import SupportsGetItem
33
from collections.abc import Callable, Container, Iterable, MutableMapping, MutableSequence, Sequence
44
from typing import Any, AnyStr, Generic, Protocol, SupportsAbs, SupportsIndex, TypeVar, final, overload
5-
from typing_extensions import ParamSpec, TypeAlias, TypeVarTuple, Unpack
5+
from typing_extensions import ParamSpec, TypeAlias, TypeIs, TypeVarTuple, Unpack
66

77
_R = TypeVar("_R")
88
_T = TypeVar("_T")
@@ -145,3 +145,7 @@ if sys.version_info >= (3, 11):
145145
def call(obj: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
146146

147147
def _compare_digest(a: AnyStr, b: AnyStr, /) -> bool: ...
148+
149+
if sys.version_info >= (3, 14):
150+
def is_none(a: object, /) -> TypeIs[None]: ...
151+
def is_not_none(a: _T | None, /) -> TypeIs[_T]: ...

stdlib/operator.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ __all__ = [
6161
if sys.version_info >= (3, 11):
6262
__all__ += ["call"]
6363

64+
if sys.version_info >= (3, 14):
65+
__all__ += ["is_none", "is_not_none"]
66+
6467
__lt__ = lt
6568
__le__ = le
6669
__eq__ = eq

0 commit comments

Comments
 (0)