From 62a5aed215c24bfd64c7613a0b0e1f484c0ddf72 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 2 Nov 2024 22:56:57 +1100 Subject: [PATCH] Cleanup: quiet mypy type warning --- build_files/utils/make_utils.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/build_files/utils/make_utils.py b/build_files/utils/make_utils.py index c1b98f02b76..14f621e830e 100755 --- a/build_files/utils/make_utils.py +++ b/build_files/utils/make_utils.py @@ -15,7 +15,12 @@ import subprocess import sys from pathlib import Path +from types import ( + TracebackType, +) from typing import ( + Any, + Callable, Dict, Sequence, Optional, @@ -279,9 +284,12 @@ def remove_directory(directory: Path) -> None: Takes care of clearing read-only attributes which might prevent deletion on Windows. """ - - def remove_readonly(func, path, _): - "Clear the readonly bit and reattempt the removal" + def remove_readonly( + func: Callable[..., Any], + path: str, + _: tuple[type[BaseException], BaseException, TracebackType], + ) -> None: + "Clear the read-only bit and reattempt the removal." os.chmod(path, stat.S_IWRITE) func(path)