-
Notifications
You must be signed in to change notification settings - Fork 163
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
graphviz typing error #1357
Comments
I need to check if this still applies to main with the latest commit after #1291. I believe the answer will be no.
|
Ah, sorry. I forgot to check main before opening the issue. It does look as though this is solved in main. An Thanks again for the quick response and a great package :) |
I have quite a few typing PRs open. Once Matthew has time to review them, I will work on the I think the ignore was there initially because Pillow didn't have type stubs initially. And then we never updated it |
Both mypy and pyright can be configured to emit an error if there is an unusued |
Information
graphviz_draw
has wrong documentation of return type both in type annotation and docstring. It is marked asPIL.Image
when in fact it should bePIL.Image.Image
.This confused me for a good while, since the module is both camel cased and has the same name as the correct return type...
"Doctesting" with pyright,
pyright --verifytypes rustworkx
, reports the wrong documentation in the type annotation (mypy -p rustworkx
misses it due to a# type: ignore
on that line) .Steps to reproduce the problem
Use
graphviz_draw
anywhere and check your script and check with pyright or mypy, the return type is inferred incorrectly.In runtime
python script.py
reports correctlyRuntime type is 'PngImageFile'
(PngImageFile
is a subtype ifImage.Image
).The two type checkers fail, one has missing inferred type and the other is wrong:
pyright
then output isscript.py:8:13 - information: Type of "img" is "Unknown"
.mypy
then output isscript.py:8: note: Revealed type is "None"
.The text was updated successfully, but these errors were encountered: