diff options
author | mathieui <mathieui@mathieui.net> | 2018-07-22 14:23:39 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2018-07-22 14:25:18 +0200 |
commit | e2414121af16474744d012cdb8466de6ae3136e4 (patch) | |
tree | e7d90b34da1d971e6e14cd8707837cab9200f0a3 /poezio/events.py | |
parent | 3cb8e33f938db6bb6e86dd349f8b56676b83556f (diff) | |
download | poezio-e2414121af16474744d012cdb8466de6ae3136e4.tar.gz poezio-e2414121af16474744d012cdb8466de6ae3136e4.tar.bz2 poezio-e2414121af16474744d012cdb8466de6ae3136e4.tar.xz poezio-e2414121af16474744d012cdb8466de6ae3136e4.zip |
Add type hints here and there
Diffstat (limited to 'poezio/events.py')
-rw-r--r-- | poezio/events.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/poezio/events.py b/poezio/events.py index adf29c13..3bfe5156 100644 --- a/poezio/events.py +++ b/poezio/events.py @@ -9,6 +9,8 @@ The list of available events is here: http://poezio.eu/doc/en/plugins.html#_poezio_events """ +from typing import Callable, Dict, List + class EventHandler: """ @@ -44,9 +46,10 @@ class EventHandler: 'send_normal_presence': [], 'ignored_private': [], 'tab_change': [], - } + } # type: Dict[str, List[Callable]] - def add_event_handler(self, name, callback, position=0): + def add_event_handler(self, name: str, callback: Callable, + position=0) -> bool: """ Add a callback to a given event. Note that if that event name doesn’t exist, it just returns False. @@ -64,7 +67,7 @@ class EventHandler: return True - def trigger(self, name, *args, **kwargs): + def trigger(self, name: str, *args, **kwargs): """ Call all the callbacks associated to the given event name. """ @@ -74,7 +77,7 @@ class EventHandler: for callback in callbacks: callback(*args, **kwargs) - def del_event_handler(self, name, callback): + def del_event_handler(self, name: str, callback: Callable): """ Remove the callback from the list of callbacks of the given event """ |