zulip-bots: Add `BotStorage` Protocol.
The `BotStorage` Protocol is created to add a common type to all
storage classes.
Note: Protocol is imported from `typing_extensions` as `typing`
doesn't provide Protocol for python <= 3.7.
MODIFY
zulip_bots/setup.py
zulip_bots/setup.py
@@ -65,6 +65,7 @@ setuptools_info = dict(
'html2text',
'lxml',
'BeautifulSoup4',
+ 'typing_extensions',
],
)

MODIFY
zulip_bots/zulip_bots/lib.py
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,

zulip-bots: Add `BotStorage` Protocol.

The `BotStorage` Protocol is created to add a common type to all
storage classes.

Note: Protocol is imported from `typing_extensions` as `typing`
doesn't provide Protocol for python <= 3.7.