#NEWLINE# def fromPath( cls , path ) : #NEWLINE# #INDENT# '\n        @param path: A path object to use for both reading contents from and\n        later saving to.\n\n        @type path: L{FilePath}\n        ' #NEWLINE# self = cls ( path ) #NEWLINE# try : #NEWLINE# #INDENT# fp = path . open ( ) #NEWLINE# #UNINDENT# except IOError : #NEWLINE# #INDENT# return self #NEWLINE# #UNINDENT# for line in fp : #NEWLINE# #INDENT# if line . startswith ( HashedEntry . MAGIC ) : #NEWLINE# #INDENT# entry = HashedEntry . fromString ( line ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# entry = PlainEntry . fromString ( line ) #NEWLINE# #UNINDENT# except ( DecodeError , InvalidEntry , BadKeyError ) : #NEWLINE# #INDENT# entry = UnparsedEntry ( line ) #NEWLINE# #UNINDENT# #UNINDENT# self . _entries . append ( entry ) #NEWLINE# #UNINDENT# return self