mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 13:14:27 +03:00
Merge pull request #2551 from jdufresne/keys
Remove unnecessary calls to dict.keys()
This commit is contained in:
commit
c16ba722f2
|
@ -176,8 +176,8 @@ class IcoFile(object):
|
|||
# figure out where AND mask image starts
|
||||
mode = a[0]
|
||||
bpp = 8
|
||||
for k in BmpImagePlugin.BIT2MODE.keys():
|
||||
if mode == BmpImagePlugin.BIT2MODE[k][1]:
|
||||
for k, v in BmpImagePlugin.BIT2MODE.items():
|
||||
if mode == v[1]:
|
||||
bpp = k
|
||||
break
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ def _conv_type_shape(im):
|
|||
return shape+(extra,), typ
|
||||
|
||||
|
||||
MODES = sorted(_MODEINFO.keys())
|
||||
MODES = sorted(_MODEINFO)
|
||||
|
||||
# raw modes that may be memory mapped. NOTE: if you change this, you
|
||||
# may have to modify the stride calculation in map.c too!
|
||||
|
|
|
@ -95,7 +95,7 @@ class IptcImageFile(ImageFile.ImageFile):
|
|||
tagdata = self.fp.read(size)
|
||||
else:
|
||||
tagdata = None
|
||||
if tag in list(self.info.keys()):
|
||||
if tag in self.info:
|
||||
if isinstance(self.info[tag], list):
|
||||
self.info[tag].append(tagdata)
|
||||
else:
|
||||
|
|
|
@ -439,7 +439,7 @@ class TestFileJpeg(PillowTestCase):
|
|||
def test_no_duplicate_0x1001_tag(self):
|
||||
# Arrange
|
||||
from PIL import ExifTags
|
||||
tag_ids = dict(zip(ExifTags.TAGS.values(), ExifTags.TAGS.keys()))
|
||||
tag_ids = {v: k for k, v in ExifTags.TAGS.items()}
|
||||
|
||||
# Assert
|
||||
self.assertEqual(tag_ids['RelatedImageWidth'], 0x1001)
|
||||
|
|
|
@ -189,7 +189,7 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
# Exclude ones that have special meaning
|
||||
# that we're already testing them
|
||||
im = Image.open('Tests/images/hopper_g4.tif')
|
||||
for tag in im.tag_v2.keys():
|
||||
for tag in im.tag_v2:
|
||||
try:
|
||||
del(core_items[tag])
|
||||
except:
|
||||
|
|
|
@ -119,7 +119,7 @@ class TestImageColor(PillowTestCase):
|
|||
# look for rounding errors (based on code by Tim Hatch)
|
||||
def test_rounding_errors(self):
|
||||
|
||||
for color in list(ImageColor.colormap.keys()):
|
||||
for color in ImageColor.colormap:
|
||||
expected = Image.new(
|
||||
"RGB", (1, 1), color).convert("L").getpixel((0, 0))
|
||||
actual = ImageColor.getcolor(color, 'L')
|
||||
|
|
|
@ -12,7 +12,7 @@ from config import (compilers, compiler_from_env, pythons, pyversion_from_env,
|
|||
|
||||
def setup_vms():
|
||||
ret = []
|
||||
for py in pythons.keys():
|
||||
for py in pythons:
|
||||
for arch in ('', X64_EXT):
|
||||
ret.append("virtualenv -p c:/Python%s%s/python.exe --clear %s%s%s"
|
||||
% (py, arch, VIRT_BASE, py, arch))
|
||||
|
|
|
@ -116,7 +116,7 @@ def pyversion_from_env():
|
|||
py = os.environ['PYTHON']
|
||||
|
||||
py_version = '27'
|
||||
for k in pythons.keys():
|
||||
for k in pythons:
|
||||
if k in py:
|
||||
py_version = k
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue
Block a user