Cleanup: use type hints for discover_nodes.py

This commit is contained in:
Campbell Barton
2024-10-23 13:18:36 +11:00
parent 4a69ede005
commit cfc645901f
2 changed files with 6 additions and 5 deletions

View File

@@ -22,7 +22,7 @@ import re
import sys
def filepath_is_older(filepath_test, filepath_compare):
def filepath_is_older(filepath_test: str, filepath_compare: tuple[str, ...]) -> bool:
import stat
mtime = os.stat(filepath_test)[stat.ST_MTIME]
for filepath_other in filepath_compare:
@@ -52,9 +52,9 @@ source_cc_files = [
macro_name = "NOD_REGISTER_NODE"
discover_suffix = "_discover"
include_lines = []
decl_lines = []
func_lines = []
include_lines: list[str] = []
decl_lines: list[str] = []
func_lines: list[str] = []
# Add forward declaration to avoid warning.
func_lines.append(f"void {function_to_generate}();")
@@ -75,7 +75,7 @@ for path in source_cc_files:
code = fh.read()
# Keeps track of the current name-space we're in.
namespace_parts = []
namespace_parts: list[str] = []
for match in re_all_compiled.finditer(code):
if entered_namespace := match.group(2):

View File

@@ -15,6 +15,7 @@ PATHS: tuple[tuple[str, tuple[Any, ...], dict[str, str]], ...] = (
("scripts/modules/_bpy_internal/extensions/junction_module.py", (), {}),
("scripts/modules/_bpy_internal/extensions/wheel_manager.py", (), {}),
("scripts/modules/_bpy_internal/freedesktop.py", (), {}),
("source/blender/nodes/intern/discover_nodes.py", (), {}),
("tools/check_blender_release/", (), {}),
("tools/check_docs/", (), {}),
("tools/check_source/", (), {'MYPYPATH': "modules"}),