Lint fixes

This commit is contained in:
Andrew Murray 2019-12-31 11:58:39 +11:00
parent 6d3fb7b083
commit 74d53bcd15
2 changed files with 4 additions and 4 deletions

View File

@ -253,7 +253,7 @@ class TestFileTiffMetadata(PillowTestCase):
# pair of 4 byte signed longs
numerator = 2 ** 31 - 1
denominator = -2 ** 31
denominator = -(2 ** 31)
info[37380] = TiffImagePlugin.IFDRational(numerator, denominator)
@ -265,7 +265,7 @@ class TestFileTiffMetadata(PillowTestCase):
self.assertEqual(denominator, reloaded.tag_v2[37380].denominator)
# pair of 4 byte signed longs
numerator = -2 ** 31
numerator = -(2 ** 31)
denominator = 2 ** 31 - 1
info[37380] = TiffImagePlugin.IFDRational(numerator, denominator)

View File

@ -544,7 +544,7 @@ class ImageFileDirectory_v2(MutableMapping):
elif all(isinstance(v, int) for v in values):
if all(0 <= v < 2 ** 16 for v in values):
self.tagtype[tag] = TiffTags.SHORT
elif all(-2 ** 15 < v < 2 ** 15 for v in values):
elif all(-(2 ** 15) < v < 2 ** 15 for v in values):
self.tagtype[tag] = TiffTags.SIGNED_SHORT
else:
self.tagtype[tag] = (
@ -715,7 +715,7 @@ class ImageFileDirectory_v2(MutableMapping):
@_register_writer(10)
def write_signed_rational(self, *values):
return b"".join(
self._pack("2l", *_limit_signed_rational(frac, 2 ** 31 - 1, -2 ** 31))
self._pack("2l", *_limit_signed_rational(frac, 2 ** 31 - 1, -(2 ** 31)))
for frac in values
)