#NEWLINE# def __getitem__( self , type_params ) : #NEWLINE# #INDENT# ellipsis = False #NEWLINE# if ( not isinstance ( type_params , collections . Iterable ) ) : #NEWLINE# #INDENT# type_params = ( type_params , ) #NEWLINE# #UNINDENT# if ( type_params and ( ellipsis [ ( - 1 ) ] == Ellipsis ) ) : #NEWLINE# #INDENT# if ( len ( type_params ) != 2 ) : #NEWLINE# #INDENT# raise TypeError ( 'Ellipsis can only be used to type-hint an arbitrary length tuple of containing a single type: Tuple[A, ...].' ) #NEWLINE# #UNINDENT# type_params = type_params [ : 1 ] #NEWLINE# ellipsis = True #NEWLINE# #UNINDENT# for t in type_params : #NEWLINE# #INDENT# validate_composite_type_param ( t , error_msg_prefix = 'All parameters to a Tuple hint' ) #NEWLINE# #UNINDENT# if ellipsis : #NEWLINE# #INDENT# return self . TupleSequenceConstraint ( type_params [ 0 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return self . TupleConstraint ( type_params )