Skip to content

chore: add PEP 484 type annotations to modifierservice.py#380

Open
yehorcallmedai-maker wants to merge 1 commit into
makehumancommunity:masterfrom
yehorcallmedai-maker:chore/type-hints-modifierservice
Open

chore: add PEP 484 type annotations to modifierservice.py#380
yehorcallmedai-maker wants to merge 1 commit into
makehumancommunity:masterfrom
yehorcallmedai-maker:chore/type-hints-modifierservice

Conversation

@yehorcallmedai-maker
Copy link
Copy Markdown
Contributor

Continuing the type annotation pass from #377 (logservice.py) and #378 (systemservice.py).

What this changes

Adds PEP 484 type annotations to all 7 static methods in ModifierService. No logic changes.

  • blender_object / armature_object / modifier return values typed as Any — bpy-stubs are not available at type-check time; Any is the honest annotation that avoids false-positive attribute errors
  • modifier_name, modifier_type, vertex_groupstr
  • show_in_editmode, show_on_cage, move_to_topbool
  • levels, render_levelsint
  • Added from typing import Any import

Pyright result

Baseline (before): 1 error, 0 warnings (bpy import unresolvable outside Blender)
After: 1 error, 0 warnings — no regressions introduced

@joepal1976
Copy link
Copy Markdown
Contributor

Regarding the "Any" part... If installing the fake-bpy-module per the https://github.com/makehumancommunity/mpfb2/blob/master/requirements-dev.txt file, pyright accepts "bpy.types.Object" as type hint.

Now, I'm new to pyright and haven't really done a lot of work with type hinting either. I'd love to hear your input on this. Is it a bad idea to rely on fake-bpy-module?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants