Skip to content

Commit 3c482b1

Browse files
committed
Changed list of single item dictionaries to dictionary
1 parent ad9614b commit 3c482b1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Tests/test_image_getxmp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ def test_getxmp():
66
xmp = im.getxmp()
77

88
assert isinstance(xmp, dict)
9-
assert xmp["Description"][0]["Version"] == "10.4"
9+
assert xmp["Description"]["Version"] == "10.4"

src/PIL/Image.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,10 +1334,10 @@ def getxmp(self):
13341334
if marker == b"http://ns.adobe.com/xap/1.0/":
13351335
root = xml.etree.ElementTree.fromstring(xmp_tags)
13361336
for element in root.findall(".//"):
1337-
xmp_attribs = []
1338-
for child, value in element.attrib.items():
1339-
xmp_attribs.append({child.split("}")[1]: value})
1340-
self._xmp.update({element.tag.split("}")[1]: xmp_attribs})
1337+
self._xmp[element.tag.split("}")[1]] = {
1338+
child.split("}")[1]: value
1339+
for child, value in element.attrib.items()
1340+
}
13411341
return self._xmp
13421342

13431343
def getim(self):

0 commit comments

Comments
 (0)