mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-01 02:13:11 +03:00
Use 'key in mydict' instead of 'key in mydict.keys()'
This commit is contained in:
parent
b2b8c833aa
commit
2df4865e42
|
@ -593,7 +593,7 @@ class TestFilePng:
|
||||||
|
|
||||||
def test_textual_chunks_after_idat(self):
|
def test_textual_chunks_after_idat(self):
|
||||||
with Image.open("Tests/images/hopper.png") as im:
|
with Image.open("Tests/images/hopper.png") as im:
|
||||||
assert "comment" in im.text.keys()
|
assert "comment" in im.text
|
||||||
for k, v in {
|
for k, v in {
|
||||||
"date:create": "2014-09-04T09:37:08+03:00",
|
"date:create": "2014-09-04T09:37:08+03:00",
|
||||||
"date:modify": "2014-09-04T09:37:08+03:00",
|
"date:modify": "2014-09-04T09:37:08+03:00",
|
||||||
|
|
|
@ -487,7 +487,7 @@ def _normalize_mode(im):
|
||||||
if Image.getmodebase(im.mode) == "RGB":
|
if Image.getmodebase(im.mode) == "RGB":
|
||||||
im = im.convert("P", palette=Image.Palette.ADAPTIVE)
|
im = im.convert("P", palette=Image.Palette.ADAPTIVE)
|
||||||
if im.palette.mode == "RGBA":
|
if im.palette.mode == "RGBA":
|
||||||
for rgba in im.palette.colors.keys():
|
for rgba in im.palette.colors:
|
||||||
if rgba[3] == 0:
|
if rgba[3] == 0:
|
||||||
im.info["transparency"] = im.palette.colors[rgba]
|
im.info["transparency"] = im.palette.colors[rgba]
|
||||||
break
|
break
|
||||||
|
|
|
@ -3841,7 +3841,7 @@ class Exif(MutableMapping):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
if self._info is not None:
|
if self._info is not None:
|
||||||
# Load all keys into self._data
|
# Load all keys into self._data
|
||||||
for tag in self._info.keys():
|
for tag in self._info:
|
||||||
self[tag]
|
self[tag]
|
||||||
|
|
||||||
return str(self._data)
|
return str(self._data)
|
||||||
|
|
|
@ -257,7 +257,7 @@ OPEN_INFO = {
|
||||||
(MM, 8, (1,), 1, (8, 8, 8), ()): ("LAB", "LAB"),
|
(MM, 8, (1,), 1, (8, 8, 8), ()): ("LAB", "LAB"),
|
||||||
}
|
}
|
||||||
|
|
||||||
MAX_SAMPLESPERPIXEL = max(len(key_tp[4]) for key_tp in OPEN_INFO.keys())
|
MAX_SAMPLESPERPIXEL = max(len(key_tp[4]) for key_tp in OPEN_INFO)
|
||||||
|
|
||||||
PREFIXES = [
|
PREFIXES = [
|
||||||
b"MM\x00\x2A", # Valid TIFF header with big-endian byte order
|
b"MM\x00\x2A", # Valid TIFF header with big-endian byte order
|
||||||
|
@ -1222,7 +1222,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
# load IFD data from fp before it is closed
|
# load IFD data from fp before it is closed
|
||||||
exif = self.getexif()
|
exif = self.getexif()
|
||||||
for key in TiffTags.TAGS_V2_GROUPS.keys():
|
for key in TiffTags.TAGS_V2_GROUPS:
|
||||||
if key not in exif:
|
if key not in exif:
|
||||||
continue
|
continue
|
||||||
exif.get_ifd(key)
|
exif.get_ifd(key)
|
||||||
|
@ -1629,7 +1629,7 @@ def _save(im, fp, filename):
|
||||||
if isinstance(info, ImageFileDirectory_v1):
|
if isinstance(info, ImageFileDirectory_v1):
|
||||||
info = info.to_v2()
|
info = info.to_v2()
|
||||||
for key in info:
|
for key in info:
|
||||||
if isinstance(info, Image.Exif) and key in TiffTags.TAGS_V2_GROUPS.keys():
|
if isinstance(info, Image.Exif) and key in TiffTags.TAGS_V2_GROUPS:
|
||||||
ifd[key] = info.get_ifd(key)
|
ifd[key] = info.get_ifd(key)
|
||||||
else:
|
else:
|
||||||
ifd[key] = info.get(key)
|
ifd[key] = info.get(key)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user