<s> """<STR_LIT>""" <EOL> from __future__ import print_function <EOL> import numpy <EOL> import tables <EOL> class Info ( tables . IsDescription ) : <EOL> """<STR_LIT>""" <EOL> _v_pos = <NUM_LIT:2> <EOL> name = tables . StringCol ( <NUM_LIT:10> ) <EOL> value = tables . Float64Col ( pos = <NUM_LIT:0> ) <EOL> colors = tables . Enum ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> class NestedDescr ( tables . IsDescription ) : <EOL> """<STR_LIT>""" <EOL> color = tables . EnumCol ( colors , '<STR_LIT>' , base = '<STR_LIT>' ) <EOL> info1 = Info ( ) <EOL> class info2 ( tables . IsDescription ) : <EOL> _v_pos = <NUM_LIT:1> <EOL> name = tables . StringCol ( <NUM_LIT:10> ) <EOL> value = tables . Float64Col ( pos = <NUM_LIT:0> ) <EOL> class info3 ( tables . IsDescription ) : <EOL> x = tables . Float64Col ( dflt = <NUM_LIT:1> ) <EOL> y = tables . UInt8Col ( dflt = <NUM_LIT:1> ) <EOL> print ( ) <EOL> print ( '<STR_LIT>' ) <EOL> filename = "<STR_LIT>" <EOL> print ( "<STR_LIT>" , filename ) <EOL> fileh = tables . open_file ( filename , "<STR_LIT:w>" ) <EOL> print ( ) <EOL> print ( '<STR_LIT>' ) <EOL> table = fileh . create_table ( fileh . root , '<STR_LIT>' , NestedDescr ) <EOL> row = table . row <EOL> for i in range ( <NUM_LIT:10> ) : <EOL> row [ '<STR_LIT>' ] = colors [ [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] [ i % <NUM_LIT:3> ] ] <EOL> row [ '<STR_LIT>' ] = "<STR_LIT>" % i <EOL> row [ '<STR_LIT>' ] = "<STR_LIT>" % i <EOL> row [ '<STR_LIT>' ] = i <EOL> row . append ( ) <EOL> table . flush ( ) <EOL> print ( repr ( table . nrows ) ) <EOL> nra = table [ : : <NUM_LIT:4> ] <EOL> print ( repr ( nra ) ) <EOL> table . append ( nra ) <EOL> print ( repr ( table . nrows ) ) <EOL> table2 = fileh . create_table ( fileh . root , '<STR_LIT>' , nra ) <EOL> print ( repr ( table2 [ : ] ) ) <EOL> names = [ x [ '<STR_LIT>' ] for x in table if x [ '<STR_LIT>' ] == colors . red ] <EOL> print ( ) <EOL> print ( "<STR_LIT>" , repr ( names ) ) <EOL> print ( ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" , table [ : ] ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" , repr ( table . cols . info2 [ <NUM_LIT:1> : <NUM_LIT:5> ] ) ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" , <EOL> repr ( table . cols . info2 . info3 [ <NUM_LIT:1> : <NUM_LIT:5> ] ) ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( repr ( table . cols . _f_col ( '<STR_LIT>' ) ) ) <EOL> print ( repr ( table . cols . _f_col ( '<STR_LIT>' ) ) ) <EOL> print ( ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" , repr ( table . description ) ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( repr ( table . description . info1 ) ) <EOL> print ( repr ( table . description . info2 . info3 ) ) <EOL> print ( repr ( table . description . _v_nested_names ) ) <EOL> print ( repr ( table . description . info1 . _v_nested_names ) ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( repr ( table . description . _v_nested_descr ) ) <EOL> print ( repr ( numpy . rec . array ( None , shape = <NUM_LIT:0> , <EOL> dtype = table . description . _v_nested_descr ) ) ) <EOL> print ( repr ( numpy . rec . array ( None , shape = <NUM_LIT:0> , <EOL> dtype = table . description . info2 . _v_nested_descr ) ) ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" ) <EOL> for coldescr in table . description . _f_walk ( ) : <EOL> print ( "<STR_LIT>" , coldescr ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" , table . description . info2 ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" , repr ( table ) ) <EOL> fileh . close ( ) </s>
