<s> from argparse import ArgumentParser <EOL> import random <EOL> import pprint <EOL> from couchbase . bucket import Bucket <EOL> ap = ArgumentParser ( ) <EOL> ap . add_argument ( '<STR_LIT>' , '<STR_LIT>' , default = False , <EOL> action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' ) <EOL> ap . add_argument ( '<STR_LIT>' , '<STR_LIT>' , default = <NUM_LIT:10> , <EOL> type = int , help = "<STR_LIT>" ) <EOL> options = ap . parse_args ( ) <EOL> c = Bucket ( '<STR_LIT>' ) <EOL> DESIGN = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : <EOL> """<STR_LIT>""" <EOL> } <EOL> } <EOL> } <EOL> if options . create_design : <EOL> bm = c . bucket_manager ( ) <EOL> bm . design_create ( '<STR_LIT>' , DESIGN , use_devmode = False , syncwait = <NUM_LIT:5> ) <EOL> NOUNS = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> ADJECTIVES = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> kv = { } <EOL> for x in range ( options . number_of_terms ) : <EOL> n = random . choice ( NOUNS ) <EOL> a = random . choice ( ADJECTIVES ) <EOL> kv [ "<STR_LIT:U+0020>" . join ( [ a , n ] ) ] = random . randint ( <NUM_LIT:1> , <NUM_LIT> ) <EOL> c . upsert_multi ( kv ) <EOL> vret = c . query ( '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> limit = <NUM_LIT:10> , <EOL> descending = True ) <EOL> for row in vret : <EOL> pprint . pprint ( row , indent = <NUM_LIT:4> ) </s>
