From 6546917088d054f4ea6f9b2a5548fd05b5be237d Mon Sep 17 00:00:00 2001 From: Alena Volkova Date: Tue, 10 Oct 2017 02:42:46 -0400 Subject: [PATCH] mypy: zulip_bots: Annotate zulip_bots/run.py. --- tools/run-mypy | 1 - zulip_bots/zulip_bots/run.py | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/run-mypy b/tools/run-mypy index 830ac43..f1cbea1 100755 --- a/tools/run-mypy +++ b/tools/run-mypy @@ -22,7 +22,6 @@ exclude = """ zulip/integrations/perforce/git_p4.py zulip_bots/zulip_bots/bots -zulip_bots/zulip_bots/run.py zulip_bots/zulip_bots/test_lib.py zulip_bots/zulip_bots/test_run.py zulip_bots/zulip_bots/zulip_bot_output.py diff --git a/zulip_bots/zulip_bots/run.py b/zulip_bots/zulip_bots/run.py index 876f31c..e84eafa 100755 --- a/zulip_bots/zulip_bots/run.py +++ b/zulip_bots/zulip_bots/run.py @@ -9,6 +9,7 @@ import os from types import ModuleType from importlib import import_module from os.path import basename, splitext +from typing import Any, Optional, Text from zulip_bots.lib import run_message_handler_for_bot from zulip_bots.provision import provision_bot @@ -16,6 +17,7 @@ from zulip_bots.provision import provision_bot current_dir = os.path.dirname(os.path.abspath(__file__)) def import_module_from_source(path, name=None): + # type: (Text, Optional[Text]) -> Any if not name: name = splitext(basename(path))[0] @@ -33,6 +35,7 @@ def import_module_from_source(path, name=None): return module def name_and_path_match(given_name, path_to_bot): + # type: (Text, Text) -> bool if given_name and path_to_bot: name_by_path = os.path.splitext(os.path.basename(path_to_bot))[0] if (given_name != name_by_path): @@ -40,6 +43,7 @@ def name_and_path_match(given_name, path_to_bot): return True def parse_args(): + # type: () -> argparse.Namespace usage = ''' zulip-run-bot Example: zulip-run-bot followup