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:
parent
bd04fbeed5
commit
36e293b5d5
@ -493,7 +493,7 @@ class Store(glance_store.driver.Store):
|
|||||||
:mount_point is path of glance data directory
|
:mount_point is path of glance data directory
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#Calculate total available space
|
# Calculate total available space
|
||||||
stvfs_result = os.statvfs(mount_point)
|
stvfs_result = os.statvfs(mount_point)
|
||||||
total_available_space = stvfs_result.f_bavail * stvfs_result.f_bsize
|
total_available_space = stvfs_result.f_bavail * stvfs_result.f_bsize
|
||||||
return max(0, total_available_space)
|
return max(0, total_available_space)
|
||||||
|
@ -208,13 +208,13 @@ class StoreLocation(location.StoreLocation):
|
|||||||
obj = self.obj.strip('/')
|
obj = self.obj.strip('/')
|
||||||
|
|
||||||
if not credentials_included:
|
if not credentials_included:
|
||||||
#Used only in case of an add
|
# Used only in case of an add
|
||||||
#Get the current store from config
|
# Get the current store from config
|
||||||
store = self.conf.glance_store.default_swift_reference
|
store = self.conf.glance_store.default_swift_reference
|
||||||
|
|
||||||
return '%s://%s/%s/%s' % ('swift+config', store, container, obj)
|
return '%s://%s/%s/%s' % ('swift+config', store, container, obj)
|
||||||
if self.scheme == 'swift+config':
|
if self.scheme == 'swift+config':
|
||||||
if self.ssl_enabled == True:
|
if self.ssl_enabled:
|
||||||
self.scheme = 'swift+https'
|
self.scheme = 'swift+https'
|
||||||
else:
|
else:
|
||||||
self.scheme = 'swift+http'
|
self.scheme = 'swift+http'
|
||||||
@ -346,7 +346,7 @@ class StoreLocation(location.StoreLocation):
|
|||||||
return self.auth_or_store_url
|
return self.auth_or_store_url
|
||||||
else:
|
else:
|
||||||
if self.scheme == 'swift+config':
|
if self.scheme == 'swift+config':
|
||||||
if self.ssl_enabled == True:
|
if self.ssl_enabled:
|
||||||
self.scheme = 'swift+https'
|
self.scheme = 'swift+https'
|
||||||
else:
|
else:
|
||||||
self.scheme = 'swift+http'
|
self.scheme = 'swift+http'
|
||||||
|
@ -27,7 +27,7 @@ from glance_store import location
|
|||||||
|
|
||||||
class StoreBaseTest(base.BaseTestCase):
|
class StoreBaseTest(base.BaseTestCase):
|
||||||
|
|
||||||
#NOTE(flaper87): temporary until we
|
# NOTE(flaper87): temporary until we
|
||||||
# can move to a fully-local lib.
|
# can move to a fully-local lib.
|
||||||
# (Swift store's fault)
|
# (Swift store's fault)
|
||||||
_CONF = cfg.ConfigOpts()
|
_CONF = cfg.ConfigOpts()
|
||||||
|
@ -19,7 +19,7 @@ import urlparse
|
|||||||
|
|
||||||
|
|
||||||
def sort_url_by_qs_keys(url):
|
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'
|
# 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
|
# 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
|
# non-deterministic ordering of the query string causing problems with unit
|
||||||
|
@ -18,7 +18,9 @@ oslotest
|
|||||||
sphinx>=1.1.2,!=1.2.0,<1.3
|
sphinx>=1.1.2,!=1.2.0,<1.3
|
||||||
oslosphinx
|
oslosphinx
|
||||||
|
|
||||||
### Store specific packages
|
#
|
||||||
|
# Store specific packages
|
||||||
|
#
|
||||||
|
|
||||||
# For S3 storage backend
|
# For S3 storage backend
|
||||||
boto>=2.12.0,!=2.13.0
|
boto>=2.12.0,!=2.13.0
|
||||||
|
@ -247,7 +247,7 @@ class SwiftTests(object):
|
|||||||
uri = ("swift://%s:key@auth_address/glance/%s" %
|
uri = ("swift://%s:key@auth_address/glance/%s" %
|
||||||
(self.swift_store_user, FAKE_UUID))
|
(self.swift_store_user, FAKE_UUID))
|
||||||
self.config(swift_store_multi_tenant=True)
|
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={})
|
size = backend.get_size_from_backend(uri, context={})
|
||||||
self.assertEqual(size, 5120)
|
self.assertEqual(size, 5120)
|
||||||
|
|
||||||
|
3
tox.ini
3
tox.ini
@ -28,9 +28,8 @@ commands = {posargs}
|
|||||||
[flake8]
|
[flake8]
|
||||||
# TODO(dmllr): Analyze or fix the warnings blacklisted below
|
# TODO(dmllr): Analyze or fix the warnings blacklisted below
|
||||||
# E711 comparison to None should be 'if cond is not None:'
|
# 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
|
# H301 one import per line
|
||||||
# H404 multi line docstring should start with a summary
|
# H404 multi line docstring should start with a summary
|
||||||
ignore = E711,E712,H301,H404
|
ignore = E711,H301,H404
|
||||||
builtins = _
|
builtins = _
|
||||||
exclude = .venv,.git,.tox,dist,doc,etc,*glance_store/locale*,*openstack/common*,*lib/python*,*egg,build
|
exclude = .venv,.git,.tox,dist,doc,etc,*glance_store/locale*,*openstack/common*,*lib/python*,*egg,build
|
||||||
|
Loading…
x
Reference in New Issue
Block a user