nutti / fake-bpy-module

Fake Blender Python API module collection for the code completion.
MIT License
1.32k stars 95 forks source link

bpy.utils.unregister_class() is not typed #149

Closed JonathanPlasse closed 8 months ago

JonathanPlasse commented 8 months ago

Hi

register_class() is typed

def register_class(cls: typing.Optional[typing.Any]):
    ''' Register a subclass of a Blender type class. :raises ValueError: if the class is not a subclass of a registerable blender class.

    :param cls: `bpy.types.Panel`, `bpy.types.UIList`, `bpy.types.Menu`, `bpy.types.Header`, `bpy.types.Operator`, `bpy.types.KeyingSetInfo`, `bpy.types.RenderEngine`
    :type cls: typing.Optional[typing.Any]
    '''

    pass

but not unregister_class()

def unregister_class(cls):
    ''' Unload the Python class from blender. If the class has an *unregister* class method it will be called before unregistering.

    '''

    pass

It trigger the error pyright reportUnknownMemberType

As unregister_class() is the mirror function of register_class() would it be possible to type it the same?

nutti commented 8 months ago

This issue need to be fixed from Blender source code. https://github.com/blender/blender/blob/9c0bffcc89f174f160805de042b00ae7c201c40b/source/blender/python/intern/bpy_rna.cc#L9089-L9095

nutti commented 8 months ago

Created the PR for this issue. https://projects.blender.org/blender/blender/pulls/114523

nutti commented 8 months ago

The patch is now merged.

JonathanPlasse commented 8 months ago

Thank you