Fix `one line docstring needs punctuation.`
Remove H402 from ignore list.

Change-Id: I0cd3b88467067cdb10d41f86cc94e075da141ac0
This commit is contained in:
Oleksii Chuprykov 2014-09-17 12:34:28 +03:00
parent 692a6cdc6e
commit 71ae81d69c
14 changed files with 30 additions and 29 deletions

View File

@ -102,7 +102,7 @@ def get_cinderclient(conf, context):
class StoreLocation(glance_store.location.StoreLocation): class StoreLocation(glance_store.location.StoreLocation):
"""Class describing a Cinder URI""" """Class describing a Cinder URI."""
def process_specs(self): def process_specs(self):
self.scheme = self.specs.get('scheme', 'cinder') self.scheme = self.specs.get('scheme', 'cinder')

View File

@ -110,7 +110,7 @@ class ChunkedFile(object):
self.fp.seek(offset) self.fp.seek(offset)
def __iter__(self): def __iter__(self):
"""Return an iterator over the image file""" """Return an iterator over the image file."""
try: try:
if self.fp: if self.fp:
while True: while True:

View File

@ -31,7 +31,7 @@ MAX_REDIRECTS = 5
class StoreLocation(glance_store.location.StoreLocation): class StoreLocation(glance_store.location.StoreLocation):
"""Class describing an HTTP(S) URI""" """Class describing an HTTP(S) URI."""
def process_specs(self): def process_specs(self):
self.scheme = self.specs.get('scheme', 'http') self.scheme = self.specs.get('scheme', 'http')

View File

@ -179,7 +179,7 @@ class ChunkedFile(object):
self.chunk_size = chunk_size self.chunk_size = chunk_size
def __iter__(self): def __iter__(self):
"""Return an iterator over the image file""" """Return an iterator over the image file."""
try: try:
if self.fp: if self.fp:
while True: while True:

View File

@ -132,7 +132,7 @@ class Indexable(object):
return self.chunk return self.chunk
def another(self): def another(self):
"""Implemented by subclasses to return the next element""" """Implemented by subclasses to return the next element."""
raise NotImplementedError raise NotImplementedError
def getvalue(self): def getvalue(self):
@ -222,7 +222,7 @@ def verify_default_store():
def get_known_schemes(): def get_known_schemes():
"""Returns list of known schemes""" """Returns list of known schemes."""
return location.SCHEME_TO_CLS_MAP.keys() return location.SCHEME_TO_CLS_MAP.keys()
@ -249,7 +249,7 @@ def get_store_from_uri(uri):
def get_from_backend(uri, offset=0, chunk_size=None, context=None): def get_from_backend(uri, offset=0, chunk_size=None, context=None):
"""Yields chunks of data from backend specified by uri""" """Yields chunks of data from backend specified by uri."""
loc = location.get_location_from_uri(uri) loc = location.get_location_from_uri(uri)
store = get_store_from_uri(uri) store = get_store_from_uri(uri)
@ -263,7 +263,7 @@ def get_from_backend(uri, offset=0, chunk_size=None, context=None):
def get_size_from_backend(uri, context=None): def get_size_from_backend(uri, context=None):
"""Retrieves image size from backend specified by uri""" """Retrieves image size from backend specified by uri."""
loc = location.get_location_from_uri(uri) loc = location.get_location_from_uri(uri)
store = get_store_from_uri(uri) store = get_store_from_uri(uri)
@ -272,7 +272,7 @@ def get_size_from_backend(uri, context=None):
def delete_from_backend(uri, context=None): def delete_from_backend(uri, context=None):
"""Removes chunks of data from backend specified by uri""" """Removes chunks of data from backend specified by uri."""
loc = location.get_location_from_uri(uri) loc = location.get_location_from_uri(uri)
store = get_store_from_uri(uri) store = get_store_from_uri(uri)

View File

@ -130,7 +130,7 @@ class TestStore(base.StoreBaseTest):
loc) loc)
def test_add(self): def test_add(self):
"""Test that we can add an image via the filesystem backend""" """Test that we can add an image via the filesystem backend."""
ChunkedFile.CHUNKSIZE = 1024 ChunkedFile.CHUNKSIZE = 1024
expected_image_id = str(uuid.uuid4()) expected_image_id = str(uuid.uuid4())
expected_file_size = 5 * KB # 5K expected_file_size = 5 * KB # 5K

View File

@ -78,7 +78,7 @@ class FakeGridFS(object):
class TestStore(base.StoreBaseTest): class TestStore(base.StoreBaseTest):
def setUp(self): def setUp(self):
"""Establish a clean test environment""" """Establish a clean test environment."""
super(TestStore, self).setUp() super(TestStore, self).setUp()
if pymongo is not None: if pymongo is not None:

