mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Merge pull request #10 from radarhere/feature_xmp
Changed list of single items dictionaries to dictionary
This commit is contained in:
		
						commit
						0084234aa9
					
				| 
						 | 
				
			
			@ -2,8 +2,8 @@ from PIL import Image
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_getxmp():
 | 
			
		||||
    im = Image.open("Tests/images/xmp_test.jpg")
 | 
			
		||||
    type_repr = repr(type(im.getxmp()))
 | 
			
		||||
    with Image.open("Tests/images/xmp_test.jpg") as im:
 | 
			
		||||
        xmp = im.getxmp()
 | 
			
		||||
 | 
			
		||||
    assert "dict" in type_repr
 | 
			
		||||
    assert isinstance(im.getxmp()["Description"][0]["Version"], str)
 | 
			
		||||
        assert isinstance(xmp, dict)
 | 
			
		||||
        assert xmp["Description"]["Version"] == "10.4"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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_atribs = []
 | 
			
		||||
                        for child, value in element.attrib.items():
 | 
			
		||||
                            xmp_atribs.append({child.split("}")[1]: value})
 | 
			
		||||
                        self._xmp.update({element.tag.split("}")[1]: xmp_atribs})
 | 
			
		||||
                        self._xmp[element.tag.split("}")[1]] = {
 | 
			
		||||
                            child.split("}")[1]: value
 | 
			
		||||
                            for child, value in element.attrib.items()
 | 
			
		||||
                        }
 | 
			
		||||
        return self._xmp
 | 
			
		||||
 | 
			
		||||
    def getim(self):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user