<s> """<STR_LIT>""" <EOL> class EmptyResultSet ( Exception ) : <EOL> pass <EOL> class FullResultSet ( Exception ) : <EOL> pass <EOL> class MultiJoin ( Exception ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , level ) : <EOL> self . level = level <EOL> class Empty ( object ) : <EOL> pass <EOL> class RawValue ( object ) : <EOL> def __init__ ( self , value ) : <EOL> self . value = value <EOL> class Aggregate ( object ) : <EOL> """<STR_LIT>""" <EOL> def relabel_aliases ( self , change_map ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError <EOL> def as_sql ( self , quote_func = None ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError <EOL> class Count ( Aggregate ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , col = '<STR_LIT:*>' , distinct = False ) : <EOL> """<STR_LIT>""" <EOL> self . col = col <EOL> self . distinct = distinct <EOL> def relabel_aliases ( self , change_map ) : <EOL> c = self . col <EOL> if isinstance ( c , ( list , tuple ) ) : <EOL> self . col = ( change_map . get ( c [ <NUM_LIT:0> ] , c [ <NUM_LIT:0> ] ) , c [ <NUM_LIT:1> ] ) <EOL> def as_sql ( self , quote_func = None ) : <EOL> if not quote_func : <EOL> quote_func = lambda x : x <EOL> if isinstance ( self . col , ( list , tuple ) ) : <EOL> col = ( '<STR_LIT>' % tuple ( [ quote_func ( c ) for c in self . col ] ) ) <EOL> elif hasattr ( self . col , '<STR_LIT>' ) : <EOL> col = self . col . as_sql ( quote_func ) <EOL> else : <EOL> col = self . col <EOL> if self . distinct : <EOL> return '<STR_LIT>' % col <EOL> else : <EOL> return '<STR_LIT>' % col <EOL> class Date ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , col , lookup_type , date_sql_func ) : <EOL> self . col = col <EOL> self . lookup_type = lookup_type <EOL> self . date_sql_func = date_sql_func <EOL> def relabel_aliases ( self , change_map ) : <EOL> c = self . col <EOL> if isinstance ( c , ( list , tuple ) ) : <EOL> self . col = ( change_map . get ( c [ <NUM_LIT:0> ] , c [ <NUM_LIT:0> ] ) , c [ <NUM_LIT:1> ] ) <EOL> def as_sql ( self , quote_func = None ) : <EOL> if not quote_func : <EOL> quote_func = lambda x : x <EOL> if isinstance ( self . col , ( list , tuple ) ) : <EOL> col = '<STR_LIT>' % tuple ( [ quote_func ( c ) for c in self . col ] ) <EOL> else : <EOL> col = self . col <EOL> return self . date_sql_func ( self . lookup_type , col ) </s>
