mirror of
				https://github.com/arsenetar/dupeguru.git
				synced 2025-09-11 17:58:17 +00:00 
			
		
		
		
	Adapt IPhotoPlistParser to Python 3.4
This also means that Python 3.3 isn't supported anymore for that part. Updated README accordingly.
This commit is contained in:
		
							parent
							
								
									ebd7f1b4ce
								
							
						
					
					
						commit
						f5f29d775c
					
				@ -47,7 +47,7 @@ Prerequisites are installed through `pip`. However, some of them are not "pip in
 | 
				
			|||||||
to be installed manually.
 | 
					to be installed manually.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* All systems: [Python 3.3+][python] and [setuptools][setuptools]
 | 
					* All systems: [Python 3.3+][python] and [setuptools][setuptools]
 | 
				
			||||||
* Mac OS X: The last XCode to have the 10.7 SDK included.
 | 
					* Mac OS X: The last XCode to have the 10.7 SDK included. Python 3.4+.
 | 
				
			||||||
* Windows: Visual Studio 2010, [PyQt 5.0+][pyqt], [cx_Freeze][cxfreeze] and
 | 
					* Windows: Visual Studio 2010, [PyQt 5.0+][pyqt], [cx_Freeze][cxfreeze] and
 | 
				
			||||||
  [Advanced Installer][advinst] (you only need the last two if you want to create an installer)
 | 
					  [Advanced Installer][advinst] (you only need the last two if you want to create an installer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -8,24 +8,24 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import plistlib
 | 
					import plistlib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class IPhotoPlistParser(plistlib.PlistParser):
 | 
					class IPhotoPlistParser(plistlib._PlistParser):
 | 
				
			||||||
    """A parser for iPhoto plists.
 | 
					    """A parser for iPhoto plists.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    iPhoto plists tend to be malformed, so we have to subclass the built-in parser to be a bit more
 | 
					    iPhoto plists tend to be malformed, so we have to subclass the built-in parser to be a bit more
 | 
				
			||||||
    lenient.
 | 
					    lenient.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    def __init__(self):
 | 
					    def __init__(self):
 | 
				
			||||||
        plistlib.PlistParser.__init__(self)
 | 
					        plistlib._PlistParser.__init__(self, use_builtin_types=True, dict_type=dict)
 | 
				
			||||||
        # For debugging purposes, we remember the last bit of data to be analyzed so that we can
 | 
					        # For debugging purposes, we remember the last bit of data to be analyzed so that we can
 | 
				
			||||||
        # log it in case of an exception
 | 
					        # log it in case of an exception
 | 
				
			||||||
        self.lastdata = ''
 | 
					        self.lastdata = ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def getData(self):
 | 
					    def get_data(self):
 | 
				
			||||||
        self.lastdata = plistlib.PlistParser.getData(self)
 | 
					        self.lastdata = plistlib._PlistParser.get_data(self)
 | 
				
			||||||
        return self.lastdata
 | 
					        return self.lastdata
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def end_integer(self):
 | 
					    def end_integer(self):
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            self.addObject(int(self.getData()))
 | 
					            self.add_object(int(self.get_data()))
 | 
				
			||||||
        except ValueError:
 | 
					        except ValueError:
 | 
				
			||||||
            self.addObject(0)
 | 
					            self.add_object(0)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user