Add type annotations

A few code are revised because the type checker (mypy) doesn't allow
changing types on a variable.

PR #20935.
This commit is contained in:
Chocobo1
2024-06-17 13:18:32 +08:00
committed by GitHub
parent 2000be12ba
commit d71086e400
4 changed files with 122 additions and 72 deletions

View File

@@ -53,7 +53,7 @@ jobs:
python-version: '3.7'
- name: Install tools (search engine)
run: pip install bandit pycodestyle pyflakes
run: pip install bandit mypy pycodestyle pyflakes pyright
- name: Gather files (search engine)
run: |
@@ -61,6 +61,16 @@ jobs:
echo $PY_FILES
echo "PY_FILES=$PY_FILES" >> "$GITHUB_ENV"
- name: Check typings (search engine)
run: |
MYPYPATH="src/searchengine/nova3" \
mypy \
--follow-imports skip \
--strict \
$PY_FILES
pyright \
$PY_FILES
- name: Lint code (search engine)
run: |
pyflakes $PY_FILES