Remove start index 0 in range()
Remove the useless arg ("start index" = 0) in files, since its default value is 0, to make code cleaner. Change-Id: I9d91ab8a8033b9a6c9b77608dea92c91a994c7fc
This commit is contained in:
parent
339606db33
commit
51c5185eea
|
@ -497,9 +497,9 @@ def _paginate_query(query, model, limit, sort_keys, marker=None,
|
|||
|
||||
# Build up an array of sort criteria as in the docstring
|
||||
criteria_list = []
|
||||
for i in xrange(0, len(sort_keys)):
|
||||
for i in xrange(len(sort_keys)):
|
||||
crit_attrs = []
|
||||
for j in xrange(0, i):
|
||||
for j in xrange(i):
|
||||
model_attr = getattr(model, sort_keys[j])
|
||||
attr = sa_sql.expression.case([(model_attr != None,
|
||||
model_attr), ],
|
||||
|
|
|
@ -718,7 +718,7 @@ class FunctionalTest(test_utils.BaseTestCase):
|
|||
to exit in a timely fashion
|
||||
"""
|
||||
launch_msg = None
|
||||
for i in range(0, max_retries):
|
||||
for i in range(max_retries):
|
||||
exitcode, out, err = server.start(expect_exit=not expect_launch,
|
||||
**kwargs)
|
||||
name = server.server_name
|
||||
|
|
|
@ -134,7 +134,7 @@ class TestBinGlanceCacheManage(functional.FunctionalTest):
|
|||
|
||||
# Add a few images and cache the second one of them
|
||||
# by GETing the image...
|
||||
for x in xrange(0, 4):
|
||||
for x in xrange(4):
|
||||
ids[x] = self.add_image("Image%s" % x)
|
||||
|
||||
path = "http://%s:%d/v1/images/%s" % ("127.0.0.1", api_port,
|
||||
|
@ -181,7 +181,7 @@ class TestBinGlanceCacheManage(functional.FunctionalTest):
|
|||
|
||||
# Add a few images and cache the second one of them
|
||||
# by GETing the image...
|
||||
for x in xrange(0, 4):
|
||||
for x in xrange(4):
|
||||
ids[x] = self.add_image("Image%s" % x)
|
||||
|
||||
# Queue second image and then cache it
|
||||
|
@ -279,7 +279,7 @@ log_file = %(log_file)s
|
|||
self.assertTrue('No queued images' in out.strip())
|
||||
|
||||
# Queue all images
|
||||
for x in xrange(0, 4):
|
||||
for x in xrange(4):
|
||||
cmd = ("%s --port=%d --force "
|
||||
"queue-image %s") % (exe_cmd, api_port, ids[x])
|
||||
|
||||
|
|
|
@ -414,7 +414,7 @@ class BaseCacheManageMiddlewareTest(object):
|
|||
ids = {}
|
||||
|
||||
# Add a bunch of images...
|
||||
for x in xrange(0, 4):
|
||||
for x in xrange(4):
|
||||
ids[x] = self.add_image("Image%s" % str(x))
|
||||
|
||||
# Verify no images in cached_images because no image has been hit
|
||||
|
@ -422,7 +422,7 @@ class BaseCacheManageMiddlewareTest(object):
|
|||
self.verify_no_cached_images()
|
||||
|
||||
# Grab the images, essentially caching them...
|
||||
for x in xrange(0, 4):
|
||||
for x in xrange(4):
|
||||
path = "http://%s:%d/v1/images/%s" % ("127.0.0.1", self.api_port,
|
||||
ids[x])
|
||||
http = httplib2.Http()
|
||||
|
@ -498,7 +498,7 @@ class BaseCacheManageMiddlewareTest(object):
|
|||
NUM_IMAGES = 4
|
||||
|
||||
# Add and then queue some images
|
||||
for x in xrange(0, NUM_IMAGES):
|
||||
for x in xrange(NUM_IMAGES):
|
||||
ids[x] = self.add_image("Image%s" % str(x))
|
||||
path = "http://%s:%d/v1/queued_images/%s" % ("127.0.0.1",
|
||||
self.api_port, ids[x])
|
||||
|
@ -562,7 +562,7 @@ log_file = %(log_file)s
|
|||
ids = {}
|
||||
|
||||
# Add a bunch of images...
|
||||
for x in xrange(0, 4):
|
||||
for x in xrange(4):
|
||||
ids[x] = self.add_image("Image%s" % str(x))
|
||||
|
||||
# Queue the first image, verify no images still in cache after queueing
|
||||
|
|
|
@ -63,7 +63,7 @@ class TestMultiprocessing(functional.FunctionalTest):
|
|||
cmd = "kill -INT %s" % ' '.join(children)
|
||||
execute(cmd, raise_error=True)
|
||||
|
||||
for _ in range(0, 9):
|
||||
for _ in range(9):
|
||||
# Yeah. This totally isn't a race condition. Randomly fails
|
||||
# set at 0.05. Works most of the time at 0.10
|
||||
time.sleep(0.10)
|
||||
|
|
|
@ -160,7 +160,7 @@ class ImageCacheTestCase(object):
|
|||
# prune it. We should see only 5 images left after
|
||||
# pruning, and the images that are least recently accessed
|
||||
# should be the ones pruned...
|
||||
for x in xrange(0, 10):
|
||||
for x in xrange(10):
|
||||
FIXTURE_FILE = StringIO.StringIO(FIXTURE_DATA)
|
||||
self.assertTrue(self.cache.cache_image_file(x,
|
||||
FIXTURE_FILE))
|
||||
|
@ -168,7 +168,7 @@ class ImageCacheTestCase(object):
|
|||
self.assertEqual(10 * 1024, self.cache.get_cache_size())
|
||||
|
||||
# OK, hit the images that are now cached...
|
||||
for x in xrange(0, 10):
|
||||
for x in xrange(10):
|
||||
buff = StringIO.StringIO()
|
||||
with self.cache.open_for_read(x) as cache_file:
|
||||
for chunk in cache_file:
|
||||
|
@ -245,7 +245,7 @@ class ImageCacheTestCase(object):
|
|||
|
||||
self.cache.delete_cached_image(1)
|
||||
|
||||
for x in xrange(0, 3):
|
||||
for x in xrange(3):
|
||||
self.assertTrue(self.cache.queue_image(x))
|
||||
|
||||
self.assertEqual(self.cache.get_queued_images(),
|
||||
|
|
Loading…
Reference in New Issue