Skip to content

Commit

Permalink
Added deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Mar 24, 2020
1 parent 9f89f26 commit ce40529
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Tests/test_file_jpeg2k.py
Expand Up @@ -129,7 +129,8 @@ def test_reduce():
with Image.open("Tests/images/test-card-lossless.jp2") as im:
assert callable(im.reduce)

im.reduce = 2
with pytest.warns(DeprecationWarning):
im.reduce = 2
assert im.reduce == 2

im.load()
Expand Down
6 changes: 6 additions & 0 deletions src/PIL/Jpeg2KImagePlugin.py
Expand Up @@ -15,6 +15,7 @@
import io
import os
import struct
import warnings

from . import Image, ImageFile

Expand Down Expand Up @@ -213,6 +214,11 @@ def reduce(self):

@reduce.setter
def reduce(self, value):
warnings.warn(
'The reduce property of Jpeg2KImageFile is deprecated, and will'
' be removed in a future version. Use the load_reduce method instead.',
DeprecationWarning
)
self.load_reduce = value

def load(self):
Expand Down

0 comments on commit ce40529

Please sign in to comment.