"git@developer.sourcefind.cn:OpenDAS/torchaudio.git" did not exist on "c12f4734807b57f3d5a27fac91296fe9efdced58"
Unverified Commit c02d6ce1 authored by vfdev's avatar vfdev Committed by GitHub
Browse files

Update _pil_constants.py (#6154)



* Update _pil_constants.py

* Update _pil_constants.py

* Fix flake8

* Fixed two related warnings in tests

* switch dir with hasattr
Co-authored-by: default avatarVasilis Vryniotis <datumbox@users.noreply.github.com>
parent fee6d12c
...@@ -1522,10 +1522,10 @@ def test_ten_crop(should_vflip, single_dim): ...@@ -1522,10 +1522,10 @@ def test_ten_crop(should_vflip, single_dim):
five_crop.__repr__() five_crop.__repr__()
if should_vflip: if should_vflip:
vflipped_img = img.transpose(Image.FLIP_TOP_BOTTOM) vflipped_img = img.transpose(_pil_constants.FLIP_TOP_BOTTOM)
expected_output += five_crop(vflipped_img) expected_output += five_crop(vflipped_img)
else: else:
hflipped_img = img.transpose(Image.FLIP_LEFT_RIGHT) hflipped_img = img.transpose(_pil_constants.FLIP_LEFT_RIGHT)
expected_output += five_crop(hflipped_img) expected_output += five_crop(hflipped_img)
assert len(results) == 10 assert len(results) == 10
......
import PIL
from PIL import Image from PIL import Image
# See https://pillow.readthedocs.io/en/stable/releasenotes/9.1.0.html#deprecations # See https://pillow.readthedocs.io/en/stable/releasenotes/9.1.0.html#deprecations
# TODO: Remove this file once PIL minimal version is >= 9.1 # TODO: Remove this file once PIL minimal version is >= 9.1
if tuple(int(part) for part in PIL.__version__.split(".")) >= (9, 1): if hasattr(Image, "Resampling"):
BICUBIC = Image.Resampling.BICUBIC BICUBIC = Image.Resampling.BICUBIC
BILINEAR = Image.Resampling.BILINEAR BILINEAR = Image.Resampling.BILINEAR
LINEAR = Image.Resampling.BILINEAR LINEAR = Image.Resampling.BILINEAR
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment