Fixing PEP8 E712 and E265

1. PEP8 E712, removed singleton comparison using '==' operator:
   E712 comparison to True should be 'if cond is True:'or 'if cond:'
   Two places.
2. Fix PEP8 E265 block comment syntax.
   E265 block comment should start with '# '
3. No more E712 so removed it from tox.ini ignored list.

Change-Id: I778aa5c4e1458cccb7a34d087b3b59eceadd45d0
This commit is contained in:
Radoslaw Smigielski 2015-01-23 15:40:41 +00:00 committed by JordanP
parent bd04fbeed5
commit 36e293b5d5
7 changed files with 12 additions and 11 deletions

View File

@ -493,7 +493,7 @@ class Store(glance_store.driver.Store):
:mount_point is path of glance data directory
"""
#Calculate total available space
# Calculate total available space
stvfs_result = os.statvfs(mount_point)
total_available_space = stvfs_result.f_bavail * stvfs_result.f_bsize
return max(0, total_available_space)

View File

@ -208,13 +208,13 @@ class StoreLocation(location.StoreLocation):
obj = self.obj.strip('/')
if not credentials_included:
#Used only in case of an add
#Get the current store from config
# Used only in case of an add
# Get the current store from config
store = self.conf.glance_store.default_swift_reference
return '%s://%s/%s/%s' % ('swift+config', store, container, obj)
if self.scheme == 'swift+config':
if self.ssl_enabled == True:
if self.ssl_enabled:
self.scheme = 'swift+https'
else:
self.scheme = 'swift+http'
@ -346,7 +346,7 @@ class StoreLocation(location.StoreLocation):
return self.auth_or_store_url
else:
if self.scheme == 'swift+config':
if self.ssl_enabled == True:
if self.ssl_enabled:
self.scheme = 'swift+https'
else:
self.scheme = 'swift+http'

View File

@ -27,7 +27,7 @@ from glance_store import location
class StoreBaseTest(base.BaseTestCase):
#NOTE(flaper87): temporary until we
# NOTE(flaper87): temporary until we
# can move to a fully-local lib.
# (Swift store's fault)
_CONF = cfg.ConfigOpts()

View File

@ -19,7 +19,7 @@ import urlparse
def sort_url_by_qs_keys(url):
#NOTE(kragniz): this only sorts the keys of the query string of a url.
# NOTE(kragniz): this only sorts the keys of the query string of a url.
# For example, an input of '/v2/tasks?sort_key=id&sort_dir=asc&limit=10'
# returns '/v2/tasks?limit=10&sort_dir=asc&sort_key=id'. This is to prevent
# non-deterministic ordering of the query string causing problems with unit

View File

@ -18,7 +18,9 @@ oslotest
sphinx>=1.1.2,!=1.2.0,<1.3
oslosphinx
### Store specific packages
#
# Store specific packages
#
# For S3 storage backend
boto>=2.12.0,!=2.13.0

View File

@ -247,7 +247,7 @@ class SwiftTests(object):
uri = ("swift://%s:key@auth_address/glance/%s" %
(self.swift_store_user, FAKE_UUID))
self.config(swift_store_multi_tenant=True)
#NOTE(markwash): ensure the image is found
# NOTE(markwash): ensure the image is found
size = backend.get_size_from_backend(uri, context={})
self.assertEqual(size, 5120)

View File

@ -28,9 +28,8 @@ commands = {posargs}
[flake8]
# TODO(dmllr): Analyze or fix the warnings blacklisted below
# E711 comparison to None should be 'if cond is not None:'
# E712 comparison to True should be 'if cond is True:' or 'if cond:'
# H301 one import per line
# H404 multi line docstring should start with a summary
ignore = E711,E712,H301,H404
ignore = E711,H301,H404
builtins = _
exclude = .venv,.git,.tox,dist,doc,etc,*glance_store/locale*,*openstack/common*,*lib/python*,*egg,build