From ae6f49adc9d4df0d2541630af36d3cdf2e285eec Mon Sep 17 00:00:00 2001 From: Guo Ci Date: Sat, 7 Feb 2026 22:16:36 -0500 Subject: [PATCH] [stdlib/enum] add `enum.bin` (#15388) docs: https://docs.python.org/dev/library/enum.html#enum.bin source: https://github.com/python/cpython/blob/3.11/Lib/enum.py#L132-L154 --- stdlib/enum.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index c6cc5a961..f9b53e1d4 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -4,7 +4,7 @@ import types from _typeshed import SupportsKeysAndGetItem, Unused from builtins import 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, overload from typing_extensions import Self, TypeAlias, disjoint_base __all__ = ["EnumMeta", "Enum", "IntEnum", "Flag", "IntFlag", "auto", "unique"] @@ -311,6 +311,7 @@ if sys.version_info >= (3, 11): def global_enum_repr(self: Enum) -> str: ... def global_flag_repr(self: Flag) -> str: ... def show_flag_values(value: int) -> list[int]: ... + def bin(num: SupportsIndex, max_bits: int | None = None) -> str: ... if sys.version_info >= (3, 12): # The body of the class is the same, but the base classes are different.