We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The type annotation for _Ink in in ImageDraw.pyi should also include a tuple with 4 integers.
Write code for drawing a rectangle.
from PIL.Image import Image from PIL.ImageDraw import ImageDraw img = Image() draw = ImageDraw(img) draw.rectangle(((0, 0), (100, 100)), (0, 0, 0, 100))
And run pytype.
pytype filename.py
Pytype was fine with the color with an alpha channel.
PyType is not fine.
Computing dependencies Analyzing 1 sources with 0 local dependencies ninja: Entering directory `.pytype' [1/1] check scratch_17 FAILED: /home/pieter/projects/orbisk/annotation_db/.pytype/pyi/scratch_17.pyi /home/pieter/.local/share/virtualenvs/annotation_db-Tf8o4jwu/bin/python -m pytype.single --imports_info /home/pieter/projects/orbisk/annotation_db/.pytype/imports/scratch_17.imports --module-name scratch_17 -V 3.7 -o /home/pieter/projects/orbisk/annotation_db/.pytype/pyi/scratch_17.pyi --analyze-annotated --nofail --quick /home/pieter/.config/JetBrains/PyCharm2021.2/scratches/scratch_17.py File "/home/pieter/.config/JetBrains/PyCharm2021.2/scratches/scratch_17.py", line 6, in <module>: Function ImageDraw.rectangle was called with the wrong arguments [wrong-arg-types] Expected: (self, xy, fill: Optional[Union[int, str, Tuple[int, int, int]]] = ..., ...) Actually passed: (self, xy, fill: Tuple[int, int, int, int]) For more details, see https://google.github.io/pytype/errors.html#wrong-arg-types ninja: build stopped: subcommand failed. Leaving directory '.pytype'
Probably the same results with mypy.
Not relevant.
The text was updated successfully, but these errors were encountered:
Hi. As discussed in #5707, we don't actually have any typing in Pillow.
I'm guessing (https://www.jetbrains.com/help/pycharm/type-hinting-in-product.html#typeshed) that you're using Typeshed, in which case you may want to talk to https://github.com/python/typeshed. See https://github.com/python/typeshed/blob/master/stubs/Pillow/PIL/ImageDraw.pyi for their current typing in ImageDraw.
Sorry, something went wrong.
Looks right!
Thanks! I'll create an issue over there.
No branches or pull requests
The type annotation for _Ink in in ImageDraw.pyi should also include a tuple with 4 integers.
What did you do?
Write code for drawing a rectangle.
And run pytype.
What did you expect to happen?
Pytype was fine with the color with an alpha channel.
What actually happened?
PyType is not fine.
Probably the same results with mypy.
What are your OS, Python and Pillow versions?
Not relevant.
The text was updated successfully, but these errors were encountered: