#NEWLINE# @ classmethod #NEWLINE# def from_line( cls , line ) : #NEWLINE# #INDENT# mlines = line . split ( utils . EOL ) #NEWLINE# headers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# content = '' #NEWLINE# has_body = ( 'Response: Follows' , 'Response: Fail' ) #NEWLINE# if mlines [ 0 ] . startswith ( has_body ) : #NEWLINE# #INDENT# content = mlines . pop ( ) #NEWLINE# while ( ( not content ) and mlines ) : #NEWLINE# #INDENT# content = mlines . pop ( ) #NEWLINE# #UNINDENT# #UNINDENT# for mline in mlines : #NEWLINE# #INDENT# if ( ': ' in mline ) : #NEWLINE# #INDENT# ( k , v ) = mline . split ( ': ' , 1 ) #NEWLINE# if ( k . lower ( ) in cls . quoted_keys ) : #NEWLINE# #INDENT# v = utils . unquote ( v ) . strip ( ) #NEWLINE# #UNINDENT# if ( k in headers ) : #NEWLINE# #INDENT# o = headers . setdefault ( k , [ ] ) #NEWLINE# if ( not isinstance ( o , list ) ) : #NEWLINE# #INDENT# o = [ o ] #NEWLINE# #UNINDENT# o . append ( v ) #NEWLINE# headers [ content ] = o #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# headers [ k ] = v #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( ( 'Event' in headers ) or ( 'Response' in headers ) ) : #NEWLINE# #INDENT# return cls ( headers , content )