View File

@ -143,7 +143,7 @@ class MockRBD(object):
class TestStore(base.StoreBaseTest): class TestStore(base.StoreBaseTest):
def setUp(self): def setUp(self):
"""Establish a clean test environment""" """Establish a clean test environment."""
super(TestStore, self).setUp() super(TestStore, self).setUp()
rbd_store.rados = MockRados rbd_store.rados = MockRados

View File

@ -148,7 +148,7 @@ def format_s3_location(user, key, authurl, bucket, obj):
class TestStore(base.StoreBaseTest): class TestStore(base.StoreBaseTest):
def setUp(self): def setUp(self):
"""Establish a clean test environment""" """Establish a clean test environment."""
super(TestStore, self).setUp() super(TestStore, self).setUp()
self.store = s3.Store(self.conf) self.store = s3.Store(self.conf)
self.config(**S3_CONF) self.config(**S3_CONF)
@ -168,7 +168,7 @@ class TestStore(base.StoreBaseTest):
self.addCleanup(bucket.stop) self.addCleanup(bucket.stop)
def test_get(self): def test_get(self):
"""Test a "normal" retrieval of an image in chunks""" """Test a "normal" retrieval of an image in chunks."""
loc = get_location_from_uri( loc = get_location_from_uri(
"s3://user:key@auth_address/glance/%s" % FAKE_UUID) "s3://user:key@auth_address/glance/%s" % FAKE_UUID)
(image_s3, image_size) = self.store.get(loc) (image_s3, image_size) = self.store.get(loc)
@ -183,7 +183,7 @@ class TestStore(base.StoreBaseTest):
self.assertEqual(expected_data, data) self.assertEqual(expected_data, data)
def test_get_calling_format_path(self): def test_get_calling_format_path(self):
"""Test a "normal" retrieval of an image in chunks""" """Test a "normal" retrieval of an image in chunks."""
self.config(s3_store_bucket_url_format='path') self.config(s3_store_bucket_url_format='path')
def fake_S3Connection_init(*args, **kwargs): def fake_S3Connection_init(*args, **kwargs):
@ -199,7 +199,7 @@ class TestStore(base.StoreBaseTest):
(image_s3, image_size) = self.store.get(loc) (image_s3, image_size) = self.store.get(loc)
def test_get_calling_format_default(self): def test_get_calling_format_default(self):
"""Test a "normal" retrieval of an image in chunks""" """Test a "normal" retrieval of an image in chunks."""
def fake_S3Connection_init(*args, **kwargs): def fake_S3Connection_init(*args, **kwargs):
expected_cls = boto.s3.connection.SubdomainCallingFormat expected_cls = boto.s3.connection.SubdomainCallingFormat
@ -227,7 +227,7 @@ class TestStore(base.StoreBaseTest):
self.assertRaises(exceptions.NotFound, self.store.get, loc) self.assertRaises(exceptions.NotFound, self.store.get, loc)
def test_add(self): def test_add(self):
"""Test that we can add an image via the s3 backend""" """Test that we can add an image via the s3 backend."""
expected_image_id = str(uuid.uuid4()) expected_image_id = str(uuid.uuid4())
expected_s3_size = FIVE_KB expected_s3_size = FIVE_KB
expected_s3_contents = "*" * expected_s3_size expected_s3_contents = "*" * expected_s3_size

View File

@ -25,7 +25,7 @@ from glance_store.tests import base
class TestSheepdogStore(base.StoreBaseTest): class TestSheepdogStore(base.StoreBaseTest):
def setUp(self): def setUp(self):
"""Establish a clean test environment""" """Establish a clean test environment."""
super(TestSheepdogStore, self).setUp() super(TestSheepdogStore, self).setUp()
def _fake_execute(*cmd, **kwargs): def _fake_execute(*cmd, **kwargs):

View File

@ -269,7 +269,7 @@ class SwiftTests(object):
self.assertEqual(size, 5120) self.assertEqual(size, 5120)
def test_get(self): def test_get(self):
"""Test a "normal" retrieval of an image in chunks""" """Test a "normal" retrieval of an image in chunks."""
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)
loc = get_location_from_uri(uri) loc = get_location_from_uri(uri)
@ -344,7 +344,7 @@ class SwiftTests(object):
'.is_multiple_swift_store_accounts_enabled', '.is_multiple_swift_store_accounts_enabled',
mock.Mock(return_value=False)) mock.Mock(return_value=False))
def test_add(self): def test_add(self):
"""Test that we can add an image via the swift backend""" """Test that we can add an image via the swift backend."""
reload(swift) reload(swift)
self.store = Store(self.conf) self.store = Store(self.conf)
self.store.configure() self.store.configure()
@ -775,7 +775,7 @@ class TestStoreAuthV1(base.StoreBaseTest, SwiftTests):
return conf return conf
def setUp(self): def setUp(self):
"""Establish a clean test environment""" """Establish a clean test environment."""
super(TestStoreAuthV1, self).setUp() super(TestStoreAuthV1, self).setUp()
conf = self.getConfig() conf = self.getConfig()

