<s> """<STR_LIT>""" <EOL> from django . db . models . constants import LOOKUP_SEP <EOL> def refs_aggregate ( lookup_parts , aggregates ) : <EOL> """<STR_LIT>""" <EOL> for i in range ( len ( lookup_parts ) + <NUM_LIT:1> ) : <EOL> if LOOKUP_SEP . join ( lookup_parts [ <NUM_LIT:0> : i ] ) in aggregates : <EOL> return True <EOL> return False <EOL> class Aggregate ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , lookup , ** extra ) : <EOL> """<STR_LIT>""" <EOL> self . lookup = lookup <EOL> self . extra = extra <EOL> def _default_alias ( self ) : <EOL> return '<STR_LIT>' % ( self . lookup , self . name . lower ( ) ) <EOL> default_alias = property ( _default_alias ) <EOL> def add_to_query ( self , query , alias , col , source , is_summary ) : <EOL> """<STR_LIT>""" <EOL> klass = getattr ( query . aggregates_module , self . name ) <EOL> aggregate = klass ( col , source = source , is_summary = is_summary , ** self . extra ) <EOL> query . aggregates [ alias ] = aggregate <EOL> class Avg ( Aggregate ) : <EOL> name = '<STR_LIT>' <EOL> class Count ( Aggregate ) : <EOL> name = '<STR_LIT>' <EOL> class Max ( Aggregate ) : <EOL> name = '<STR_LIT>' <EOL> class Min ( Aggregate ) : <EOL> name = '<STR_LIT>' <EOL> class StdDev ( Aggregate ) : <EOL> name = '<STR_LIT>' <EOL> class Sum ( Aggregate ) : <EOL> name = '<STR_LIT>' <EOL> class Variance ( Aggregate ) : <EOL> name = '<STR_LIT>' </s>
