Update to getattr()
This now a one-liner, compared to 6 lines originally. And it should be (algorithmically) faster.
This commit is contained in:
parent
132464c0a1
commit
2b563c0982
1 changed files with 1 additions and 4 deletions
|
@ -1832,10 +1832,7 @@ def read_images(
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
logger.debug("PIL format = %s", imgdata.format)
|
logger.debug("PIL format = %s", imgdata.format)
|
||||||
try:
|
imgformat = getattr(ImageFormat, imgdata.format, ImageFormat.other)
|
||||||
imgformat = ImageFormat[imgdata.format]
|
|
||||||
except KeyError:
|
|
||||||
imgformat = ImageFormat.other
|
|
||||||
|
|
||||||
def cleanup():
|
def cleanup():
|
||||||
if imgdata is not None:
|
if imgdata is not None:
|
||||||
|
|
Loading…
Reference in a new issue