🌐 AI搜索 & 代理 主页
Skip to content
Draft
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
113 changes: 111 additions & 2 deletions stdlib/enum.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import _typeshed
import sys
import types
from _typeshed import SupportsKeysAndGetItem, Unused
from builtins import property as _builtins_property
from builtins import _NegativeInteger, _PositiveInteger, property as _builtins_property
from collections.abc import Callable, Iterable, Iterator, Mapping
from typing import Any, Final, Generic, Literal, TypeVar, overload
from typing import Any, Final, Generic, Literal, SupportsIndex, TypeVar, final, overload
from typing_extensions import Self, TypeAlias, disjoint_base

__all__ = ["EnumMeta", "Enum", "IntEnum", "Flag", "IntFlag", "auto", "unique"]
Expand Down Expand Up @@ -233,7 +233,116 @@ if sys.version_info >= (3, 12):
_value_: int
@_magic_enum_attr
def value(self) -> int: ...
@final
def __new__(cls, value: int) -> Self: ...
@final
def __add__(self, value: int, /) -> int: ...
@final
def __sub__(self, value: int, /) -> int: ...
@final
def __mul__(self, value: int, /) -> int: ...
@final
def __floordiv__(self, value: int, /) -> int: ...
@final
def __truediv__(self, value: int, /) -> float: ...
@final
def __mod__(self, value: int, /) -> int: ...
@final
def __divmod__(self, value: int, /) -> tuple[int, int]: ...
@final
def __radd__(self, value: int, /) -> int: ...
@final
def __rsub__(self, value: int, /) -> int: ...
@final
def __rmul__(self, value: int, /) -> int: ...
@final
def __rfloordiv__(self, value: int, /) -> int: ...
@final
def __rtruediv__(self, value: int, /) -> float: ...
@final
def __rmod__(self, value: int, /) -> int: ...
@final
def __rdivmod__(self, value: int, /) -> tuple[int, int]: ...
@overload
@final
def __pow__(self, x: Literal[0], /) -> Literal[1]: ...
@overload
def __pow__(self, value: Literal[0], mod: None, /) -> Literal[1]: ...
@overload
def __pow__(self, value: _PositiveInteger, mod: None = None, /) -> int: ...
@overload
def __pow__(self, value: _NegativeInteger, mod: None = None, /) -> float: ...
# positive __value -> int; negative __value -> float
# return type must be Any as `int | float` causes too many false-positive errors
@overload
def __pow__(self, value: int, mod: None = None, /) -> Any: ...
@overload
def __pow__(self, value: int, mod: int, /) -> int: ...
@final
def __rpow__(self, value: int, mod: int | None = None, /) -> Any: ...
@final
def __and__(self, value: int, /) -> int: ...
@final
def __or__(self, value: int, /) -> int: ...
@final
def __xor__(self, value: int, /) -> int: ...
@final
def __lshift__(self, value: int, /) -> int: ...
@final
def __rshift__(self, value: int, /) -> int: ...
@final
def __rand__(self, value: int, /) -> int: ...
@final
def __ror__(self, value: int, /) -> int: ...
@final
def __rxor__(self, value: int, /) -> int: ...
@final
def __rlshift__(self, value: int, /) -> int: ...
@final
def __rrshift__(self, value: int, /) -> int: ...
@final
def __neg__(self) -> int: ...
@final
def __pos__(self) -> int: ...
@final
def __invert__(self) -> int: ...
@final
def __trunc__(self) -> int: ...
@final
def __ceil__(self) -> int: ...
@final
def __floor__(self) -> int: ...
if sys.version_info >= (3, 14):
@final
def __round__(self, ndigits: SupportsIndex | None = None, /) -> int: ...
else:
@final
def __round__(self, ndigits: SupportsIndex = ..., /) -> int: ...

@final
def __eq__(self, value: object, /) -> bool: ...
@final
def __ne__(self, value: object, /) -> bool: ...
@final
def __lt__(self, value: int, /) -> bool: ...
@final
def __le__(self, value: int, /) -> bool: ...
@final
def __gt__(self, value: int, /) -> bool: ...
@final
def __ge__(self, value: int, /) -> bool: ...
@final
def __float__(self) -> float: ...
@final
def __int__(self) -> int: ...
@final
def __abs__(self) -> int: ...
@final
def __hash__(self) -> int: ...
@final
def __bool__(self) -> bool: ...
@final
def __index__(self) -> int: ...

else:
if sys.version_info >= (3, 11):
Expand Down