Skip to content

Pillow: Add missing enums from 9.1.0#9698

Merged
srittau merged 3 commits intopython:mainfrom
andersk:pillow-enums
Feb 9, 2023
Merged

Pillow: Add missing enums from 9.1.0#9698
srittau merged 3 commits intopython:mainfrom
andersk:pillow-enums

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.

2 participants