From 8cd310493a99dc95a949983a45206c0de8980df1 Mon Sep 17 00:00:00 2001 From: Rohitt Vashishtha Date: Mon, 4 Dec 2017 15:46:36 +0530 Subject: [PATCH] mypy: Annotate helloworld bot. --- zulip_bots/zulip_bots/bots/helloworld/helloworld.py | 7 ++++--- zulip_bots/zulip_bots/bots/helloworld/test_helloworld.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/zulip_bots/zulip_bots/bots/helloworld/helloworld.py b/zulip_bots/zulip_bots/bots/helloworld/helloworld.py index bf3da9c..65d5349 100644 --- a/zulip_bots/zulip_bots/bots/helloworld/helloworld.py +++ b/zulip_bots/zulip_bots/bots/helloworld/helloworld.py @@ -1,8 +1,9 @@ # See readme.md for instructions on running this code. +from typing import Any class HelloWorldHandler(object): - def usage(self): + def usage(self) -> str: return ''' This is a boilerplate bot that responds to a user query with "beep boop", which is robot for "Hello World". @@ -11,8 +12,8 @@ class HelloWorldHandler(object): sophisticated, bots. ''' - def handle_message(self, message, bot_handler): - content = 'beep boop' + def handle_message(self, message: Any, bot_handler: Any) -> None: + content = 'beep boop' # type: str bot_handler.send_reply(message, content) handler_class = HelloWorldHandler diff --git a/zulip_bots/zulip_bots/bots/helloworld/test_helloworld.py b/zulip_bots/zulip_bots/bots/helloworld/test_helloworld.py index d4251de..8396dc9 100755 --- a/zulip_bots/zulip_bots/bots/helloworld/test_helloworld.py +++ b/zulip_bots/zulip_bots/bots/helloworld/test_helloworld.py @@ -3,9 +3,9 @@ from zulip_bots.test_lib import StubBotTestCase class TestHelpBot(StubBotTestCase): - bot_name = "helloworld" + bot_name = "helloworld" # type: str - def test_bot(self): + def test_bot(self) -> None: dialog = [ ('', 'beep boop'), ('help', 'beep boop'),