From c885a40fe8950354d078b67b7c25441180852fbd Mon Sep 17 00:00:00 2001 From: Chen Zhang Date: Mon, 20 Jan 2025 07:13:07 -0800 Subject: [PATCH 1/3] fix_pre_commit Signed-off-by: Chen Zhang --- .pre-commit-config.yaml | 2 +- tools/mypy.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8d1fc257388a..70809783dc7a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,7 +42,7 @@ repos: hooks: - id: mypy-local name: Run mypy for local Python installation - entry: tools/mypy.sh + entry: tools/mypy.sh 1 "local" language: python types: [python] additional_dependencies: &mypy_deps [mypy==1.11.1, types-setuptools, types-PyYAML, types-requests] diff --git a/tools/mypy.sh b/tools/mypy.sh index bf95e4c526fd..438b02b3e9f2 100755 --- a/tools/mypy.sh +++ b/tools/mypy.sh @@ -7,6 +7,10 @@ if [ "$CI" -eq 1 ]; then set -e fi +if [ $PYTHON_VERSION == "local" ]; then + PYTHON_VERSION=$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")') +fi + run_mypy() { echo "Running mypy on $1" if [ "$CI" -eq 1 ] && [ -z "$1" ]; then From 6cb9daba2c6d57d750bb1c7576b9656f920dc506 Mon Sep 17 00:00:00 2001 From: Chen Zhang Date: Mon, 20 Jan 2025 07:26:09 -0800 Subject: [PATCH 2/3] fix ci=0 Signed-off-by: Chen Zhang --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 70809783dc7a..432bf5ed18db 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,7 +42,7 @@ repos: hooks: - id: mypy-local name: Run mypy for local Python installation - entry: tools/mypy.sh 1 "local" + entry: tools/mypy.sh 0 "local" language: python types: [python] additional_dependencies: &mypy_deps [mypy==1.11.1, types-setuptools, types-PyYAML, types-requests] From 9cf86e8617238f411a4de4a65b6e3b0946817183 Mon Sep 17 00:00:00 2001 From: Chen Zhang Date: Mon, 20 Jan 2025 07:40:20 -0800 Subject: [PATCH 3/3] fix local by default Signed-off-by: Chen Zhang --- tools/mypy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mypy.sh b/tools/mypy.sh index 438b02b3e9f2..77d342da1ec8 100755 --- a/tools/mypy.sh +++ b/tools/mypy.sh @@ -1,7 +1,7 @@ #!/bin/bash CI=${1:-0} -PYTHON_VERSION=${2:-3.9} +PYTHON_VERSION=${2:-local} if [ "$CI" -eq 1 ]; then set -e