mypy: Add annotations for help.
This commit is contained in:
parent
40c09b4b16
commit
9d5fbc2b5b
|
@ -44,6 +44,8 @@ force_include = [
|
||||||
"zulip_bots/zulip_bots/bots/github_detail/test_github_detail.py",
|
"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/googlesearch.py",
|
||||||
"zulip_bots/zulip_bots/bots/googlesearch/test_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.")
|
parser = argparse.ArgumentParser(description="Run mypy on files tracked by git.")
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# See readme.md for instructions on running this code.
|
# See readme.md for instructions on running this code.
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
class HelpHandler(object):
|
class HelpHandler(object):
|
||||||
def usage(self):
|
def usage(self: Any) -> str:
|
||||||
return '''
|
return '''
|
||||||
This plugin will give info about Zulip to
|
This plugin will give info about Zulip to
|
||||||
any user that types a message saying "help".
|
any user that types a message saying "help".
|
||||||
|
@ -11,7 +12,7 @@ class HelpHandler(object):
|
||||||
your Zulip instance.
|
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"
|
help_content = "Info on Zulip can be found here:\nhttps://github.com/zulip/zulip"
|
||||||
bot_handler.send_reply(message, help_content)
|
bot_handler.send_reply(message, help_content)
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
|
|
||||||
from zulip_bots.test_lib import StubBotTestCase
|
from zulip_bots.test_lib import StubBotTestCase
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
class TestHelpBot(StubBotTestCase):
|
class TestHelpBot(StubBotTestCase):
|
||||||
bot_name = "help"
|
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"
|
help_text = "Info on Zulip can be found here:\nhttps://github.com/zulip/zulip"
|
||||||
requests = ["", "help", "Hi, my name is abc"]
|
requests = ["", "help", "Hi, my name is abc"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue