def generate_dataset_shelve(filename, number_items=<NUM_LIT:1000>):
if os.path.exists(filename):<EOL><INDENT>os.remove(filename)<EOL><DEDENT>data = shelve.open(filename)<EOL>names = get_names()<EOL>totalnames = len(names)<EOL>random.seed()<EOL><INDENT>names = random.sample(names, number_items)<EOL><DEDENT>for i in range(number_items):<EOL><INDENT>data[str(i+<NUM_LIT:1>)] = {"<STR_LIT:name>":names[random.randint(<NUM_LIT:0>,totalnames-<NUM_LIT:1>)],<EOL>"<STR_LIT>":random.randint(<NUM_LIT:1>,<NUM_LIT:100>),<EOL>"<STR_LIT:description>":li_words(<NUM_LIT:50>, False)}<EOL><DEDENT>data.close()<EOL>
Generate a dataset with number_items elements.