<s> """<STR_LIT>""" <EOL> import bsddb3 . db <EOL> def open ( filename , mode ) : <EOL> db = bsddb3 . db . DB ( None ) <EOL> if mode == '<STR_LIT:r>' : <EOL> flags = bsddb3 . db . DB_RDONLY <EOL> elif mode == '<STR_LIT>' : <EOL> flags = <NUM_LIT:0> <EOL> elif mode == '<STR_LIT:w>' : <EOL> flags = bsddb3 . db . DB_CREATE <EOL> elif mode == '<STR_LIT:c>' : <EOL> flags = bsddb3 . db . DB_CREATE <EOL> elif mode == '<STR_LIT:n>' : <EOL> flags = bsddb3 . db . DB_TRUNCATE | bsddb3 . db . DB_CREATE <EOL> else : <EOL> raise bsddb3 . db . DBError ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> db . open ( filename , None , bsddb3 . db . DB_HASH , flags ) <EOL> return db </s>
