mypy: zulip_botserver: Fix errors in setup.py.

This commit is contained in:
Alena Volkova 2017-10-11 01:55:18 -04:00
parent ed51cabf1b
commit 25d6c68d4d
2 changed files with 5 additions and 3 deletions

View file

@ -21,7 +21,6 @@ sys.path.append(os.path.dirname(TOOLS_DIR))
exclude = """ exclude = """
zulip/integrations/perforce/git_p4.py zulip/integrations/perforce/git_p4.py
zulip_bots/zulip_bots/bots zulip_bots/zulip_bots/bots
zulip_botserver/setup.py
""".split() """.split()
parser = argparse.ArgumentParser(description="Run mypy on files tracked by git.") parser = argparse.ArgumentParser(description="Run mypy on files tracked by git.")

View file

@ -5,6 +5,8 @@ from __future__ import print_function
import os import os
import sys import sys
if False:
from typing import Any, Dict, Optional
ZULIP_BOTSERVER_VERSION = "0.3.7" ZULIP_BOTSERVER_VERSION = "0.3.7"
@ -51,14 +53,15 @@ except ImportError:
# Manual dependency check # Manual dependency check
def check_dependency_manually(module_name, version=None): def check_dependency_manually(module_name, version=None):
# type: (str, Optional[str]) -> None
try: try:
module = import_module(module_name) module = import_module(module_name) # type: Any
if version is not None: if version is not None:
assert(LooseVersion(module.__version__) >= LooseVersion(version)) assert(LooseVersion(module.__version__) >= LooseVersion(version))
except (ImportError, AssertionError): except (ImportError, AssertionError):
if version is not None: if version is not None:
print("{name}>={version} is not installed.".format( print("{name}>={version} is not installed.".format(
req=req, version=version), file=sys.stderr) name=module_name, version=version), file=sys.stderr)
else: else:
print("{name} is not installed.".format(name=module_name), file=sys.stderr) print("{name} is not installed.".format(name=module_name), file=sys.stderr)
sys.exit(1) sys.exit(1)