nutti / fake-bpy-module

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

Types order in unions is not reproducible #177

Closed JonathanPlasse closed 7 months ago

JonathanPlasse commented 9 months ago

Expected behavior

The order of type in unions is not reproducible between generation. This is a problem, as people who add the pyi files to git project will have large, unneeded diffs. I would propose to sort the types in unions alphabetically, like it is done in other parts of the code.

Description about the bug

Between generation, the order of types in unions is not the same.

Screenshots/Files [Optional]

This is an example.

diff --git a/out/bpy_extras/anim_utils/__init__.pyi b/out/bpy_extras/anim_utils/__init__.pyi
index 7f75a83..ede825b 100644
--- a/out/bpy_extras/anim_utils/__init__.pyi
+++ b/out/bpy_extras/anim_utils/__init__.pyi
@@ -78,14 +78,14 @@ def bake_action_objects(

 def bake_action_objects_iter(
     object_action_pairs: typing.Union[
-        "bpy.types.Action", "bpy.types.Sequence", "bpy.types.Object"
+        "bpy.types.Object", "bpy.types.Sequence", "bpy.types.Action"
     ],
     **kwargs,
 ):
     """An coroutine that bakes actions for multiple objects.

     :param object_action_pairs: Sequence of object action tuples, action is the destination for the baked data. When None a new action will be created.
-    :type object_action_pairs: typing.Union['bpy.types.Action', 'bpy.types.Sequence', 'bpy.types.Object']
+    :type object_action_pairs: typing.Union['bpy.types.Object', 'bpy.types.Sequence', 'bpy.types.Action']
     """

     ...