mypy: Add annotations for help.

This commit is contained in:
fredfishgames 2017-12-07 19:44:42 +00:00 committed by showell
parent 40c09b4b16
commit 9d5fbc2b5b
3 changed files with 8 additions and 3 deletions

View file

@ -44,6 +44,8 @@ force_include = [
"zulip_bots/zulip_bots/bots/github_detail/test_github_detail.py",
"zulip_bots/zulip_bots/bots/googlesearch/googlesearch.py",
"zulip_bots/zulip_bots/bots/googlesearch/test_googlesearch.py",
"zulip_bots/zulip_bots/bots/help/help.py",
"zulip_bots/zulip_bots/bots/help/test_help.py",
]
parser = argparse.ArgumentParser(description="Run mypy on files tracked by git.")

View file

@ -1,7 +1,8 @@
# See readme.md for instructions on running this code.
from typing import Any, Dict
class HelpHandler(object):
def usage(self):
def usage(self: Any) -> str:
return '''
This plugin will give info about Zulip to
any user that types a message saying "help".
@ -11,7 +12,7 @@ class HelpHandler(object):
your Zulip instance.
'''
def handle_message(self, message, bot_handler):
def handle_message(self: Any, message: Dict[str, str], bot_handler: Any) -> None:
help_content = "Info on Zulip can be found here:\nhttps://github.com/zulip/zulip"
bot_handler.send_reply(message, help_content)

View file

@ -2,10 +2,12 @@
from zulip_bots.test_lib import StubBotTestCase
from typing import Any
class TestHelpBot(StubBotTestCase):
bot_name = "help"
def test_bot(self):
def test_bot(self: Any) -> None:
help_text = "Info on Zulip can be found here:\nhttps://github.com/zulip/zulip"
requests = ["", "help", "Hi, my name is abc"]