From 94d1e0f847c555ce1c62099e9af7d361bee3df30 Mon Sep 17 00:00:00 2001 From: JordanP Date: Fri, 6 Feb 2015 15:38:18 +0100 Subject: [PATCH] Move to hacking 0.10 Release notes: http://git.openstack.org/cgit/openstack-dev/hacking/tag/?id=0.10.0 Change-Id: Iaed2de813fb181ab9f67dda50a4c19d1b9a7dc31 --- glance_store/_drivers/rbd.py | 11 +++++------ glance_store/_drivers/s3.py | 2 +- glance_store/_drivers/sheepdog.py | 2 +- glance_store/capabilities.py | 2 +- test-requirements.txt | 2 +- tests/unit/test_gridfs_store.py | 2 +- tests/unit/test_s3_store.py | 4 ++-- tox.ini | 4 ++-- 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/glance_store/_drivers/rbd.py b/glance_store/_drivers/rbd.py index 6eceb72a..6b1d9247 100644 --- a/glance_store/_drivers/rbd.py +++ b/glance_store/_drivers/rbd.py @@ -307,9 +307,8 @@ class Store(driver.Store): # Then delete image. rbd.RBD().remove(ioctx, image_name) except rbd.ImageNotFound: - raise exceptions.NotFound(message= - _("RBD image %s does not exist") - % image_name) + msg = _("RBD image %s does not exist") % image_name + raise exceptions.NotFound(message=msg) except rbd.ImageBusy: log_msg = _("image %s could not be removed " "because it is in use") @@ -351,9 +350,9 @@ class Store(driver.Store): loc = self._create_image(fsid, ioctx, image_name, image_size, order) except rbd.ImageExists: - raise exceptions.Duplicate(message= - _('RBD image %s already exists') - % image_id) + msg = _('RBD image %s already exists') % image_id + raise exceptions.Duplicate(message=msg) + try: with rbd.Image(ioctx, image_name) as image: bytes_written = 0 diff --git a/glance_store/_drivers/s3.py b/glance_store/_drivers/s3.py index bca8bb8d..3b674feb 100644 --- a/glance_store/_drivers/s3.py +++ b/glance_store/_drivers/s3.py @@ -82,7 +82,7 @@ _S3_OPTS = [ ] -class UploadPart: +class UploadPart(object): """ The class for the upload part diff --git a/glance_store/_drivers/sheepdog.py b/glance_store/_drivers/sheepdog.py index 18863ab3..653ce16e 100644 --- a/glance_store/_drivers/sheepdog.py +++ b/glance_store/_drivers/sheepdog.py @@ -49,7 +49,7 @@ _SHEEPDOG_OPTS = [ ] -class SheepdogImage: +class SheepdogImage(object): """Class describing an image stored in Sheepdog storage.""" def __init__(self, addr, port, name, chunk_size): diff --git a/glance_store/capabilities.py b/glance_store/capabilities.py index 704ed5dd..b297eec9 100644 --- a/glance_store/capabilities.py +++ b/glance_store/capabilities.py @@ -198,7 +198,7 @@ def check(store_op_fun): req_cap = op_cap_map[op] except KeyError: LOG.warn(_LW('The capability of operation "%s" ' - 'could not be checked.' % op)) + 'could not be checked.'), op) else: if not store.is_capable(*req_cap): kwargs.setdefault('offset', 0) diff --git a/test-requirements.txt b/test-requirements.txt index 77c35a52..2daee152 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,5 +1,5 @@ # Metrics and style -hacking>=0.8.0,<0.9 +hacking>=0.10.0,<0.11 # Packaging mock>=1.0 diff --git a/tests/unit/test_gridfs_store.py b/tests/unit/test_gridfs_store.py index c6ddcbd5..60c0e7ea 100644 --- a/tests/unit/test_gridfs_store.py +++ b/tests/unit/test_gridfs_store.py @@ -68,7 +68,7 @@ class FakeGridFS(object): def get(self, location): self.called_commands.append('get') - class Image: + class Image(object): _id = "test" length = 6 md5 = "yoyo" diff --git a/tests/unit/test_s3_store.py b/tests/unit/test_s3_store.py index e1ce939d..904517f1 100644 --- a/tests/unit/test_s3_store.py +++ b/tests/unit/test_s3_store.py @@ -104,7 +104,7 @@ class FakeKey(object): return self.data -class FakeMPU: +class FakeMPU(object): """ Acts like a ``boto.s3.multipart.MultiPartUpload`` """ @@ -167,7 +167,7 @@ class FakeMPU: return key -class FakeBucket: +class FakeBucket(object): """Acts like a ``boto.s3.bucket.Bucket``.""" def __init__(self, name, keys=None): self.name = name diff --git a/tox.ini b/tox.ini index 98db88d4..4f086570 100644 --- a/tox.ini +++ b/tox.ini @@ -27,9 +27,9 @@ commands = {posargs} [flake8] # TODO(dmllr): Analyze or fix the warnings blacklisted below -# E711 comparison to None should be 'if cond is not None:' # H301 one import per line # H404 multi line docstring should start with a summary -ignore = E711,H301,H404 +# H405 multi line docstring summary not separated with an empty line +ignore = H301,H404,H405 builtins = _ exclude = .venv,.git,.tox,dist,doc,etc,*glance_store/locale*,*openstack/common*,*lib/python*,*egg,build