Skip to content
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

Functions without return type do not contain "-> None" #30

Open
Ruudjhuu opened this issue Jan 4, 2025 · 2 comments
Open

Functions without return type do not contain "-> None" #30

Ruudjhuu opened this issue Jan 4, 2025 · 2 comments

Comments

@Ruudjhuu
Copy link
Contributor

Ruudjhuu commented Jan 4, 2025

Describe the bug
Functions without a return type should contain "-> None" to indicate it does not return anything. The functions do include "-> None" in the docstring but not after the function itself:

An example of the many functions:
image

When using a type checker these functions are considered "untyped"

Expected behavior
All functions contain a return type.

Used versions (please complete the following information):

  • FreeCAD-stub version 1.0.17
@ostr00000
Copy link
Owner

What type checker do you use? is it pyright?
I would expect that functions from stubs will be interpreted to return Any if no explicit type is provided.

This is a little tricky, because if no return annotation is present, it means that extracting the return type from c++ failed.
I no longer use return type from docstring, because it turns out that these signatures frequently are wrong and moreover no standard syntax is used for this (although in your example it would be easy to extract return type).

I am leaving this issue open until I rewrite the code generator to use clang - I expect that this will be solved then.

@Ruudjhuu
Copy link
Contributor Author

Ruudjhuu commented Jan 7, 2025

I used mypy with thestrict flag enabled.

When I use pyright with strict enabled, I also get an error.
If a return value is unkown, pyright will make it -> Unkown and thus cannot check it.

image

I understand that you leave this issue open until the rewrite. It is not a issue which should get any prio.

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

No branches or pull requests

2 participants