Fix all typecheck errors across all 8 Blender versions (4.0-5.1)

- Fix Sequence name clash in bpy.types by never importing it directly
- Qualify all bare Sequence[ to collections.abc.Sequence[ in bpy.types
- Force writable properties to readonly when overriding parent @property
- Auto-detect classes used as generics and add Generic[_T] base
- Include struct bases in type string collection for import detection
- Strip RST backslash-space before generic brackets in docstrings
- Convert "string in ['X', 'Y']" docstring pattern to Literal types
- Strip single backtick RST markup from type annotations
- Fix Callable[[object, ...], X] -> Callable[..., X]
- Add Callable import to bpy.types generator
- Map ContextTempOverride to object, handle BMVertSkin removal in 5.1
- Fix Literal[...] = False incompatible defaults
- Update test for collect_inherited_info rename

Result: 0 errors on all versions (4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 5.0, 5.1)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-27 12:41:38 +01:00
co-authored by Claude Opus 4.6
parent 6ecd996f35
commit 441631d69a
3 changed files with 83 additions and 25 deletions
+5 -5
View File
@@ -5,7 +5,7 @@ import unittest
from generate_stubs import (
ParamOverrides,
apply_overrides,
collect_all_methods,
collect_inherited_info,
generate_function_stub,
generate_method_stub,
generate_property_stub,
@@ -674,10 +674,10 @@ class TestCollectAllMethods(unittest.TestCase):
"methods": [method],
},
]
result = collect_all_methods(structs)
self.assertEqual(result["Node"], set())
self.assertIn("is_registered_node_type", result["TextureNode"])
self.assertIn("is_registered_node_type", result["TextureNodeValToRGB"])
result = collect_inherited_info(structs)
self.assertEqual(result["Node"].methods, set())
self.assertIn("is_registered_node_type", result["TextureNode"].methods)
self.assertIn("is_registered_node_type", result["TextureNodeValToRGB"].methods)
class TestGenerateTypesStub(unittest.TestCase):