<s> """<STR_LIT>""" <EOL> class SpatialOperation ( object ) : <EOL> """<STR_LIT>""" <EOL> sql_template = '<STR_LIT>' <EOL> def __init__ ( self , function = '<STR_LIT>' , operator = '<STR_LIT>' , result = '<STR_LIT>' , ** kwargs ) : <EOL> self . function = function <EOL> self . operator = operator <EOL> self . result = result <EOL> self . extra = kwargs <EOL> def as_sql ( self , geo_col , geometry = '<STR_LIT:%s>' ) : <EOL> return self . sql_template % self . params ( geo_col , geometry ) <EOL> def params ( self , geo_col , geometry ) : <EOL> params = { '<STR_LIT>' : self . function , <EOL> '<STR_LIT>' : geo_col , <EOL> '<STR_LIT>' : geometry , <EOL> '<STR_LIT>' : self . operator , <EOL> '<STR_LIT:result>' : self . result , <EOL> } <EOL> params . update ( self . extra ) <EOL> return params <EOL> class SpatialFunction ( SpatialOperation ) : <EOL> """<STR_LIT>""" <EOL> sql_template = '<STR_LIT>' <EOL> def __init__ ( self , func , result = '<STR_LIT>' , operator = '<STR_LIT>' , ** kwargs ) : <EOL> default = { '<STR_LIT>' : func , <EOL> '<STR_LIT>' : operator , <EOL> '<STR_LIT:result>' : result <EOL> } <EOL> kwargs . update ( default ) <EOL> super ( SpatialFunction , self ) . __init__ ( ** kwargs ) </s>
