Fix D200: 1 line docstrings should fit with quotes (PEP257)

No other PEP257 violations were addressed in this patch.

Change-Id: If2f0414dadb1b0fffc53436ae137fdc40aa6b136
This commit is contained in:
Dolph Mathews 2015-10-01 13:06:44 +00:00
parent 7d60283ba2
commit 9cc1a368b7
19 changed files with 37 additions and 63 deletions

View File

@ -12,9 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Keystone In-Memory Dogpile.cache backend implementation.
"""
"""Keystone In-Memory Dogpile.cache backend implementation."""
import copy

View File

@ -12,9 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Keystone Memcached dogpile.cache backend implementation.
"""
"""Keystone Memcached dogpile.cache backend implementation."""
import random as _random
import time

View File

@ -215,8 +215,7 @@ def get_remote_id_parameter(protocol):
def validate_idp(idp, protocol, assertion):
"""Validate the IdP providing the assertion is registered for the mapping.
"""
"""The IdP providing the assertion should be registered for the mapping."""
remote_id_parameter = get_remote_id_parameter(protocol)
if not remote_id_parameter or not idp['remote_ids']:

View File

@ -800,9 +800,7 @@ class ResourceDriverV8(object):
return ref
def _validate_default_domain_id(self, domain_id):
"""Validate that the domain ID specified belongs to the default domain.
"""
"""Validate that the domain ID belongs to the default domain."""
if domain_id != CONF.identity.default_domain_id:
raise exception.DomainNotFound(domain_id=domain_id)

View File

@ -186,9 +186,7 @@ class CheckForLoggingIssues(BaseASTChecker):
self.visit(value)
def _filter_imports(self, module_name, alias):
"""Keeps lists of logging and i18n imports
"""
"""Keeps lists of logging and i18n imports."""
if module_name in self.LOG_MODULES:
self.logger_module_names.append(alias.asname or alias.name)
elif module_name in self.I18N_MODULES:
@ -284,9 +282,7 @@ class CheckForLoggingIssues(BaseASTChecker):
return super(CheckForLoggingIssues, self).generic_visit(node)
def visit_Call(self, node):
"""Look for the 'LOG.*' calls.
"""
"""Look for the 'LOG.*' calls."""
# obj.method
if isinstance(node.func, ast.Attribute):

View File

@ -43,9 +43,7 @@ class ArbitraryException(Exception):
def register_callback(operation, resource_type=EXP_RESOURCE_TYPE):
"""Helper for creating and registering a mock callback.
"""
"""Helper for creating and registering a mock callback."""
callback = mock.Mock(__name__='callback',
im_class=mock.Mock(__name__='class'))
notifications.register_event_callback(operation, resource_type, callback)

View File

@ -29,8 +29,7 @@ ADMIN = 'admin'
class AppServer(fixtures.Fixture):
"""A fixture for managing an application server instance.
"""
"""A fixture for managing an application server instance."""
def __init__(self, config, name, cert=None, key=None, ca=None,
cert_required=False, host='127.0.0.1', port=0):

View File

@ -17,7 +17,9 @@ from keystone.common import cache
class Cache(fixtures.Fixture):
"""A fixture for setting up and tearing down the cache between test cases.
"""A fixture for setting up the cache between test cases.
This will also tear down an existing cache if one is already configured.
"""
def setUp(self):

View File

@ -84,9 +84,7 @@ def _load_sqlalchemy_models():
class Database(fixtures.Fixture):
"""A fixture for setting up and tearing down a database.
"""
"""A fixture for setting up and tearing down a database."""
def __init__(self):
super(Database, self).__init__()

View File

@ -19,8 +19,7 @@ from keystone.tests.unit import fakeldap
class LDAPDatabase(fixtures.Fixture):
"""A fixture for setting up and tearing down an LDAP database.
"""
"""A fixture for setting up and tearing down an LDAP database."""
def setUp(self):
super(LDAPDatabase, self).setUp()

View File

@ -157,8 +157,7 @@ class BaseLDAPIdentity(test_backend.IdentityTests):
return None
def test_build_tree(self):
"""Regression test for building the tree names
"""
"""Regression test for building the tree names."""
user_api = identity.backends.ldap.UserApi(CONF)
self.assertTrue(user_api)
self.assertEqual("ou=Users,%s" % CONF.ldap.suffix, user_api.tree_dn)
@ -871,8 +870,7 @@ class BaseLDAPIdentity(test_backend.IdentityTests):
self.assertThat(ref_list, matchers.Equals([group]))
def test_user_id_comma_grants(self):
"""Even if the user has a , in their ID, can get user and group grants.
"""
"""List user and group grants, even with a comma in the user's ID."""
# Create a user with a , in their ID
# NOTE(blk-u): the DN for this user is hard-coded in fakeldap!

View File

@ -82,8 +82,7 @@ class LiveLDAPIdentity(test_backend_ldap.LDAPIdentity):
return config_files
def test_build_tree(self):
"""Regression test for building the tree names
"""
"""Regression test for building the tree names."""
# logic is different from the fake backend.
user_api = identity_ldap.UserApi(CONF)
self.assertTrue(user_api)

View File

