<s> from __future__ import print_function <EOL> from time import time <EOL> from tables import * <EOL> import tables <EOL> print ( "<STR_LIT>" , tables . __version__ ) <EOL> filename = "<STR_LIT>" <EOL> NLEAVES = <NUM_LIT> <EOL> NROWS = <NUM_LIT:1000> <EOL> class Particle ( IsDescription ) : <EOL> name = StringCol ( <NUM_LIT:16> , pos = <NUM_LIT:1> ) <EOL> lati = Int32Col ( pos = <NUM_LIT:2> ) <EOL> longi = Int32Col ( pos = <NUM_LIT:3> ) <EOL> pressure = Float32Col ( pos = <NUM_LIT:4> ) <EOL> temperature = Float64Col ( pos = <NUM_LIT:5> ) <EOL> def create_junk ( ) : <EOL> fileh = open_file ( filename , mode = "<STR_LIT:w>" ) <EOL> group = fileh . create_group ( fileh . root , "<STR_LIT>" ) <EOL> for i in range ( NLEAVES ) : <EOL> table = fileh . create_table ( group , '<STR_LIT>' + str ( i ) , Particle , <EOL> "<STR_LIT>" , Filters ( <NUM_LIT:1> ) ) <EOL> particle = table . row <EOL> print ( "<STR_LIT>" , table . _v_name ) <EOL> for i in range ( NROWS ) : <EOL> particle . append ( ) <EOL> table . flush ( ) <EOL> fileh . close ( ) <EOL> def modify_junk_LRU ( ) : <EOL> fileh = open_file ( filename , '<STR_LIT:a>' ) <EOL> group = fileh . root . newgroup <EOL> for j in range ( <NUM_LIT:5> ) : <EOL> print ( "<STR_LIT>" , j ) <EOL> for tt in fileh . walk_nodes ( group ) : <EOL> if isinstance ( tt , Table ) : <EOL> pass <EOL> fileh . close ( ) <EOL> def modify_junk_LRU2 ( ) : <EOL> fileh = open_file ( filename , '<STR_LIT:a>' ) <EOL> group = fileh . root . newgroup <EOL> for j in range ( <NUM_LIT:20> ) : <EOL> t1 = time ( ) <EOL> for i in range ( <NUM_LIT:100> ) : <EOL> tt = getattr ( group , "<STR_LIT>" + str ( i ) ) <EOL> print ( "<STR_LIT>" , j + <NUM_LIT:1> , round ( time ( ) - t1 , <NUM_LIT:3> ) ) <EOL> fileh . close ( ) <EOL> def modify_junk_LRU3 ( ) : <EOL> fileh = open_file ( filename , '<STR_LIT:a>' ) <EOL> group = fileh . root . newgroup <EOL> for j in range ( <NUM_LIT:3> ) : <EOL> t1 = time ( ) <EOL> for tt in fileh . walk_nodes ( group , "<STR_LIT>" ) : <EOL> tt . attrs . TITLE <EOL> for row in tt : <EOL> pass <EOL> print ( "<STR_LIT>" , j + <NUM_LIT:1> , round ( time ( ) - t1 , <NUM_LIT:3> ) ) <EOL> fileh . close ( ) <EOL> if <NUM_LIT:1> : <EOL> modify_junk_LRU3 ( ) <EOL> else : <EOL> import profile <EOL> import pstats <EOL> profile . run ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> stats = pstats . Stats ( '<STR_LIT>' ) <EOL> stats . strip_dirs ( ) <EOL> stats . sort_stats ( '<STR_LIT:time>' , '<STR_LIT>' ) <EOL> stats . print_stats ( ) </s>
