zulip-bots: Move protocols for context manager.

This commit is contained in:
PIG208 2021-05-15 20:53:56 +08:00 committed by Tim Abbott
parent b04f5f9753
commit e0723c1db4

View file

@ -67,6 +67,21 @@ class RateLimit:
logging.error(self.error_message)
sys.exit(1)
class BotIdentity:
def __init__(self, name: str, email: str) -> None:
self.name = name
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 StateHandler:
def __init__(self, client: Client) -> None:
@ -96,21 +111,6 @@ class StateHandler:
def contains(self, key: Text) -> bool:
return key in self.state_
class BotIdentity:
def __init__(self, name: str, email: str) -> None:
self.name = name
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 BotHandler(Protocol):