@@ -3,11 +3,9 @@ from typing_extensions import deprecated # added in 3.13
3
3
4
4
from pygame .typing import SequenceLike
5
5
6
- @final
7
- class Event :
8
- # Event fields here duplicated below into EventType because Event is
9
- # marked as final and can't be subclassed like the other xType aliases
10
- # are to allow @deprecated.
6
+ class _GenericEvent :
7
+ # Just exists to avoid duplication of data for Event
8
+ # and (deprecated) EventType
11
9
12
10
@property
13
11
def type (self ) -> int : ...
@@ -27,27 +25,13 @@ class Event:
27
25
def dict (self ) -> dict [str , Any ]: ...
28
26
29
27
@final
30
- @deprecated ("Use `Event` instead (this is an old alias)" )
31
- class EventType :
32
- # Duplicated Event fields here because it is marked as final and can't be
33
- # subclassed like the other xType aliases are to allow @deprecated.
34
-
35
- @property
36
- def type (self ) -> int : ...
37
- __dict__ : dict [str , Any ]
38
- __hash__ : None # type: ignore
39
- def __init__ (
40
- self , type : int , dict : dict [str , Any ] = ..., ** kwargs : Any
41
- ) -> None : ...
42
- def __getattribute__ (self , name : str ) -> Any : ...
43
- def __setattr__ (self , name : str , value : Any ) -> None : ...
44
- def __delattr__ (self , name : str ) -> None : ...
45
- def __bool__ (self ) -> bool : ...
28
+ class Event (_GenericEvent ):
29
+ pass
46
30
47
- # this is at the bottom because mypy complains if this declaration comes
48
- # before any uses of the dict[] typehinting because of the same naming
49
- @ property
50
- def dict ( self ) -> dict [ str , Any ]: ...
31
+ @ final
32
+ @ deprecated ( "Use `Event` instead (this is an old alias)" )
33
+ class EventType ( _GenericEvent ):
34
+ pass
51
35
52
36
_EventTypes = Union [int , SequenceLike [int ]]
53
37
0 commit comments