mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-28 14:46:55 +08:00
Use StrEnum as base class, when available (#11100)
This commit is contained in:
@@ -320,3 +320,12 @@ class DataclassInstance(Protocol):
|
||||
# Anything that can be passed to the int/float constructors
|
||||
ConvertibleToInt: TypeAlias = str | ReadableBuffer | SupportsInt | SupportsIndex | SupportsTrunc
|
||||
ConvertibleToFloat: TypeAlias = str | ReadableBuffer | SupportsFloat | SupportsIndex
|
||||
|
||||
# A few classes updated from Foo(str, Enum) to Foo(StrEnum). This is a convenience so these
|
||||
# can be accurate on all python versions without getting too wordy
|
||||
if sys.version_info >= (3, 11):
|
||||
from enum import StrEnum as StrEnum
|
||||
else:
|
||||
from enum import Enum
|
||||
|
||||
class StrEnum(str, Enum): ...
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import StrOrBytesPath
|
||||
from _typeshed import StrEnum, StrOrBytesPath
|
||||
from collections.abc import Iterable
|
||||
from cProfile import Profile as _cProfile
|
||||
from enum import Enum
|
||||
from profile import Profile
|
||||
from typing import IO, Any, overload
|
||||
from typing_extensions import Literal, Self, TypeAlias
|
||||
@@ -14,7 +13,7 @@ else:
|
||||
|
||||
_Selector: TypeAlias = str | float | int
|
||||
|
||||
class SortKey(str, Enum):
|
||||
class SortKey(StrEnum):
|
||||
CALLS: str
|
||||
CUMULATIVE: str
|
||||
FILENAME: str
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import _tkinter
|
||||
import sys
|
||||
from _typeshed import Incomplete, StrOrBytesPath
|
||||
from _typeshed import Incomplete, StrEnum, StrOrBytesPath
|
||||
from collections.abc import Callable, Mapping, Sequence
|
||||
from enum import Enum
|
||||
from tkinter.constants import *
|
||||
from tkinter.font import _FontDescription
|
||||
from types import TracebackType
|
||||
@@ -195,7 +194,7 @@ if sys.version_info >= (3, 11):
|
||||
releaselevel: str
|
||||
serial: int
|
||||
|
||||
class EventType(str, Enum):
|
||||
class EventType(StrEnum):
|
||||
Activate: str
|
||||
ButtonPress: str
|
||||
Button = ButtonPress
|
||||
|
||||
Reference in New Issue
Block a user