View File

@ -19,7 +19,7 @@ from glance_store.common import utils
class TestUtils(base.BaseTestCase): class TestUtils(base.BaseTestCase):
"""Test routines in glance_store.common.utils""" """Test routines in glance_store.common.utils."""
def test_exception_to_str(self): def test_exception_to_str(self):
class FakeException(Exception): class FakeException(Exception):

View File

@ -81,7 +81,7 @@ class TestStore(base.StoreBaseTest):
@mock.patch('oslo.vmware.api.VMwareAPISession', auptospec=True) @mock.patch('oslo.vmware.api.VMwareAPISession', auptospec=True)
def setUp(self, mock_session): def setUp(self, mock_session):
"""Establish a clean test environment""" """Establish a clean test environment."""
super(TestStore, self).setUp() super(TestStore, self).setUp()
vm_store.Store.CHUNKSIZE = 2 vm_store.Store.CHUNKSIZE = 2
@ -131,7 +131,7 @@ class TestStore(base.StoreBaseTest):
vm_store.Store._build_vim_cookie_header = mock.Mock() vm_store.Store._build_vim_cookie_header = mock.Mock()
def test_get(self): def test_get(self):
"""Test a "normal" retrieval of an image in chunks""" """Test a "normal" retrieval of an image in chunks."""
expected_image_size = 31 expected_image_size = 31
expected_returns = ['I ', 'am', ' a', ' t', 'ea', 'po', 't,', ' s', expected_returns = ['I ', 'am', ' a', ' t', 'ea', 'po', 't,', ' s',
'ho', 'rt', ' a', 'nd', ' s', 'to', 'ut', '\n'] 'ho', 'rt', ' a', 'nd', ' s', 'to', 'ut', '\n']
@ -158,7 +158,7 @@ class TestStore(base.StoreBaseTest):
@mock.patch.object(vm_store._Reader, 'size') @mock.patch.object(vm_store._Reader, 'size')
def test_add(self, fake_size): def test_add(self, fake_size):
"""Test that we can add an image via the VMware backend""" """Test that we can add an image via the VMware backend."""
expected_image_id = str(uuid.uuid4()) expected_image_id = str(uuid.uuid4())
expected_size = FIVE_KB expected_size = FIVE_KB
expected_contents = "*" * expected_size expected_contents = "*" * expected_size
@ -215,7 +215,7 @@ class TestStore(base.StoreBaseTest):
self.assertEqual(expected_checksum, checksum) self.assertEqual(expected_checksum, checksum)
def test_delete(self): def test_delete(self):
"""Test we can delete an existing image in the VMware store""" """Test we can delete an existing image in the VMware store."""
loc = get_location_from_uri( loc = get_location_from_uri(
"vsphere://127.0.0.1/folder/openstack_glance/%s?" "vsphere://127.0.0.1/folder/openstack_glance/%s?"
"dsName=ds1&dcPath=dc1" % FAKE_UUID) "dsName=ds1&dcPath=dc1" % FAKE_UUID)
@ -228,7 +228,9 @@ class TestStore(base.StoreBaseTest):
self.assertRaises(exceptions.NotFound, self.store.get, loc) self.assertRaises(exceptions.NotFound, self.store.get, loc)
def test_get_size(self): def test_get_size(self):
"""Test we can get the size of an existing image in the VMware store""" """
Test we can get the size of an existing image in the VMware store
"""
loc = get_location_from_uri( loc = get_location_from_uri(
"vsphere://127.0.0.1/folder/openstack_glance/%s" "vsphere://127.0.0.1/folder/openstack_glance/%s"
"?dsName=ds1&dcPath=dc1" % FAKE_UUID) "?dsName=ds1&dcPath=dc1" % FAKE_UUID)

View File

@ -31,8 +31,7 @@ commands = {posargs}
# E712 comparison to True should be 'if cond is True:' or 'if cond:' # E712 comparison to True should be 'if cond is True:' or 'if cond:'
# F841 local variable 'name' assigned but never used # F841 local variable 'name' assigned but never used
# H301 one import per line # H301 one import per line
# H402 one line docstring needs punctuation.
# H404 multi line docstring should start with a summary # H404 multi line docstring should start with a summary
ignore = E711,E712,F841,H301,H402,H404 ignore = E711,E712,F841,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