-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Enable Mypy strict mode #9803
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
base: main
Are you sure you want to change the base?
Enable Mypy strict mode #9803
Changes from all commits
64cc758
5bc0912
8ea699d
7d3a0a3
9dee48c
0e62d45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,7 +79,7 @@ def grab( | |
| scale = 1 if scale_down else 2 | ||
| im_cropped = im.resize( | ||
| ((right - left) * scale, (bottom - top) * scale), | ||
| box=tuple(coord * 2 for coord in bbox), | ||
| box=(left * 2, top * 2, right * 2, bottom * 2), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you like to either reduce the PR to just this, or split this bit to another PR? I'm happy to merge this.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Could you expand on what this means?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Split out: #9935
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yep, on ❯ tox -e mypy
mypy: commands[0]> mypy conftest.py selftest.py setup.py checks docs src winbuild Tests
src/PIL/ImageGrab.py:82: error: Argument "box" to "resize" of "Image" has incompatible
type "tuple[int, ...]"; expected "tuple[float, float, float, float] | None" [arg-type]
box=tuple(coord * 2 for coord in bbox),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in 1 file (checked 302 source files)
mypy: exit 1 (2.58 seconds) /Users/hugo/github/Pillow> mypy conftest.py selftest.py setup.py checks docs src winbuild Tests pid=84969
mypy: FAIL code 1 (2.58=setup[0.00]+cmd[2.58] seconds)
evaluation failed :( (2.63 seconds)And with #9935: ❯ tox -e mypy
mypy: commands[0]> mypy conftest.py selftest.py setup.py checks docs src winbuild Tests
Success: no issues found in 302 source files
mypy: OK (2.22=setup[0.00]+cmd[2.22] seconds)
congratulations :) (2.27 seconds)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So why isn't that error appearing in our CI?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CI runs on Ubuntu and the code in question is macOS-only, gated by
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, ok, I see. |
||
| ) | ||
| else: | ||
| im_cropped = im.crop(bbox) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self - it appears apache/arrow#48172 is blocking 3.15 support