Use itertools.islice instead of special-casing generator slicing.

This commit is contained in:
Tommi Virtanen 2011-07-26 09:33:40 -07:00
parent fdaead938e
commit 91e3918ef5

View file

@ -4,6 +4,7 @@ import gevent
import gevent.pool import gevent.pool
import gevent.queue import gevent.queue
import gevent.monkey; gevent.monkey.patch_all() import gevent.monkey; gevent.monkey.patch_all()
import itertools
import optparse import optparse
import sys import sys
import time import time
@ -147,12 +148,13 @@ def main():
# setup bucket and other objects # setup bucket and other objects
bucket = common.get_new_bucket() bucket = common.get_new_bucket()
print "Created bucket: {name}".format(name=bucket.name) print "Created bucket: {name}".format(name=bucket.name)
file_names = list(realistic.names( file_names = realistic.names(
mean=15, mean=15,
stddev=4, stddev=4,
seed=options.seed, seed=options.seed,
max_amount=config.files.num )
)) file_names = itertools.islice(file_names, config.files.num)
file_names = list(file_names)
files = realistic.files( files = realistic.files(
mean=1024 * config.files.size, mean=1024 * config.files.size,
stddev=1024 * config.files.stddev, stddev=1024 * config.files.stddev,