<s> class Collection : <EOL> def __init__ ( self , ModelType , models , datamap = None ) : <EOL> self . _models = models <EOL> self . _ModelType = ModelType <EOL> self . _datamap = datamap <EOL> self . i = <NUM_LIT:0> <EOL> def __iter__ ( self ) : <EOL> return self . loop ( ) <EOL> def loop ( self ) : <EOL> for model in self . _models : <EOL> self . i += <NUM_LIT:1> <EOL> yield self . build_model ( model ) <EOL> def next ( self ) : <EOL> return self . build_model ( self . _models . fetchone ( ) ) <EOL> def build_model ( self , data ) : <EOL> if self . _datamap != None : <EOL> data = self . _datamap ( data ) <EOL> return self . _ModelType ( ** data ) ; <EOL> class Mapper : <EOL> def __init__ ( self , repository ) : <EOL> self . _repository = repository <EOL> class Repository : <EOL> def __init__ ( self , database ) : <EOL> self . _database = database <EOL> class SqliteRepository ( Repository ) : <EOL> pass <EOL> class MysqlRepository ( Repository ) : <EOL> pass </s>
