From ad050fc806f37aa04162ba54749d4adbe44e1cce Mon Sep 17 00:00:00 2001 From: Alena Volkova Date: Wed, 11 Oct 2017 01:53:13 -0400 Subject: [PATCH] mypy: zulip_bots: Fix errors in setup.py. --- tools/run-mypy | 1 - zulip_bots/generate_manifest.py | 3 ++- zulip_bots/setup.py | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/run-mypy b/tools/run-mypy index da4b866..6f16809 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/setup.py zulip_bots/zulip_bots/lib.py zulip_bots/zulip_bots/provision.py zulip_bots/zulip_bots/run.py diff --git a/zulip_bots/generate_manifest.py b/zulip_bots/generate_manifest.py index b39c29e..c861fee 100755 --- a/zulip_bots/generate_manifest.py +++ b/zulip_bots/generate_manifest.py @@ -5,7 +5,8 @@ import os import glob import distutils.cmd import distutils.log -from typing import IO, Iterator +if False: + from typing import IO, Iterator CURRENT_DIR = os.path.abspath(os.path.dirname(__file__)) BOTS_DIR = os.path.normpath(os.path.join(CURRENT_DIR, 'zulip_bots', 'bots')) diff --git a/zulip_bots/setup.py b/zulip_bots/setup.py index 1893876..6475879 100755 --- a/zulip_bots/setup.py +++ b/zulip_bots/setup.py @@ -5,6 +5,8 @@ from __future__ import print_function import os import sys +if False: + from typing import Any, Dict, Optional import generate_manifest @@ -63,14 +65,15 @@ except ImportError: # Manual dependency check def check_dependency_manually(module_name, version=None): + # type: (str, Optional[str]) -> None try: - module = import_module(module_name) + module = import_module(module_name) # type: Any if version is not None: assert(LooseVersion(module.__version__) >= LooseVersion(version)) except (ImportError, AssertionError): if version is not None: print("{name}>={version} is not installed.".format( - req=req, version=version), file=sys.stderr) + name=module_name, version=version), file=sys.stderr) else: print("{name} is not installed.".format(name=module_name), file=sys.stderr) sys.exit(1)