<s> import time <EOL> def result2dict ( columns , task ) : <EOL> r = { } <EOL> for key in task . keys ( ) : <EOL> r [ key ] = task [ key ] <EOL> return r <EOL> class SplitTableMixin ( object ) : <EOL> UPDATE_PROJECTS_TIME = <NUM_LIT:10> * <NUM_LIT> <EOL> def _tablename ( self , project ) : <EOL> if self . __tablename__ : <EOL> return '<STR_LIT>' % ( self . __tablename__ , project ) <EOL> else : <EOL> return project <EOL> @ property <EOL> def projects ( self ) : <EOL> if time . time ( ) - getattr ( self , '<STR_LIT>' , <NUM_LIT:0> ) > self . UPDATE_PROJECTS_TIME : <EOL> self . _list_project ( ) <EOL> return self . _projects <EOL> @ projects . setter <EOL> def projects ( self , value ) : <EOL> self . _projects = value <EOL> def _list_project ( self ) : <EOL> self . _last_update_projects = time . time ( ) <EOL> self . projects = set ( ) <EOL> if self . __tablename__ : <EOL> prefix = '<STR_LIT>' % self . __tablename__ <EOL> else : <EOL> prefix = '<STR_LIT>' <EOL> for project in self . engine . table_names ( ) : <EOL> if project . startswith ( prefix ) : <EOL> project = project [ len ( prefix ) : ] <EOL> self . projects . add ( project ) <EOL> def drop ( self , project ) : <EOL> if project not in self . projects : <EOL> self . _list_project ( ) <EOL> if project not in self . projects : <EOL> return <EOL> self . table . name = self . _tablename ( project ) <EOL> self . table . drop ( self . engine ) <EOL> self . _list_project ( ) </s>
