<s> from __future__ import print_function <EOL> import aerospike <EOL> import sys <EOL> from optparse import OptionParser <EOL> usage = "<STR_LIT>" <EOL> optparser = OptionParser ( usage = usage , add_help_option = False ) <EOL> optparser . add_option ( <EOL> "<STR_LIT>" , dest = "<STR_LIT>" , action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> optparser . add_option ( <EOL> "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT:host>" , type = "<STR_LIT:string>" , default = "<STR_LIT:127.0.0.1>" , metavar = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> optparser . add_option ( <EOL> "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT:port>" , type = "<STR_LIT:int>" , default = <NUM_LIT> , metavar = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> optparser . add_option ( <EOL> "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:string>" , default = "<STR_LIT:test>" , metavar = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> optparser . add_option ( <EOL> "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:string>" , default = "<STR_LIT>" , metavar = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> optparser . add_option ( <EOL> "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:int>" , default = <NUM_LIT:10> , metavar = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> optparser . add_option ( <EOL> "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:int>" , default = <NUM_LIT:1000> , metavar = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> ( options , args ) = optparser . parse_args ( ) <EOL> if options . help : <EOL> optparser . print_help ( ) <EOL> print ( ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> if len ( args ) != <NUM_LIT:1> : <EOL> optparser . print_help ( ) <EOL> print ( ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> config = { <EOL> '<STR_LIT>' : [ ( options . host , options . port ) ] <EOL> } <EOL> client = aerospike . client ( config ) . connect ( ) <EOL> rc = <NUM_LIT:0> <EOL> key = args . pop ( ) <EOL> record = { <EOL> '<STR_LIT:i>' : <NUM_LIT> , <EOL> '<STR_LIT:s>' : '<STR_LIT:abc>' , <EOL> '<STR_LIT:l>' : [ <NUM_LIT> , '<STR_LIT:abc>' , [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' ] , { '<STR_LIT:x>' : <NUM_LIT:1> , '<STR_LIT:y>' : <NUM_LIT:2> , '<STR_LIT:z>' : <NUM_LIT:3> } ] , <EOL> '<STR_LIT:m>' : { '<STR_LIT:i>' : <NUM_LIT> , '<STR_LIT:s>' : '<STR_LIT:abc>' , '<STR_LIT:l>' : [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' ] , '<STR_LIT:d>' : { '<STR_LIT:x>' : <NUM_LIT:1> , '<STR_LIT:y>' : <NUM_LIT:2> , '<STR_LIT:z>' : <NUM_LIT:3> } } <EOL> } <EOL> try : <EOL> meta = { '<STR_LIT>' : options . ttl , '<STR_LIT>' : options . gen } <EOL> policy = None <EOL> client . key ( options . namespace , options . set , key ) . put ( record , meta ) <EOL> print ( record ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" . format ( e ) , file = sys . stderr ) <EOL> rc = <NUM_LIT:1> <EOL> client . close ( ) <EOL> sys . exit ( rc ) </s>
