mirror of
https://github.com/godotengine/godot.git
synced 2024-11-25 05:33:11 +00:00
Style: Update ruff
& mypy
to latest versions
This commit is contained in:
parent
2be730a05b
commit
fdc6ffd264
@ -39,14 +39,14 @@ repos:
|
|||||||
stages: [manual] # Not automatically triggered, invoked via `pre-commit run --hook-stage manual clang-tidy`
|
stages: [manual] # Not automatically triggered, invoked via `pre-commit run --hook-stage manual clang-tidy`
|
||||||
|
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.4.4
|
rev: v0.6.6
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix]
|
args: [--fix]
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
rev: v0.971
|
rev: v1.11.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: mypy
|
- id: mypy
|
||||||
files: \.py$
|
files: \.py$
|
||||||
|
@ -4,8 +4,8 @@ import re
|
|||||||
import shutil
|
import shutil
|
||||||
import stat
|
import stat
|
||||||
import subprocess
|
import subprocess
|
||||||
from types import TracebackType
|
import sys
|
||||||
from typing import Any, Callable, Tuple, Type
|
from typing import Any, Callable
|
||||||
|
|
||||||
git_tag = "v4.3.1"
|
git_tag = "v4.3.1"
|
||||||
|
|
||||||
@ -100,9 +100,7 @@ subprocess.run(["git", "checkout", git_tag])
|
|||||||
commit_hash = str(subprocess.check_output(["git", "rev-parse", "HEAD"], universal_newlines=True)).strip()
|
commit_hash = str(subprocess.check_output(["git", "rev-parse", "HEAD"], universal_newlines=True)).strip()
|
||||||
|
|
||||||
|
|
||||||
def on_rm_error(
|
def on_rm_error(function: Callable[..., Any], path: str, excinfo: Exception) -> None:
|
||||||
function: Callable[..., Any], path: str, excinfo: Tuple[Type[Exception], Exception, TracebackType]
|
|
||||||
) -> None:
|
|
||||||
"""
|
"""
|
||||||
Error handler for `shutil.rmtree()`.
|
Error handler for `shutil.rmtree()`.
|
||||||
|
|
||||||
@ -113,10 +111,12 @@ def on_rm_error(
|
|||||||
os.unlink(path)
|
os.unlink(path)
|
||||||
|
|
||||||
|
|
||||||
# 3.12 Python and beyond should replace `onerror` with `onexc`.
|
|
||||||
# We remove the .git directory because it contains
|
# We remove the .git directory because it contains
|
||||||
# a lot of read-only files that are problematic on Windows.
|
# a lot of read-only files that are problematic on Windows.
|
||||||
shutil.rmtree(".git", onerror=on_rm_error)
|
if sys.version_info >= (3, 12):
|
||||||
|
shutil.rmtree(".git", onexc=on_rm_error)
|
||||||
|
else:
|
||||||
|
shutil.rmtree(".git", onerror=on_rm_error) # type: ignore
|
||||||
|
|
||||||
all_files = set(cpp_files)
|
all_files = set(cpp_files)
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ warn_unreachable = true
|
|||||||
namespace_packages = true
|
namespace_packages = true
|
||||||
explicit_package_bases = true
|
explicit_package_bases = true
|
||||||
exclude = ["thirdparty/"]
|
exclude = ["thirdparty/"]
|
||||||
|
python_version = "3.8"
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
extend-exclude = ["thirdparty"]
|
extend-exclude = ["thirdparty"]
|
||||||
|
Loading…
Reference in New Issue
Block a user