#NEWLINE# @ classmethod #NEWLINE# def parser( cls , buf ) : #NEWLINE# #INDENT# ( type_ , code , csum ) = struct . unpack_from ( cls . _PACK_STR , buf ) #NEWLINE# msg = cls ( type_ , code , csum ) #NEWLINE# offset = cls . _MIN_LEN #NEWLINE# if ( len ( buf ) > offset ) : #NEWLINE# #INDENT# cls_ = cls . _ICMP_TYPES . get ( type_ , None ) #NEWLINE# if cls_ : #NEWLINE# #INDENT# msg . data = cls_ . parser ( buf , offset ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg . data = buf [ offset : ] #NEWLINE# #UNINDENT# #UNINDENT# return ( msg , None , None )