We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve typing of Engine module, especially for event_name. Currently, it is specified as str, but actually can be anything if registered:
event_name
str
from ignite.engine.events import Events from ignite.engine import Engine e = Engine(lambda e, b: None) class A: pass a = A() e.register_events("up", "down") e.register_events(1, 2, 3) e.register_events(a) print(e._allowed_events) e.add_event_handler("up", lambda e: print("up")) e.add_event_handler(1, lambda e: print("1")) e.add_event_handler(a, lambda e: print("a")) e.fire_event("up") e.fire_event(1) e.fire_event(a)
Let's discuss here if we would like to restrict event_type to some subset of types or leave as any type.
event_type
@sdesrozis, @ykumards cc @kai-tub as you said you were big fan of typing
The text was updated successfully, but these errors were encountered:
First step, type Any should be better than nothing. How does this relate to CustomEvent ?
Any
CustomEvent
Sorry, something went wrong.
I suggest to use Any rather than str (and used with int, etc.)
int
@vfdev-5 @kai-tub @ykumards ??
@sdesrozis go ahead with a PR, please
Successfully merging a pull request may close this issue.
🚀 Feature
Improve typing of Engine module, especially for
event_name
.Currently, it is specified as
str
, but actually can be anything if registered:Let's discuss here if we would like to restrict
event_type
to some subset of types or leave as any type.@sdesrozis, @ykumards
cc @kai-tub as you said you were big fan of typing
The text was updated successfully, but these errors were encountered: