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

Pillow: Add missing enums from 9.1.0 #9698

Merged
merged 3 commits into from
Feb 9, 2023
Merged

Conversation

andersk and others added 3 commits February 9, 2023 01:13
For example, although Image.BILINEAR is just 2, Image.LINEAR is
Resampling.BILINEAR (an IntEnum item with value 2).

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2023

Diff from mypy_primer, showing the effect of this PR on open source code:

vision (https://github.com/pytorch/vision)
- torchvision/transforms/_pil_constants.py:20: error: Incompatible types in assignment (expression has type "Literal[2]", variable has type "Resampling")  [assignment]

imagehash (https://github.com/JohannesBuchner/imagehash)
- imagehash/__init__.py:42: error: Incompatible types in assignment (expression has type "Literal[1]", variable has type "Resampling")  [assignment]

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

class Format(IntEnum):
JPEG: int

BLP_FORMAT_JPEG: Literal[Format.JPEG]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I didn't know that worked.

@srittau srittau merged commit afb7704 into python:main Feb 9, 2023
@andersk andersk deleted the pillow-enums branch February 9, 2023 10:07
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

Successfully merging this pull request may close these issues.

None yet

2 participants