Closed MicaelJarniac closed 2 years ago
I believe this issue to be related: https://github.com/nutti/fake-bpy-module/issues/76
It might be even better to do it with Generic
, like so:
from typing import TypeVar, Generic, Union
T = TypeVar("T")
class bpy_prop_collection(Generic[T]):
def __getitem__(self, key: Union[str, int]) -> T:
pass
class Screen(ID, bpy_struct):
areas: bpy_prop_collection[Area] = None
Good catch. I think we should change the analysis algorithm to support this.
I applied @MicaelJarniac 's suggestion now. I think this patch improves the code completion.
System Information
Expected behavior
The following should work:
If I inspect
bpy.types.bpy_prop_collection
inside of Blender, it has the following:So inside Blender, it does have a
__getitem__
method, with the following:Description about the bug
Inside of the fake
bpy
module,bpy.types.bpy_prop_collection
has only the following:Notice it has no
__getitem__
:And if I inspect its source, I can't find any "magic" dunder methods.
Additional comments
It seems like there are absolutely no dunder methods throughout the entire fake
bpy
module.