#NEWLINE# def type_check( self , tuple_instance ) : #NEWLINE# #INDENT# if ( not isinstance ( tuple_instance , tuple ) ) : #NEWLINE# #INDENT# raise CompositeTypeHintError ( ( "Tuple type constraint violated. Valid object instance must be of type 'tuple'. Instead, an instance of '%s' was received." % tuple_instance . __class__ . __name__ ) ) #NEWLINE# #UNINDENT# if ( len ( tuple_instance ) != len ( self . tuple_types ) ) : #NEWLINE# #INDENT# raise CompositeTypeHintError ( ( 'Passed object instance is of the proper type, but differs in length from the hinted type. Expected a tuple of length %s, received a tuple of length %s.' % ( len ( self . tuple_types ) , len ( tuple_instance ) ) ) ) #NEWLINE# #UNINDENT# for ( type_pos , ( expected , actual ) ) in enumerate ( zip ( self . tuple_types , tuple_instance ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# check_constraint ( expected , actual ) #NEWLINE# continue #NEWLINE# #UNINDENT# except SimpleTypeHintError : #NEWLINE# #INDENT# raise CompositeTypeHintError ( ( '%s hint type-constraint violated. The type of element #%s in the passed tuple is incorrect. Expected an instance of type %s, instead received an instance of type %s.' % ( repr ( self ) , type_pos , _unified_repr ( expected ) , actual . __class__ . __name__ ) ) ) #NEWLINE# #UNINDENT# except CompositeTypeHintError as e : #NEWLINE# #INDENT# raise CompositeTypeHintError ( ( '%s hint type-constraint violated. The type of element #%s in the passed tuple is incorrect. %s' % ( repr ( self ) , type_pos , e ) ) )