#NEWLINE# def _fit( self , X ) : #NEWLINE# #INDENT# X = iter ( X ) #NEWLINE# try : #NEWLINE# #INDENT# first = next ( X ) #NEWLINE# #UNINDENT# except ( TypeError , StopIteration ) : #NEWLINE# #INDENT# raise ValueError ( 'Cannot fit with an empty dataset' ) #NEWLINE# #UNINDENT# logger . debug ( 'Starting flattener.fit' ) #NEWLINE# self . _fit_first ( first ) #NEWLINE# if ( self . str_tuple_indexes or self . bag_indexes ) : #NEWLINE# #INDENT# for datapoint in self . _iter_valid ( X , first = first ) : #NEWLINE# #INDENT# self . _fit_step ( datapoint ) #NEWLINE# #UNINDENT# #UNINDENT# logger . debug ( 'Finished flattener.fit' ) #NEWLINE# logger . debug ( ( 'Input tuple size %s, output vector size %s' % ( len ( first ) , len ( self . indexes ) ) ) ) #NEWLINE# return datapoint