Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stubs for operator.is_none and operator.is_not_none #12535

Merged
merged 5 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion stdlib/_operator.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sys
from _typeshed import SupportsGetItem
from collections.abc import Callable, Container, Iterable, MutableMapping, MutableSequence, Sequence
from typing import Any, AnyStr, Generic, Protocol, SupportsAbs, SupportsIndex, TypeVar, final, overload
from typing_extensions import ParamSpec, TypeAlias, TypeVarTuple, Unpack
from typing_extensions import ParamSpec, TypeAlias, TypeIs, TypeVarTuple, Unpack

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

def _compare_digest(a: AnyStr, b: AnyStr, /) -> bool: ...

if sys.version_info >= (3, 14):
def is_none(a: object, /) -> TypeIs[None]: ...
def is_not_none(a: _T | None, /) -> TypeIs[_T]: ...
3 changes: 3 additions & 0 deletions stdlib/operator.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ __all__ = [
if sys.version_info >= (3, 11):
__all__ += ["call"]

if sys.version_info >= (3, 14):
__all__ += ["is_none", "is_not_none"]

__lt__ = lt
__le__ = le
__eq__ = eq
Expand Down