diff --git a/zulip_bots/setup.py b/zulip_bots/setup.py index 6396e29..b71b4d3 100644 --- a/zulip_bots/setup.py +++ b/zulip_bots/setup.py @@ -65,6 +65,7 @@ setuptools_info = dict( 'html2text', 'lxml', 'BeautifulSoup4', + 'typing_extensions', ], ) diff --git a/zulip_bots/zulip_bots/lib.py b/zulip_bots/zulip_bots/lib.py index 32b69cb..47696be 100644 --- a/zulip_bots/zulip_bots/lib.py +++ b/zulip_bots/zulip_bots/lib.py @@ -9,7 +9,7 @@ import re from typing import Any, Optional, List, Dict, IO, Text - +from typing_extensions import Protocol from zulip import Client, ZulipError @@ -102,6 +102,16 @@ class BotIdentity: self.email = email self.mention = '@**' + name + '**' +class BotStorage(Protocol): + def put(self, key: Text, value: Any) -> None: + ... + + def get(self, key: Text) -> Any: + ... + + def contains(self, key: Text) -> bool: + ... + class ExternalBotHandler: def __init__( self,