def calculators_for_aggregates(cube, aggregates, drilldown_levels=None, split=None):
 functions = []
 for aggregate in aggregates:
  try:
   factory = CALCULATED_AGGREGATIONS[aggregate.function]
  except KeyError:
   raise ArgumentError(("Unknown post-calculation function '%s' for aggregate '%s'" % (aggregate.function, aggregate.name)))
  if aggregate.measure:
   source = cube.measure_aggregate(aggregate.measure)
  else:
   raise InternalError(("No measure specified for aggregate '%s' in cube '%s'" % (aggregate.name, cube.name)))
  func = factory(aggregate, source.ref, drilldown_levels, split)
  functions.append(func)
 return functions

def calculators_for_aggregates ( cube , aggregates , drilldown_levels = None , split = None ) : functions = [ ] for aggregate in aggregates : try : factory = CALCULATED_AGGREGATIONS [ aggregate . function ] except KeyError : raise ArgumentError ( ( "Unknown post-calculation function '%s' for aggregate '%s'" % ( aggregate . function , aggregate . name ) ) ) if aggregate . measure : source = cube . measure_aggregate ( aggregate . measure ) else : raise InternalError ( ( "No measure specified for aggregate '%s' in cube '%s'" % ( aggregate . name , cube . name ) ) ) func = factory ( aggregate , source . ref , drilldown_levels , split ) functions . append ( func ) return functions
returns a list of calculator function objects that implements aggregations by calculating on retrieved results .