@ -855,9 +855,7 @@ class VersionTests(SqlMigrateBase):
'idp_remote_ids table')
def test_unexpected_extension(self):
"""The version for an extension that doesn't exist raises ImportError.
"""
"""The version for a non-existent extension raises ImportError."""
extension_name = uuid.uuid4().hex
self.assertRaises(ImportError,
@ -865,9 +863,7 @@ class VersionTests(SqlMigrateBase):
extension=extension_name)
def test_unversioned_extension(self):
"""The version for extensions without migrations raise an exception.
"""
"""The version for extensions without migrations raise an exception."""
self.assertRaises(exception.MigrationNotProvided,
migration_helpers.get_db_version,

View File

@ -147,9 +147,7 @@ class RestfulTestCase(unit.SQLDriverOverrides, rest.RestfulTestCase,
pass
def setUp(self, app_conf='keystone'):
"""Setup for v3 Restful Test Cases.
"""
"""Setup for v3 Restful Test Cases."""
new_paste_file = self.generate_paste_config()
self.addCleanup(self.remove_generated_paste_config)
if new_paste_file:

View File

@ -767,7 +767,11 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
self.assertEqual(1, len(r.result['project']['parents']))
def test_get_project_with_parents_as_list_and_parents_as_ids(self):
"""Call ``GET /projects/{project_id}?parents_as_list&parents_as_ids``.
"""Attempt to list a project's parents as both a list and as IDs.
This uses ``GET /projects/{project_id}?parents_as_list&parents_as_ids``
which should fail with a Bad Request due to the conflicting query
strings.
"""
projects = self._create_projects_hierarchy(hierarchy_size=2)
@ -929,7 +933,11 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
self.assertEqual(1, len(r.result['project']['subtree']))
def test_get_project_with_subtree_as_list_and_subtree_as_ids(self):
"""Call ``GET /projects/{project_id}?subtree_as_list&subtree_as_ids``.
"""Attempt to get a project subtree as both a list and as IDs.
This uses ``GET /projects/{project_id}?subtree_as_list&subtree_as_ids``
which should fail with a bad request due to the conflicting query
strings.
"""
projects = self._create_projects_hierarchy(hierarchy_size=2)

View File

@ -115,8 +115,7 @@ class CatalogTestCase(test_v3.RestfulTestCase):
self.assertValidRegionResponse(r, ref)
def test_create_regions_with_same_description_string(self):
"""Call ``POST /regions`` with same description in the request bodies.
"""
"""Call ``POST /regions`` with duplicate descriptions."""
# NOTE(lbragstad): Make sure we can create two regions that have the
# same description.
ref1 = self.new_region_ref()
@ -134,8 +133,7 @@ class CatalogTestCase(test_v3.RestfulTestCase):
self.assertValidRegionResponse(resp2, ref2)
def test_create_regions_without_descriptions(self):
"""Call ``POST /regions`` with no description in the request bodies.
"""
"""Call ``POST /regions`` with no description."""
# NOTE(lbragstad): Make sure we can create two regions that have
# no description in the request body. The description should be
# populated by Catalog Manager.
@ -759,8 +757,7 @@ class CatalogTestCase(test_v3.RestfulTestCase):
self.post('/endpoints', body={'endpoint': ref})
def test_endpoint_create_with_invalid_url(self):
"""Test the invalid cases: substitutions is not exactly right.
"""
"""Test the invalid cases: substitutions is not exactly right."""
invalid_urls = [
# using a substitution that is not whitelisted - KeyError
'http://127.0.0.1:8774/v1.1/$(nonexistent)s',
@ -785,9 +782,7 @@ class CatalogTestCase(test_v3.RestfulTestCase):
class TestCatalogAPISQL(unit.TestCase):
"""Tests for the catalog Manager against the SQL backend.
"""
"""Tests for the catalog Manager against the SQL backend."""
def setUp(self):
super(TestCatalogAPISQL, self).setUp()
@ -893,9 +888,7 @@ class TestCatalogAPISQL(unit.TestCase):
# TODO(dstanek): this needs refactoring with the test above, but we are in a
# crunch so that will happen in a future patch.
class TestCatalogAPISQLRegions(unit.TestCase):
"""Tests for the catalog Manager against the SQL backend.
"""
"""Tests for the catalog Manager against the SQL backend."""
def setUp(self):
super(TestCatalogAPISQLRegions, self).setUp()

View File

@ -1321,8 +1321,7 @@ class EndpointGroupValidationTestCase(unit.BaseTestCase):
self.create_endpoint_grp_validator.validate(request_to_validate)
def test_validate_endpoint_group_create_succeeds_with_valid_filters(self):
"""Validate dict values as `filters` in endpoint group create requests.
"""
"""Validate `filters` in endpoint group create requests."""
request_to_validate = {'description': 'endpoint group description',
'name': 'endpoint_group_name'}
for valid_filters in _VALID_FILTERS:

View File

@ -354,8 +354,7 @@ class TokenDriverV8(object):
@abc.abstractmethod
def flush_expired_tokens(self):
"""Archive or delete tokens that have expired.
"""
"""Archive or delete tokens that have expired."""
raise exception.NotImplemented() # pragma: no cover

View File

@ -101,14 +101,13 @@ show-source = true
# D103: Missing docstring in public function
# D104: Missing docstring in public package
# D105: Missing docstring in magic method
# D200: One-line docstrings should fit on one line with quotes.
# D202: No blank lines allowed after docstring.
# D203: 1 blank required before class docstring.
# D204: 1 blank required after class docstring
# D205: Blank line required between one-line summary and description.
# D400: First line should end with a period.
# D401: First line should be in imperative mood.
ignore = H405,D100,D101,D102,D103,D104,D105,D200,D202,D203,D204,D205,D400,D401
ignore = H405,D100,D101,D102,D103,D104,D105,D202,D203,D204,D205,D400,D401
exclude=.venv,.git,.tox,build,dist,doc,*openstack/common*,*lib/python*,*egg,tools,vendor,.update-venv,*.ini,*.po,*.pot
max-complexity=24