From fe749adebf8fb3b0898f3ccde07d8ea7a679f3ad Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Tue, 19 Jul 2011 09:09:51 -0700 Subject: [PATCH] pep8 cleanup. --- s3tests/common/__init__.py | 9 ++++----- s3tests/common/greenlets.py | 6 +++--- s3tests/common/results.py | 3 +-- s3tests/rand_readwrite.py | 14 +++++++------- s3tests/realistic.py | 6 +++--- s3tests/roundtrip.py | 6 +++--- 6 files changed, 21 insertions(+), 23 deletions(-) diff --git a/s3tests/common/__init__.py b/s3tests/common/__init__.py index 8eb4232..0efda84 100644 --- a/s3tests/common/__init__.py +++ b/s3tests/common/__init__.py @@ -13,11 +13,11 @@ prefix = '' # For those scripts that use a context, these are pretty univerally needed. context = bunch.Bunch( - bucket = None, + bucket=None, # Save stdout/stderr in case they get fudged with. - real_stdout = sys.stdout, - real_stderr = sys.stderr, + real_stdout=sys.stdout, + real_stderr=sys.stderr, ) bucket_counter = itertools.count(1) @@ -56,7 +56,7 @@ def nuke_prefixed_buckets(): try: bucket.set_canned_acl('private') # TODO: deleted_cnt and the while loop is a work around for rgw - # not sending the + # not sending the deleted_cnt = 1 while deleted_cnt: deleted_cnt = 0 @@ -181,4 +181,3 @@ def fill_pools(*args): def get_next_key(bucket=None): return bucket.new_key("seqkey-{num}".format(num=next(key_counter))) - diff --git a/s3tests/common/greenlets.py b/s3tests/common/greenlets.py index c3eb215..49332be 100644 --- a/s3tests/common/greenlets.py +++ b/s3tests/common/greenlets.py @@ -11,9 +11,9 @@ from ..realistic import FileVerifier # Make sure context has somewhere to store what we need context.update(bunch.Bunch( - needs_first_read = collections.deque(), - all_keys = [], - files_iter = None, + needs_first_read=collections.deque(), + all_keys=[], + files_iter=None, )) diff --git a/s3tests/common/results.py b/s3tests/common/results.py index 5c2830d..aa5159a 100644 --- a/s3tests/common/results.py +++ b/s3tests/common/results.py @@ -8,7 +8,7 @@ import yaml from ..common import context context.update(bunch.Bunch( - result_queue = collections.deque(), + result_queue=collections.deque(), )) @@ -108,4 +108,3 @@ class ResultsLogger(gevent.Greenlet): result = context.result_queue.popleft() yrep = yaml.dump(result) self.outfile.write(yrep + "---\n") - diff --git a/s3tests/rand_readwrite.py b/s3tests/rand_readwrite.py index ab0a416..39cf3d6 100644 --- a/s3tests/rand_readwrite.py +++ b/s3tests/rand_readwrite.py @@ -44,7 +44,7 @@ class Result: size=self.size, time=self.time, mbps=mbps, - details=self.details + details=self.details, ) def reader(seconds, bucket, name=None, queue=None): @@ -144,11 +144,11 @@ def main(): file_size=options.file_size, file_stddev=options.stddev, quantity=options.quantity, - file_name_seed=r + file_name_seed=r, ) for x in xrange(options.num_writers)] greenlets += [gevent.spawn(reader, options.duration, bucket, name=x, - queue=q + queue=q, ) for x in xrange(options.num_readers)] gevent.spawn_later(options.duration, lambda: q.put(StopIteration)) @@ -177,19 +177,19 @@ def main(): print "--- Stats ---" print "Total Read: {read} MB ({mbps} MB/s)".format( read=(total_read/1024.0), - mbps=(total_read/1024.0/options.duration) + mbps=(total_read/1024.0/options.duration), ) print "Total Write: {write} MB ({mbps} MB/s)".format( write=(total_write/1024.0), - mbps=(total_write/1024.0/options.duration) + mbps=(total_write/1024.0/options.duration), ) print "Read filures: {num} ({percent}%)".format( num=read_failure, - percent=(100.0*read_failure/max(read_failure+read_success, 1)) + percent=(100.0*read_failure/max(read_failure+read_success, 1)), ) print "Write failures: {num} ({percent}%)".format( num=write_failure, - percent=(100.0*write_failure/max(write_failure+write_success, 1)) + percent=(100.0*write_failure/max(write_failure+write_success, 1)), ) gevent.joinall(greenlets, timeout=1) diff --git a/s3tests/realistic.py b/s3tests/realistic.py index 0755516..3251136 100644 --- a/s3tests/realistic.py +++ b/s3tests/realistic.py @@ -165,13 +165,13 @@ def files_varied(groups, unlimited=False): # Build the sets for our yield for num, size, stddev in groups: - assert num and size + assert num and size #TODO file_sets.append(bunch.Bunch( num = num, size = size, stddev = stddev, - files = files(size, stddev, time.time()) + files = files(size, stddev, time.time()), )) total_num += num @@ -199,4 +199,4 @@ def files_varied(groups, unlimited=False): yield next(file_set.files) if not ok: - raise RuntimeError, "Couldn't find a match." + raise RuntimeError("Couldn't find a match.") diff --git a/s3tests/roundtrip.py b/s3tests/roundtrip.py index 3f7f23e..78b4f14 100644 --- a/s3tests/roundtrip.py +++ b/s3tests/roundtrip.py @@ -17,16 +17,16 @@ from common.results import ResultsLogger # Set up the common context to use our information. Wee. context.update(bunch.Bunch( # Set to False when it's time to exit main loop. - running = True, + running=True, # The pools our tasks run in. - greenlet_pools = bunch.Bunch( + greenlet_pools=bunch.Bunch( writer=None, reader=None, ), # The greenlet that keeps logs going. - results_logger = None, + results_logger=None, ))