From 91e3918ef50273669e256e4c5a8274adbc2a85ee Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Tue, 26 Jul 2011 09:33:40 -0700 Subject: [PATCH] Use itertools.islice instead of special-casing generator slicing. --- s3tests/rand_readwrite.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/s3tests/rand_readwrite.py b/s3tests/rand_readwrite.py index e8a93e0..16d7a91 100644 --- a/s3tests/rand_readwrite.py +++ b/s3tests/rand_readwrite.py @@ -4,6 +4,7 @@ import gevent import gevent.pool import gevent.queue import gevent.monkey; gevent.monkey.patch_all() +import itertools import optparse import sys import time @@ -147,12 +148,13 @@ def main(): # setup bucket and other objects bucket = common.get_new_bucket() print "Created bucket: {name}".format(name=bucket.name) - file_names = list(realistic.names( + file_names = realistic.names( mean=15, stddev=4, 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( mean=1024 * config.files.size, stddev=1024 * config.files.stddev,