From a0aff1a87faa72373010d0e5c71667c7dcc34e19 Mon Sep 17 00:00:00 2001 From: hugovk Date: Fri, 1 Aug 2014 11:12:47 +0300 Subject: [PATCH] Remove disabled _is_raw() --- PIL/IptcImagePlugin.py | 30 ++---------------------------- Tests/test_file_iptc.py | 13 ------------- 2 files changed, 2 insertions(+), 41 deletions(-) diff --git a/PIL/IptcImagePlugin.py b/PIL/IptcImagePlugin.py index a94fc7524..dc8607591 100644 --- a/PIL/IptcImagePlugin.py +++ b/PIL/IptcImagePlugin.py @@ -88,28 +88,6 @@ class IptcImageFile(ImageFile.ImageFile): return tag, size - def _is_raw(self, offset, size): - # - # check if the file can be mapped - - # DISABLED: the following only slows things down... - return 0 - - self.fp.seek(offset) - t, sz = self.field() - if sz != size[0]: - return 0 - y = 1 - while True: - self.fp.seek(sz, 1) - t, s = self.field() - if t != (8, 10): - break - if s != sz: - return 0 - y += 1 - return y == size[1] - def _open(self): # load descriptive fields @@ -157,12 +135,8 @@ class IptcImageFile(ImageFile.ImageFile): # tile if tag == (8, 10): - if compression == "raw" and self._is_raw(offset, self.size): - self.tile = [(compression, (offset, size + 5, -1), - (0, 0, self.size[0], self.size[1]))] - else: - self.tile = [("iptc", (compression, offset), - (0, 0, self.size[0], self.size[1]))] + self.tile = [("iptc", (compression, offset), + (0, 0, self.size[0], self.size[1]))] def load(self): diff --git a/Tests/test_file_iptc.py b/Tests/test_file_iptc.py index fd68e88b6..3c04b7413 100644 --- a/Tests/test_file_iptc.py +++ b/Tests/test_file_iptc.py @@ -41,19 +41,6 @@ class TestFileIptc(PillowTestCase): self.assertEqual(iptc[(2, 90)], b"Budapest") self.assertEqual(iptc[(2, 101)], b"Hungary") - # _FIXME: is_raw() is disabled. Should we remove it? - def test__is_raw_equal_zero(self): - # Arrange - im = self.dummy_IptcImagePlugin() - offset = 0 - size = 4 - - # Act - ret = im._is_raw(offset, size) - - # Assert - self.assertEqual(ret, 0) - def test_i(self): # Arrange c = b"a"