Fix H402
Fix `one line docstring needs punctuation.` Remove H402 from ignore list. Change-Id: I0cd3b88467067cdb10d41f86cc94e075da141ac0
This commit is contained in:
parent
692a6cdc6e
commit
71ae81d69c
@ -102,7 +102,7 @@ def get_cinderclient(conf, context):
|
||||
|
||||
class StoreLocation(glance_store.location.StoreLocation):
|
||||
|
||||
"""Class describing a Cinder URI"""
|
||||
"""Class describing a Cinder URI."""
|
||||
|
||||
def process_specs(self):
|
||||
self.scheme = self.specs.get('scheme', 'cinder')
|
||||
|
@ -110,7 +110,7 @@ class ChunkedFile(object):
|
||||
self.fp.seek(offset)
|
||||
|
||||
def __iter__(self):
|
||||
"""Return an iterator over the image file"""
|
||||
"""Return an iterator over the image file."""
|
||||
try:
|
||||
if self.fp:
|
||||
while True:
|
||||
|
@ -31,7 +31,7 @@ MAX_REDIRECTS = 5
|
||||
|
||||
class StoreLocation(glance_store.location.StoreLocation):
|
||||
|
||||
"""Class describing an HTTP(S) URI"""
|
||||
"""Class describing an HTTP(S) URI."""
|
||||
|
||||
def process_specs(self):
|
||||
self.scheme = self.specs.get('scheme', 'http')
|
||||
|
@ -179,7 +179,7 @@ class ChunkedFile(object):
|
||||
self.chunk_size = chunk_size
|
||||
|
||||
def __iter__(self):
|
||||
"""Return an iterator over the image file"""
|
||||
"""Return an iterator over the image file."""
|
||||
try:
|
||||
if self.fp:
|
||||
while True:
|
||||
|
@ -132,7 +132,7 @@ class Indexable(object):
|
||||
return self.chunk
|
||||
|
||||
def another(self):
|
||||
"""Implemented by subclasses to return the next element"""
|
||||
"""Implemented by subclasses to return the next element."""
|
||||
raise NotImplementedError
|
||||
|
||||
def getvalue(self):
|
||||
@ -222,7 +222,7 @@ def verify_default_store():
|
||||
|
||||
|
||||
def get_known_schemes():
|
||||
"""Returns list of known schemes"""
|
||||
"""Returns list of known schemes."""
|
||||
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):
|
||||
"""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)
|
||||
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):
|
||||
"""Retrieves image size from backend specified by uri"""
|
||||
"""Retrieves image size from backend specified by uri."""
|
||||
|
||||
loc = location.get_location_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):
|
||||
"""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)
|
||||
store = get_store_from_uri(uri)
|
||||
|
||||
|
@ -130,7 +130,7 @@ class TestStore(base.StoreBaseTest):
|
||||
loc)
|
||||
|
||||
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
|
||||
expected_image_id = str(uuid.uuid4())
|
||||
expected_file_size = 5 * KB # 5K
|
||||
|
@ -78,7 +78,7 @@ class FakeGridFS(object):
|
||||
class TestStore(base.StoreBaseTest):
|
||||
|
||||
def setUp(self):
|
||||
"""Establish a clean test environment"""
|
||||
"""Establish a clean test environment."""
|
||||
super(TestStore, self).setUp()
|
||||
|
||||
if pymongo is not None:
|
||||
|
@ -143,7 +143,7 @@ class MockRBD(object):
|
||||
|
||||
class TestStore(base.StoreBaseTest):
|
||||
def setUp(self):
|
||||
"""Establish a clean test environment"""
|
||||
"""Establish a clean test environment."""
|
||||
super(TestStore, self).setUp()
|
||||
|
||||
rbd_store.rados = MockRados
|
||||
|
@ -148,7 +148,7 @@ def format_s3_location(user, key, authurl, bucket, obj):
|
||||
class TestStore(base.StoreBaseTest):
|
||||
|
||||
def setUp(self):
|
||||
"""Establish a clean test environment"""
|
||||
"""Establish a clean test environment."""
|
||||
super(TestStore, self).setUp()
|
||||
self.store = s3.Store(self.conf)
|
||||
self.config(**S3_CONF)
|
||||
@ -168,7 +168,7 @@ class TestStore(base.StoreBaseTest):
|
||||
self.addCleanup(bucket.stop)
|
||||
|
||||
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(
|
||||
"s3://user:key@auth_address/glance/%s" % FAKE_UUID)
|
||||
(image_s3, image_size) = self.store.get(loc)
|
||||
@ -183,7 +183,7 @@ class TestStore(base.StoreBaseTest):
|
||||
self.assertEqual(expected_data, data)
|
||||
|
||||
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')
|
||||
|
||||
def fake_S3Connection_init(*args, **kwargs):
|
||||
@ -199,7 +199,7 @@ class TestStore(base.StoreBaseTest):
|
||||
(image_s3, image_size) = self.store.get(loc)
|
||||
|
||||
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):
|
||||
expected_cls = boto.s3.connection.SubdomainCallingFormat
|
||||
@ -227,7 +227,7 @@ class TestStore(base.StoreBaseTest):
|
||||
self.assertRaises(exceptions.NotFound, self.store.get, loc)
|
||||
|
||||
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_s3_size = FIVE_KB
|
||||
expected_s3_contents = "*" * expected_s3_size
|
||||
|
@ -25,7 +25,7 @@ from glance_store.tests import base
|
||||
class TestSheepdogStore(base.StoreBaseTest):
|
||||
|
||||
def setUp(self):
|
||||
"""Establish a clean test environment"""
|
||||
"""Establish a clean test environment."""
|
||||
super(TestSheepdogStore, self).setUp()
|
||||
|
||||
def _fake_execute(*cmd, **kwargs):
|
||||
|
@ -269,7 +269,7 @@ class SwiftTests(object):
|
||||
self.assertEqual(size, 5120)
|
||||
|
||||
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" % (
|
||||
self.swift_store_user, FAKE_UUID)
|
||||
loc = get_location_from_uri(uri)
|
||||
@ -344,7 +344,7 @@ class SwiftTests(object):
|
||||
'.is_multiple_swift_store_accounts_enabled',
|
||||
mock.Mock(return_value=False))
|
||||
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)
|
||||
self.store = Store(self.conf)
|
||||
self.store.configure()
|
||||
@ -775,7 +775,7 @@ class TestStoreAuthV1(base.StoreBaseTest, SwiftTests):
|
||||
return conf
|
||||
|
||||
def setUp(self):
|
||||
"""Establish a clean test environment"""
|
||||
"""Establish a clean test environment."""
|
||||
super(TestStoreAuthV1, self).setUp()
|
||||
conf = self.getConfig()
|
||||
|
||||
|
@ -19,7 +19,7 @@ from glance_store.common import utils
|
||||
|
||||
|
||||
class TestUtils(base.BaseTestCase):
|
||||
"""Test routines in glance_store.common.utils"""
|
||||
"""Test routines in glance_store.common.utils."""
|
||||
|
||||
def test_exception_to_str(self):
|
||||
class FakeException(Exception):
|
||||
|
@ -81,7 +81,7 @@ class TestStore(base.StoreBaseTest):
|
||||
|
||||
@mock.patch('oslo.vmware.api.VMwareAPISession', auptospec=True)
|
||||
def setUp(self, mock_session):
|
||||
"""Establish a clean test environment"""
|
||||
"""Establish a clean test environment."""
|
||||
super(TestStore, self).setUp()
|
||||
|
||||
vm_store.Store.CHUNKSIZE = 2
|
||||
@ -131,7 +131,7 @@ class TestStore(base.StoreBaseTest):
|
||||
vm_store.Store._build_vim_cookie_header = mock.Mock()
|
||||
|
||||
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_returns = ['I ', 'am', ' a', ' t', 'ea', 'po', 't,', ' s',
|
||||
'ho', 'rt', ' a', 'nd', ' s', 'to', 'ut', '\n']
|
||||
@ -158,7 +158,7 @@ class TestStore(base.StoreBaseTest):
|
||||
|
||||
@mock.patch.object(vm_store._Reader, '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_size = FIVE_KB
|
||||
expected_contents = "*" * expected_size
|
||||
@ -215,7 +215,7 @@ class TestStore(base.StoreBaseTest):
|
||||
self.assertEqual(expected_checksum, checksum)
|
||||
|
||||
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(
|
||||
"vsphere://127.0.0.1/folder/openstack_glance/%s?"
|
||||
"dsName=ds1&dcPath=dc1" % FAKE_UUID)
|
||||
@ -228,7 +228,9 @@ class TestStore(base.StoreBaseTest):
|
||||
self.assertRaises(exceptions.NotFound, self.store.get, loc)
|
||||
|
||||
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(
|
||||
"vsphere://127.0.0.1/folder/openstack_glance/%s"
|
||||
"?dsName=ds1&dcPath=dc1" % FAKE_UUID)
|
||||
|
3
tox.ini
3
tox.ini
@ -31,8 +31,7 @@ commands = {posargs}
|
||||
# E712 comparison to True should be 'if cond is True:' or 'if cond:'
|
||||
# F841 local variable 'name' assigned but never used
|
||||
# H301 one import per line
|
||||
# H402 one line docstring needs punctuation.
|
||||
# H404 multi line docstring should start with a summary
|
||||
ignore = E711,E712,F841,H301,H402,H404
|
||||
ignore = E711,E712,F841,H301,H404
|
||||
builtins = _
|
||||
exclude = .venv,.git,.tox,dist,doc,etc,*glance_store/locale*,*openstack/common*,*lib/python*,*egg,build
|
||||
|
Loading…
Reference in New Issue
Block a user