#NEWLINE# @ copydoc ( Projection ) #NEWLINE# def projection( expr , names ) : #NEWLINE# #INDENT# if ( not names ) : #NEWLINE# #INDENT# raise ValueError ( 'Projection with no names' ) #NEWLINE# #UNINDENT# if ( not isinstance ( names , ( tuple , list ) ) ) : #NEWLINE# #INDENT# raise TypeError ( ( 'Wanted list of strings, got %s' % names ) ) #NEWLINE# #UNINDENT# if ( not set ( names ) . issubset ( expr . fields ) ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Mismatched names. Asking for names %s where expression has names %s' % ( names , expr . fields ) ) ) #NEWLINE# #UNINDENT# return Projection ( expr , tuple ( names ) )