#NEWLINE# def _get_headers( self , filename ) : #NEWLINE# #INDENT# if path . isfile ( f ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# f = open ( filename , 'r' ) #NEWLINE# strip = ( lambda s : ( s if ( len ( s ) == 0 ) else ( s [ 0 ] + s [ 1 : ] . strip ( ) ) ) ) #NEWLINE# headers_raw = '\r\n' . join ( map ( strip , f . readlines ( ) [ 1 : ] ) ) #NEWLINE# f . close ( ) #NEWLINE# return email . parser . Parser ( ) . parsestr ( headers_raw ) . items ( ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# print_ ( ( "Can't parse headers from '%s'" % filename ) ) #NEWLINE# print_ ( e ) #NEWLINE# print_ ( '\n' ) #NEWLINE# #UNINDENT# #UNINDENT# return None