<s> from v1meta import V1Meta <EOL> import sqlite3 <EOL> from collections import defaultdict <EOL> class V1Poll ( object ) : <EOL> def __init__ ( self , meta = None , filename = '<STR_LIT>' ) : <EOL> if not meta : <EOL> meta = V1Meta ( ) <EOL> self . datafile_name = filename <EOL> self . db = sqlite3 . connect ( self . datafile_name ) <EOL> self . registrations = defaultdict ( list ) <EOL> def __enter__ ( self ) : <EOL> return self <EOL> def __exit__ ( self ) : <EOL> self . poll ( ) <EOL> def run_on_new ( self , asset_type_name , handler_function ) : <EOL> self . registrations [ asset_type_name ] . append ( handler_function ) <EOL> raise NotImplementedError <EOL> def poll ( self ) : <EOL> raise NotImplementedError <EOL> for asset_type , callback in self . registrations . items ( ) : <EOL> callback_id = callback . __module__ + '<STR_LIT:.>' + callback . __name__ <EOL> rows = self . db . query ( """<STR_LIT>""" ) <EOL> previously_called_handlers = None <EOL> newly_registered_handlers = None <EOL> previously_polled_asset_types = None <EOL> newly_registered_asset_types = None <EOL> for asset_type in previously_polled_asset_types : <EOL> pass <EOL> for row in rows : <EOL> registered_funcs = self . registrations [ row [ '<STR_LIT>' ] ] </s>
