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

Change constants usage to remove pillow future updates warnings #282

Merged
merged 4 commits into from
Nov 14, 2022

Conversation

alfreedom
Copy link
Contributor

Change constants usage to fix the deprecation warnings for PIL >= 10

This is a simple change to use the constants from the Enum defined in the PIL.Image module to remove the deprecation messages from pillow:

.../qrcode/image/styledpil.py:49: DeprecationWarning: LANCZOS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.
    self.embeded_image_resample = kwargs.get("embeded_image_resample", Image.LANCZOS)

.../qrcode/image/styles/moduledrawers.py:128: DeprecationWarning: LANCZOS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.
    self.NW_ROUND = base.resize((self.corner_width, self.corner_width), Image.LANCZOS)

.../qrcode/image/styles/moduledrawers.py:129: DeprecationWarning: FLIP_TOP_BOTTOM is deprecated and will be removed in Pillow 10 (2023-07-01). Use Transpose.FLIP_TOP_BOTTOM instead.
    self.SW_ROUND = self.NW_ROUND.transpose(Image.FLIP_TOP_BOTTOM)

.../qrcode/image/styles/moduledrawers.py:130: DeprecationWarning: ROTATE_180 is deprecated and will be removed in Pillow 10 (2023-07-01). Use Transpose.ROTATE_180 instead.
    self.SE_ROUND = self.NW_ROUND.transpose(Image.ROTATE_180)

.../qrcode/image/styles/moduledrawers.py:131: DeprecationWarning: FLIP_LEFT_RIGHT is deprecated and will be removed in Pillow 10 (2023-07-01). Use Transpose.FLIP_LEFT_RIGHT instead.
    self.NE_ROUND = self.NW_ROUND.transpose(Image.FLIP_LEFT_RIGHT)

Copy link
Member

@SmileyChris SmileyChris left a comment

Choose a reason for hiding this comment

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

Hey, this looks good. Can you find which version of pillow these constants were moved, and add that as a minimum version for pillow in setup.cfg?

@SmileyChris
Copy link
Member

(rebase this against the latest master and it should fix the failing tests)

@alfreedom
Copy link
Contributor Author

Hey, this looks good. Can you find which version of pillow these constants were moved, and add that as a minimum version for pillow in setup.cfg?

Sure, this deprecation was informed in the 9.1.0 release version so this may be the minimum required version.

Release of pillow 10.0.0 will be until 2023-07-01

@SmileyChris SmileyChris merged commit 0931cac into lincolnloop:master Nov 14, 2022
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