From 7bbd53837a039c08bb48e841e4f3e9aca2e85397 Mon Sep 17 00:00:00 2001 From: Andy Konwinski Date: Wed, 9 Mar 2022 21:08:14 -0800 Subject: [PATCH 1/2] adds script to run mypy. This reverts commit edbe6f3afcb7a16282474a4f990c329238d7b087. --- scripts/typecheck_code.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 scripts/typecheck_code.py diff --git a/scripts/typecheck_code.py b/scripts/typecheck_code.py new file mode 100644 index 00000000..1a52ed17 --- /dev/null +++ b/scripts/typecheck_code.py @@ -0,0 +1,23 @@ +""" +Run mypy static type checker on code in repo. + +To use:: + + $ python scripts/typecheck_code.py +""" + +import sys +from subprocess import run, PIPE, STDOUT + +returncode = 0 + +cmd = ["mypy", "agentos", "--exclude", "agentos/templates"] +print(f"running {' '.join(cmd)}") +result = run(cmd, stdout=PIPE, stderr=STDOUT) +out = result.stdout.decode("utf-8") +returncode = returncode | result.returncode +if out: + print(out) + print() + +sys.exit(returncode) From 2661db8104514bfc6fbb4aab18c496968e03b81f Mon Sep 17 00:00:00 2001 From: Andy Konwinski Date: Sat, 12 Mar 2022 12:43:53 -0800 Subject: [PATCH 2/2] sort imports --- scripts/typecheck_code.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/typecheck_code.py b/scripts/typecheck_code.py index 1a52ed17..8db6f7c3 100644 --- a/scripts/typecheck_code.py +++ b/scripts/typecheck_code.py @@ -7,7 +7,7 @@ """ import sys -from subprocess import run, PIPE, STDOUT +from subprocess import PIPE, STDOUT, run returncode = 0