<s> from __future__ import print_function <EOL> import random <EOL> import tables <EOL> fileout = "<STR_LIT>" <EOL> colors = tables . Enum ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def read ( file ) : <EOL> fileh = tables . open_file ( file , "<STR_LIT:r>" ) <EOL> print ( "<STR_LIT>" , fileh . root . table ) <EOL> print ( "<STR_LIT>" , repr ( fileh . root . table ) ) <EOL> print ( "<STR_LIT>" , repr ( fileh . root . table [ : ] ) ) <EOL> fileh . close ( ) <EOL> def write ( file , desc , indexed ) : <EOL> fileh = tables . open_file ( file , "<STR_LIT:w>" ) <EOL> table = fileh . create_table ( fileh . root , '<STR_LIT>' , desc ) <EOL> for colname in indexed : <EOL> table . colinstances [ colname ] . create_index ( ) <EOL> row = table . row <EOL> for i in range ( <NUM_LIT:10> ) : <EOL> row [ '<STR_LIT:x>' ] = i <EOL> row [ '<STR_LIT:y>' ] = <NUM_LIT> - i <EOL> row [ '<STR_LIT:z>' ] = i <EOL> row [ '<STR_LIT>' ] = colors [ random . choice ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) ] <EOL> row [ '<STR_LIT>' ] = "<STR_LIT>" % i <EOL> row [ '<STR_LIT>' ] = i <EOL> row . append ( ) <EOL> fileh . close ( ) <EOL> class Info ( tables . IsDescription ) : <EOL> _v_pos = <NUM_LIT:2> <EOL> Name = tables . UInt32Col ( ) <EOL> Value = tables . Float64Col ( ) <EOL> class Test ( tables . IsDescription ) : <EOL> """<STR_LIT>""" <EOL> x = tables . Int32Col ( shape = <NUM_LIT:2> , dflt = <NUM_LIT:0> , pos = <NUM_LIT:0> ) <EOL> y = tables . Float64Col ( dflt = <NUM_LIT> , shape = ( <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> z = tables . UInt8Col ( dflt = <NUM_LIT:1> ) <EOL> color = tables . EnumCol ( colors , '<STR_LIT>' , base = '<STR_LIT>' , shape = ( <NUM_LIT:2> , ) ) <EOL> Info = Info ( ) <EOL> class info ( tables . IsDescription ) : <EOL> _v_pos = <NUM_LIT:1> <EOL> name = tables . StringCol ( <NUM_LIT:10> ) <EOL> value = tables . Float64Col ( pos = <NUM_LIT:0> ) <EOL> y2 = tables . Float64Col ( dflt = <NUM_LIT:1> , shape = ( <NUM_LIT:2> , <NUM_LIT:3> ) , pos = <NUM_LIT:1> ) <EOL> z2 = tables . UInt8Col ( dflt = <NUM_LIT:1> ) <EOL> class info2 ( tables . IsDescription ) : <EOL> y3 = tables . Float64Col ( dflt = <NUM_LIT:1> , shape = ( <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> z3 = tables . UInt8Col ( dflt = <NUM_LIT:1> ) <EOL> name = tables . StringCol ( <NUM_LIT:10> ) <EOL> value = tables . EnumCol ( colors , '<STR_LIT>' , base = '<STR_LIT>' , shape = ( <NUM_LIT:1> , ) ) <EOL> class info3 ( tables . IsDescription ) : <EOL> name = tables . StringCol ( <NUM_LIT:10> ) <EOL> value = tables . Time64Col ( ) <EOL> y4 = tables . Float64Col ( dflt = <NUM_LIT:1> , shape = ( <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> z4 = tables . UInt8Col ( dflt = <NUM_LIT:1> ) <EOL> write ( fileout , Test , [ '<STR_LIT>' ] ) <EOL> read ( fileout ) <EOL> print ( "<STR_LIT>" % fileout ) </s>
