File tree Expand file tree Collapse file tree 7 files changed +25
-10
lines changed
tests/stubtest_allowlists Expand file tree Collapse file tree 7 files changed +25
-10
lines changed Original file line number Diff line number Diff line change @@ -320,3 +320,12 @@ class DataclassInstance(Protocol):
320
320
# Anything that can be passed to the int/float constructors
321
321
ConvertibleToInt : TypeAlias = str | ReadableBuffer | SupportsInt | SupportsIndex | SupportsTrunc
322
322
ConvertibleToFloat : TypeAlias = str | ReadableBuffer | SupportsFloat | SupportsIndex
323
+
324
+ # A few classes updated from Foo(str, Enum) to Foo(StrEnum). This is a convenience so these
325
+ # can be accurate on all python versions without getting too wordy
326
+ if sys .version_info >= (3 , 11 ):
327
+ from enum import StrEnum as StrEnum
328
+ else :
329
+ from enum import Enum
330
+
331
+ class StrEnum (str , Enum ): ...
Original file line number Diff line number Diff line change 1
1
import sys
2
- from _typeshed import StrOrBytesPath
2
+ from _typeshed import StrEnum , StrOrBytesPath
3
3
from collections .abc import Iterable
4
4
from cProfile import Profile as _cProfile
5
- from enum import Enum
6
5
from profile import Profile
7
6
from typing import IO , Any , overload
8
7
from typing_extensions import Literal , Self , TypeAlias
14
13
15
14
_Selector : TypeAlias = str | float | int
16
15
17
- class SortKey (str , Enum ):
16
+ class SortKey (StrEnum ):
18
17
CALLS : str
19
18
CUMULATIVE : str
20
19
FILENAME : str
Original file line number Diff line number Diff line change 1
1
import _tkinter
2
2
import sys
3
- from _typeshed import Incomplete , StrOrBytesPath
3
+ from _typeshed import Incomplete , StrEnum , StrOrBytesPath
4
4
from collections .abc import Callable , Mapping , Sequence
5
- from enum import Enum
6
5
from tkinter .constants import *
7
6
from tkinter .font import _FontDescription
8
7
from types import TracebackType
@@ -195,7 +194,7 @@ if sys.version_info >= (3, 11):
195
194
releaselevel : str
196
195
serial : int
197
196
198
- class EventType (str , Enum ):
197
+ class EventType (StrEnum ):
199
198
Activate : str
200
199
ButtonPress : str
201
200
Button = ButtonPress
Original file line number Diff line number Diff line change @@ -172,3 +172,7 @@ pkgutil.ImpImporter\..*
172
172
pkgutil.ImpLoader\..*
173
173
174
174
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime
175
+
176
+ # These enums derive from (str, Enum)
177
+ pstats.SortKey.__new__
178
+ tkinter.EventType.__new__
Original file line number Diff line number Diff line change @@ -181,3 +181,7 @@ tkinter.test
181
181
tkinter\.test\..+
182
182
unittest.test
183
183
unittest\.test\..+
184
+
185
+ # These enums derive from (str, Enum)
186
+ pstats.SortKey.__new__
187
+ tkinter.EventType.__new__
Original file line number Diff line number Diff line change @@ -163,3 +163,7 @@ pkgutil.ImpImporter\..*
163
163
pkgutil.ImpLoader\..*
164
164
165
165
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime
166
+
167
+ # These enums derive from (str, Enum)
168
+ pstats.SortKey.__new__
169
+ tkinter.EventType.__new__
Original file line number Diff line number Diff line change @@ -433,10 +433,6 @@ inspect.Signature.__init__
433
433
inspect.Parameter.empty # set as private marker _empty
434
434
inspect.Signature.empty # set as private marker _empty
435
435
436
- # These enums derive from (int, IntEnum) or (str, Enum)
437
- pstats.SortKey.__new__
438
- tkinter.EventType.__new__
439
-
440
436
# These multiprocessing proxy methods have *args, **kwargs signatures at runtime,
441
437
# But have more precise (accurate) signatures in the stub
442
438
multiprocessing.managers.BaseListProxy.__imul__
You can’t perform that action at this time.
0 commit comments