Use dict comprehension in ImageFileDirectory_v2.named() (#3872)

Use dict comprehension in ImageFileDirectory_v2.named()
This commit is contained in:
Hugo 2019-05-27 09:48:20 +03:00 committed by GitHub
commit 65f3e44b3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -523,8 +523,7 @@ class ImageFileDirectory_v2(MutableMapping):
Returns the complete tag dictionary, with named tags where possible. Returns the complete tag dictionary, with named tags where possible.
""" """
return dict((TiffTags.lookup(code).name, value) return {TiffTags.lookup(code).name: value for code, value in self.items()}
for code, value in self.items())
def __len__(self): def __len__(self):
return len(set(self._tagdata) | set(self._tags_v2)) return len(set(self._tagdata) | set(self._tags_v2))