<s> from retriever . lib . templates import Script <EOL> from retriever . lib . models import Table , Cleanup , correct_invalid_value <EOL> class main ( Script ) : <EOL> def __init__ ( self ) : <EOL> Script . __init__ ( self , <EOL> name = "<STR_LIT>" , <EOL> citation = "<STR_LIT>" , <EOL> shortname = "<STR_LIT>" , <EOL> ref = "<STR_LIT>" , <EOL> description = "<STR_LIT>" , <EOL> urls = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> } , <EOL> tables = { <EOL> "<STR_LIT>" : Table ( "<STR_LIT>" , <EOL> cleanup = Cleanup ( correct_invalid_value , <EOL> nulls = [ - <NUM_LIT> ] ) ) , <EOL> } <EOL> ) <EOL> def download ( self , engine = None , debug = False ) : <EOL> Script . download ( self , engine , debug ) <EOL> self . engine . download_file ( self . urls [ "<STR_LIT>" ] , "<STR_LIT>" ) <EOL> data_path = self . engine . format_filename ( "<STR_LIT>" ) <EOL> old_data = open ( self . engine . find_file ( "<STR_LIT>" ) , '<STR_LIT:rb>' ) <EOL> new_data = open ( data_path , '<STR_LIT:wb>' ) <EOL> line1 = old_data . readline ( ) <EOL> line2 = old_data . readline ( ) <EOL> newline = line1 . replace ( "<STR_LIT:\n>" , "<STR_LIT:\t>" ) + line2 <EOL> new_data . write ( newline ) <EOL> for line in old_data : <EOL> new_data . write ( line ) <EOL> new_data . close ( ) <EOL> old_data . close ( ) <EOL> self . engine . auto_create_table ( self . tables [ "<STR_LIT>" ] , <EOL> filename = "<STR_LIT>" ) <EOL> self . engine . insert_data_from_file ( data_path ) <EOL> SCRIPT = main ( ) </s>
