From 6c3b0973c4c1b9444df65c4a33bdcca5e7c3eab0 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 8 Feb 2023 15:21:05 -0500 Subject: run_mypy: passthrough unknown options to mypy itself Useful for running as a thin wrapper in other contexts that expect the ability to run mypy itself with arbitrary arguments. --- run_mypy.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/run_mypy.py b/run_mypy.py index 6683560..2db0fcc 100755 --- a/run_mypy.py +++ b/run_mypy.py @@ -93,7 +93,6 @@ def main() -> int: check_mypy() root = Path(__file__).absolute().parent - args = [] # type: T.List[str] parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('files', nargs='*') @@ -101,7 +100,7 @@ def main() -> int: parser.add_argument('-p', '--pretty', action='store_true', help='pretty print mypy errors') parser.add_argument('-C', '--clear', action='store_true', help='clear the terminal before running mypy') - opts = parser.parse_args() + opts, args = parser.parse_known_args() if opts.pretty: args.append('--pretty') -- cgit v1.1