Uh oh!
There was an error while loading. Please reload this page.
add vtk stub files - #10446
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
AlexWaygood
commented
Jul 20, 2023
pre-commit.ci autofix |
This comment has been minimized.
This comment has been minimized.
I may need some help for this because the stub file generated doesn't seem to match valid python code and this generate an error classvtkTransform(vtkLinearTransform):
@overload# Overload does not consistently use the "@staticmethod" decorator on all function signatures.defGetOrientation(self, orient: MutableSequence[float]) ->None: ...
@overloaddefGetOrientation(self) ->tuple[float, float, float]: ...
@overload@staticmethoddefGetOrientation(orient: MutableSequence[float], matrix: vtkmodules.vtkCommonMath.vtkMatrix4x4) ->None: ...Which, I guess, should correspond to the following python code classvtkTransform(vtkLinearTransform):
defGetOrientation(self, orient=None):
pass@staticmethoddefGetOrientation(orient, matrix) ->None:
passBut this isn't valid python code, I have made this piece of code to test the behavior of the python interpreter (the comment is the error generated by my python interpreter): classFoo:
defbar(self) ->int: return1@staticmethoddefbar(i: str) ->None:
passprint(type(Foo.bar("abc")))
print(type(Foo().bar())) # TypeError: Foo.bar() missing 1 required positional argument: 'i'So I don't understand how they manage to do this since both methods works as expected in the case of vtk (comment correspond to the output of the script): importvtk.vtkCommonTransformsimportvtk.vtkCommonMathtransform=vtk.vtkCommonTransforms.vtkTransform()
print(transform.GetOrientation()) # (0.0, -0.0, 0.0)print(vtk.vtkCommonTransforms.vtkTransform.GetOrientation([0, 0, 0], vtk.vtkCommonMath.vtkMatrix4x4())) # NoneCan the behavior of python be different between |
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
JelleZijlstra
commented
Oct 2, 2024
I started looking at this with an eye towards getting CI to pass, since this is one of the oldest open PRs. Unfortunately, there is a really huge amount of stubtest errors, more than I can deal with. This probably needs someone with deeper familiarity with the library. |
JelleZijlstra
commented
Dec 28, 2024
Thanks for contributing! I'm closing this PR for now, because it still fails some tests |
These are the stub files generated by the vtk script generate_pyi.py
Should fix#10442
I am cleaning them and test them to be sure that it works
TODO:
Cleaning:
Generating