Add dunder methods, hidden type discovery, uniform_float override, and docstring fixes

- Introspect dunder methods (__getitem__, __len__, __add__, __matmul__, etc.)
  on C extension classes with runtime probing for return types
- Discover hidden C types from property values (e.g. MatrixAccess from Matrix.col)
- Add gpu.types override for uniform_float to accept Matrix, Vector, Euler,
  Quaternion, and Color (matching Blender's mathutils_array_parse C implementation)
- Extend apply_overrides to support ClassName.method_name keys for struct methods
- Parse standalone :type: annotations in property docstrings (is_frozen -> bool)
- Strip (readonly) and (never None) from docstring type annotations
- Add :raises to directive lookahead to prevent rtype bleeding into raises text
- Fix NoneType -> None normalization in runtime type probing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 17:18:09 +01:00
co-authored by Claude Opus 4.6
parent b0c2a3a2c1
commit e4739448c2
4 changed files with 296 additions and 11 deletions
+2
View File
@@ -56,7 +56,9 @@ gpu.state.blend_set('ALPHA')
- **Literal enum types** — string parameters like `gpu.state.blend_set(mode)` use `Literal["NONE", "ALPHA", ...]` instead of plain `str`
- **Docstrings** — inline documentation on properties, methods, and functions
- **Classmethod detection** — `Matrix.Identity()`, `Vector.Fill()`, etc. correctly typed as `@classmethod`
- **Dunder methods** — `__getitem__`, `__len__`, `__add__`, `__matmul__`, and other operators introspected with correct return types (e.g. `Matrix[0]` returns `Vector`)
- **Operator metadata** — `bpy.ops.mesh.primitive_cube_add.poll()`, `.idname()`, `.get_rna_type()`, and `.bl_options` are typed via introspected `_BPyOpsSubModOp` wrapper
- **GPU uniform types** — `shader.uniform_float()` accepts `Matrix`, `Vector`, `Euler`, `Quaternion`, and `Color` in addition to `float | Sequence[float]`, matching the C implementation
- **Dynamic array types** — `Image.pixels` typed as `bpy_prop_array[float]` (not `list[float]` or `float`)
- **Zero `Any` usage** — precise types throughout, no `typing.Any` fallbacks
- **basedpyright strict mode** — 0 errors on generated stubs (4.1+)