#NEWLINE# def load( self , fp ) : #NEWLINE# #INDENT# ( fp , message ) = ( EofWrapper ( fp ) , self . __call__ ( ) ) #NEWLINE# while True : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( tag , wire_type ) = _unpack_key ( UVarint . load ( fp ) ) #NEWLINE# if ( tag in self . __tags_to_types ) : #NEWLINE# #INDENT# field_type = self . __tags_to_types [ tag ] #NEWLINE# if ( not self . __has_flag ( tag , Flags . PACKED_REPEATED , Flags . REPEATED_MASK ) ) : #NEWLINE# #INDENT# if ( wire_type != field_type . WIRE_TYPE ) : #NEWLINE# #INDENT# raise TypeError ( ( 'The received value with the tag %s has incorrect wiretype: %s instead of %s expected.' % ( wire_type , wire_type , field_type . WIRE_TYPE ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( wire_type != Bytes . WIRE_TYPE ) : #NEWLINE# #INDENT# raise TypeError ( ( 'Tag %s has wiretype %s while the field is packed repeated.' % ( tag , wire_type ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# if self . __has_flag ( tag , Flags . SINGLE , Flags . REPEATED_MASK ) : #NEWLINE# #INDENT# message [ self . __tags_to_names [ tag ] ] = field_type . load ( fp ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . __has_flag ( tag , Flags . PACKED_REPEATED , Flags . REPEATED_MASK ) : #NEWLINE# #INDENT# repeated_value = message [ self . __tags_to_names [ tag ] ] = list ( ) #NEWLINE# internal_fp = EofWrapper ( fp , UVarint . load ( fp ) ) #NEWLINE# while True : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# repeated_value . append ( field_type . load ( internal_fp ) ) #NEWLINE# #UNINDENT# except EOFError : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if self . __has_flag ( tag , Flags . REPEATED , Flags . REPEATED_MASK ) : #NEWLINE# #INDENT# if ( not ( self . __tags_to_names [ tag ] in message ) ) : #NEWLINE# #INDENT# repeated_value = message [ self . __tags_to_names [ tag ] ] = list ( ) #NEWLINE# #UNINDENT# repeated_value . append ( field_type . load ( fp ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# _wire_type_to_type_instance [ wire_type ] . load ( fp ) #NEWLINE# #UNINDENT# #UNINDENT# except EOFError : #NEWLINE# #INDENT# for ( tag , name ) in self . __tags_to_names . iteritems ( ) : #NEWLINE# #INDENT# if ( self . __has_flag ( tag , Flags . REQUIRED , Flags . REQUIRED_MASK ) and ( not ( name in message ) ) ) : #NEWLINE# #INDENT# if self . __has_flag ( tag , Flags . REPEATED , Flags . REPEATED_MASK ) : #NEWLINE# #INDENT# message [ name ] = list ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( "The field with the tag %s ('%s') is required but a value is missing." % ( tag , name ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return message