From e0723c1db4ee3262c5daf092bb097806599b3f2d Mon Sep 17 00:00:00 2001 From: PIG208 <359101898@qq.com> Date: Sat, 15 May 2021 20:53:56 +0800 Subject: [PATCH] zulip-bots: Move protocols for context manager. --- zulip_bots/zulip_bots/lib.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/zulip_bots/zulip_bots/lib.py b/zulip_bots/zulip_bots/lib.py index dc68754..05025ff 100644 --- a/zulip_bots/zulip_bots/lib.py +++ b/zulip_bots/zulip_bots/lib.py @@ -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):