From 5fc7c71777d37b15fb0caef9eee6cf9e35bc0d79 Mon Sep 17 00:00:00 2001 From: moran Date: Mon, 25 Aug 2025 09:37:22 +0800 Subject: [PATCH] fix mypy codecheck --- .pre-commit-config.yaml | 8 ++++++++ codecheck_toolkits/mypy.sh | 11 +++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb56f21be..82840fc0b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -136,6 +136,14 @@ repos: types: [python] pass_filenames: false additional_dependencies: [regex] + # remove cache files + - id: remove cache + name: "remove ruff, mypy, shellcheck cache" + entry: rm -rf .ruff_cache/ .mypy_cache/ shellcheck-stable/ + language: system + stages: [ pre-commit ] + always_run: true + pass_filenames: false # Keep `suggestion` last - id: suggestion name: Suggestion diff --git a/codecheck_toolkits/mypy.sh b/codecheck_toolkits/mypy.sh index 9706d7e00..9edeefc50 100755 --- a/codecheck_toolkits/mypy.sh +++ b/codecheck_toolkits/mypy.sh @@ -5,22 +5,21 @@ PYTHON_VERSION=${1:-local} run_mypy() { - mypy --python-version "${PYTHON_VERSION}" "$@" + if [ -z "$1" ]; then + mypy --python-version "${PYTHON_VERSION}" "$@" + return + fi + mypy --follow-imports skip --python-version "${PYTHON_VERSION}" "$@" } run_mypy run_mypy tests/st run_mypy vllm_mindspore/attention -run_mypy vllm_mindspore/compilation run_mypy vllm_mindspore/distributed run_mypy vllm_mindspore/engine run_mypy vllm_mindspore/executor run_mypy vllm_mindspore/inputs run_mypy vllm_mindspore/lora run_mypy vllm_mindspore/model_executor -run_mypy vllm_mindspore/plugins -run_mypy vllm_mindspore/prompt_adapter -run_mypy vllm_mindspore/spec_decode run_mypy vllm_mindspore/worker run_mypy vllm_mindspore/v1 - -- Gitee