#NEWLINE# def read( self ) : #NEWLINE# #INDENT# prefix = self . data [ 0 : 6 ] #NEWLINE# if ( ( prefix == 'bplist' ) or ( prefix == '<?xml ' ) ) : #NEWLINE# #INDENT# if ( prefix == 'bplist' ) : #NEWLINE# #INDENT# self . file_type = 'binary' #NEWLINE# import sys #NEWLINE# if ( not ( sys . version_info >= ( 3 , 4 ) ) ) : #NEWLINE# #INDENT# import Foundation #NEWLINE# ( plistNSData , errorMessage ) = Foundation . NSData . dataWithContentsOfFile_options_error_ ( self . file_path , Foundation . NSUncachedRead , None ) #NEWLINE# if ( errorMessage == None ) : #NEWLINE# #INDENT# ( plistContents , plistFormat , errorMessage ) = Foundation . NSPropertyListSerialization . propertyListFromData_mutabilityOption_format_errorDescription_ ( plistNSData , Foundation . NSPropertyListMutableContainers , None , None ) #NEWLINE# if ( errorMessage == None ) : #NEWLINE# #INDENT# return plistContents #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# message = ( '[plist_helper]: %s' % prefix ) #NEWLINE# raise Exception ( message ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# message = ( '[plist_helper]: %s' % errorMessage ) #NEWLINE# raise Exception ( message ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# import plistlib #NEWLINE# return plistlib . readPlist ( self . file_path ) #NEWLINE# #UNINDENT# #UNINDENT# if ( prefix == '<?xml ' ) : #NEWLINE# #INDENT# self . file_type = 'xml' #NEWLINE# import plistlib #NEWLINE# return plistlib . readPlist ( self . file_path ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . file_type = 'ascii' #NEWLINE# if ( self . data [ 0 : 2 ] == '//' ) : #NEWLINE# #INDENT# import re #NEWLINE# result = re . search ( '^// !\\$\\*(.+?)\\*\\$!' , self . data ) #NEWLINE# if result : #NEWLINE# #INDENT# self . string_encoding = result . group ( 1 ) #NEWLINE# #UNINDENT# #UNINDENT# return self . __readTest ( True )