-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathrun-mypy.py
More file actions
30 lines (23 loc) · 824 Bytes
/
run-mypy.py
File metadata and controls
30 lines (23 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
import sys
print("Doing static checking.")
from mypy.main import main
common_args = ["--ignore-missing-imports",
"--disallow-incomplete-defs",
"--disallow-untyped-defs",
"--disallow-untyped-calls",
"--check-untyped-defs",
"--disallow-untyped-globals"]
try:
ret = main(stdout=sys.stdout, stderr=sys.stderr, args=["-p", "crash"] + common_args)
except TypeError:
try:
ret = main(None, stdout=sys.stdout, stderr=sys.stderr, args=["-p", "crash"] + common_args)
except TypeError:
ret = main(None, args=["-p", "crash"] + common_args)
if ret:
print("static checking failed.", file=sys.stderr)
sys.exit(1)
print("OK")
sys.exit(0)