-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
add vtk stub files #10446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
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 class vtkTransform(vtkLinearTransform):
@overload # Overload does not consistently use the "@staticmethod" decorator on all function signatures.
def GetOrientation(self, orient: MutableSequence[float]) -> None: ...
@overload
def GetOrientation(self) -> tuple[float, float, float]: ...
@overload
@staticmethod
def GetOrientation(orient: MutableSequence[float], matrix: vtkmodules.vtkCommonMath.vtkMatrix4x4) -> None: ... Which, I guess, should correspond to the following python code class vtkTransform(vtkLinearTransform):
def GetOrientation(self, orient = None):
pass
@staticmethod
def GetOrientation(orient, matrix) -> None:
pass But 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): class Foo:
def bar(self) -> int:
return 1
@staticmethod
def bar(i: str) -> None:
pass
print(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): import vtk.vtkCommonTransforms
import vtk.vtkCommonMath
transform = vtk.vtkCommonTransforms.vtkTransform()
print(transform.GetOrientation()) # (0.0, -0.0, 0.0)
print(vtk.vtkCommonTransforms.vtkTransform.GetOrientation([0, 0, 0], vtk.vtkCommonMath.vtkMatrix4x4())) # None Can 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. 🤖🎉 |
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. |
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