<s> '''<STR_LIT>''' <EOL> import tables as pt <EOL> fileName = "<STR_LIT>" <EOL> h5f = [ ] <EOL> group = [ ] <EOL> table = [ ] <EOL> opened = False <EOL> ctr = float ( <NUM_LIT:0.0> ) <EOL> class AlphaDataModelClass ( pt . IsDescription ) : <EOL> symbol = pt . StringCol ( <NUM_LIT:30> ) <EOL> exchange = pt . StringCol ( <NUM_LIT:10> ) <EOL> alphaValue = pt . Float32Col ( ) <EOL> timestamp = pt . Time64Col ( ) <EOL> def __init__ ( self ) : <EOL> print "<STR_LIT>" <EOL> def openFile ( newFileName ) : <EOL> '''<STR_LIT>''' <EOL> global fileName , h5f , group , table , opened , ctr <EOL> ctr = float ( <NUM_LIT:0.0> ) <EOL> if newFileName is None : <EOL> print "<STR_LIT>" <EOL> else : <EOL> if ( len ( newFileName ) > <NUM_LIT:0> ) : <EOL> fileName = str ( newFileName ) <EOL> else : <EOL> print "<STR_LIT>" <EOL> if not opened : <EOL> h5f = pt . openFile ( str ( fileName ) , mode = "<STR_LIT:w>" ) <EOL> group = h5f . createGroup ( "<STR_LIT:/>" , '<STR_LIT>' ) <EOL> table = h5f . createTable ( group , '<STR_LIT>' , AlphaDataModelClass ) <EOL> opened = True <EOL> else : <EOL> print "<STR_LIT>" <EOL> def addRow ( currSymbol , currExchange , currAlphaVal , currTS ) : <EOL> '''<STR_LIT>''' <EOL> global ctr <EOL> if opened : <EOL> ctr = ctr + <NUM_LIT:1> <EOL> row = table . row <EOL> row [ '<STR_LIT>' ] = currSymbol <EOL> row [ '<STR_LIT>' ] = currExchange <EOL> row [ '<STR_LIT>' ] = currAlphaVal <EOL> row [ '<STR_LIT>' ] = currTS <EOL> row . append ( ) <EOL> if ( ctr == <NUM_LIT> ) : <EOL> ctr = <NUM_LIT:0> <EOL> table . flush ( ) <EOL> else : <EOL> print "<STR_LIT>" <EOL> raise IOError <EOL> def closeFile ( ) : <EOL> '''<STR_LIT>''' <EOL> table . flush ( ) <EOL> h5f . close ( ) <EOL> print str ( fileName ) + "<STR_LIT>" <EOL> opened = False </s>
