def _expected_cols(expected_attrs):
 if (not expected_attrs):
  return expected_attrs
 simple_cols = [attr for attr in expected_attrs if (attr in _INSTANCE_OPTIONAL_JOINED_FIELDS)]
 complex_cols = [('extra.%s' % field) for field in _INSTANCE_EXTRA_FIELDS if (field in expected_attrs)]
 if complex_cols:
  simple_cols.append('extra')
 simple_cols = [x for x in simple_cols if (x not in _INSTANCE_EXTRA_FIELDS)]
 expected_cols = (simple_cols + complex_cols)
 return sorted(list(set(expected_cols)), key=expected_cols.index)

def _expected_cols ( expected_attrs ) : if ( not expected_attrs ) : return expected_attrs simple_cols = [ attr for attr in expected_attrs if ( attr in _INSTANCE_OPTIONAL_JOINED_FIELDS ) ] complex_cols = [ ( 'extra.%s' % field ) for field in _INSTANCE_EXTRA_FIELDS if ( field in expected_attrs ) ] if complex_cols : simple_cols . append ( 'extra' ) simple_cols = [ x for x in simple_cols if ( x not in _INSTANCE_EXTRA_FIELDS ) ] expected_cols = ( simple_cols + complex_cols ) return sorted ( list ( set ( expected_cols ) ) , key = expected_cols . index )
return expected_attrs that are columns needing joining .