Changed list of single item dictionaries to dictionary

This commit is contained in:
Andrew Murray 2020-12-30 23:10:29 +11:00
parent ad9614be7a
commit 3c482b1b0b
2 changed files with 5 additions and 5 deletions

View File

@ -6,4 +6,4 @@ def test_getxmp():
xmp = im.getxmp()
assert isinstance(xmp, dict)
assert xmp["Description"][0]["Version"] == "10.4"
assert xmp["Description"]["Version"] == "10.4"

View File

@ -1334,10 +1334,10 @@ class Image:
if marker == b"http://ns.adobe.com/xap/1.0/":
root = xml.etree.ElementTree.fromstring(xmp_tags)
for element in root.findall(".//"):
xmp_attribs = []
for child, value in element.attrib.items():
xmp_attribs.append({child.split("}")[1]: value})
self._xmp.update({element.tag.split("}")[1]: xmp_attribs})
self._xmp[element.tag.split("}")[1]] = {
child.split("}")[1]: value
for child, value in element.attrib.items()
}
return self._xmp
def getim(self):