File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ class EventType(BaseEnum):
42
42
animate = None #: Animation event. Has 'step' representing the step size in seconds. This is stable, except when the 'catch_up' field is nonzero.
43
43
44
44
45
+ valid_event_types = set (EventType )
46
+
47
+
45
48
class EventEmitter :
46
49
"""The EventEmitter stores event handlers, collects incoming events, and dispatched them.
47
50
@@ -127,7 +130,7 @@ def my_handler(event):
127
130
for type in types :
128
131
if not isinstance (type , str ):
129
132
raise TypeError (f"Event types must be str, but got { type } " )
130
- if not (type == "*" or type in EventType ):
133
+ if not (type == "*" or type in valid_event_types ):
131
134
raise ValueError (f"Adding handler with invalid event_type: '{ type } '" )
132
135
133
136
def decorator (_callback ):
@@ -168,7 +171,7 @@ def submit(self, event):
168
171
if self ._closed :
169
172
return
170
173
event_type = event ["event_type" ]
171
- if event_type not in EventType :
174
+ if event_type not in valid_event_types :
172
175
raise ValueError (f"Submitting with invalid event_type: '{ event_type } '" )
173
176
174
177
event .setdefault ("time_stamp" , time .perf_counter ())
You can’t perform that action at this time.
0 commit comments