From 3a7bd1811fd1367693d14645f37888f089087252 Mon Sep 17 00:00:00 2001 From: Jacob Henry Date: Thu, 8 Nov 2018 00:28:11 -0500 Subject: [PATCH] Fixed a type (hopefully) --- main.py | 2 ++ slack_util.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index b3b3019..9fc0e55 100644 --- a/main.py +++ b/main.py @@ -22,6 +22,7 @@ api_file.close() # Enable to use dummy DEBUG_MODE = False + def main() -> None: wrap = ClientWrapper() @@ -66,6 +67,7 @@ class ClientWrapper(object): We only ever expect one of these. Holds a slack client, and handles messsages. """ + def __init__(self): # Init slack if DEBUG_MODE: diff --git a/slack_util.py b/slack_util.py index c93d427..365b1c9 100644 --- a/slack_util.py +++ b/slack_util.py @@ -4,7 +4,7 @@ import re from slackclient import SlackClient import channel_util -from typing import Any, Optional, Generator, Match, Callable, List, Awaitable +from typing import Any, Optional, Generator, Match, Callable, List, Awaitable, Coroutine """ Slack helpers. Separated for compartmentalization @@ -84,7 +84,7 @@ def message_stream(slack: SlackClient) -> Generator[dict, None, None]: class Hook(object): def __init__(self, - callback: Callable[[SlackClient, dict, Match], Awaitable[None]], # TODO: Fix this type + callback: Coroutine[[SlackClient, dict, Match]], pattern: str = None, channel_whitelist: Optional[List[str]] = None, channel_blacklist: Optional[List[str]] = None):