From 20e23f3e0dfb8853d39eedacd19f8c4f8a434fca Mon Sep 17 00:00:00 2001 From: Navid Pustchi Date: Sat, 23 Apr 2016 06:48:46 +0000 Subject: [PATCH] Fix D400 PEP257 violation. Currently tox ignores D400. D400: First line should end with a period. This change removes it and make keystoneclient docstrings compliant with it. Change-Id: I29ecb4c58bb03c0b9a3be0b7a74d18fb06a350f2 --- keystoneclient/access.py | 4 ++-- keystoneclient/auth/base.py | 2 +- keystoneclient/auth/identity/v3/federated.py | 4 +++- keystoneclient/common/cms.py | 2 +- keystoneclient/contrib/auth/v3/oidc.py | 4 +++- keystoneclient/contrib/revoke/model.py | 6 +++--- keystoneclient/fixture/__init__.py | 5 +++-- keystoneclient/httpclient.py | 2 +- keystoneclient/tests/functional/base.py | 2 +- keystoneclient/tests/unit/test_session.py | 4 ++-- keystoneclient/tests/unit/utils.py | 2 +- keystoneclient/tests/unit/v3/test_federation.py | 4 ++-- keystoneclient/utils.py | 2 +- keystoneclient/v2_0/tenants.py | 2 +- .../v3/contrib/federation/identity_providers.py | 4 ++-- keystoneclient/v3/contrib/federation/mappings.py | 2 +- keystoneclient/v3/contrib/federation/service_providers.py | 4 ++-- keystoneclient/v3/contrib/oauth1/utils.py | 2 +- keystoneclient/v3/credentials.py | 8 ++++---- keystoneclient/v3/roles.py | 2 +- tox.ini | 3 +-- 21 files changed, 37 insertions(+), 33 deletions(-) diff --git a/keystoneclient/access.py b/keystoneclient/access.py index 6f22a0861..5e0fe9601 100644 --- a/keystoneclient/access.py +++ b/keystoneclient/access.py @@ -153,7 +153,7 @@ class AccessInfo(dict): @property def expires(self): - """Return the token expiration (as datetime object) + """Return the token expiration (as datetime object). :returns: datetime """ @@ -161,7 +161,7 @@ class AccessInfo(dict): @property def issued(self): - """Return the token issue time (as datetime object) + """Return the token issue time (as datetime object). :returns: datetime """ diff --git a/keystoneclient/auth/base.py b/keystoneclient/auth/base.py index 138722241..a8dfc1311 100644 --- a/keystoneclient/auth/base.py +++ b/keystoneclient/auth/base.py @@ -351,7 +351,7 @@ class BaseAuthPlugin(object): @classmethod def load_from_options_getter(cls, getter, **kwargs): - """Load a plugin from a getter function that returns appropriate values + """Load a plugin from a getter function returning appropriate values. To handle cases other than the provided CONF and CLI loading you can specify a custom loader function that will be queried for the option diff --git a/keystoneclient/auth/identity/v3/federated.py b/keystoneclient/auth/identity/v3/federated.py index fbe086b47..97d83e8f9 100644 --- a/keystoneclient/auth/identity/v3/federated.py +++ b/keystoneclient/auth/identity/v3/federated.py @@ -27,7 +27,9 @@ class FederatedBaseAuth(base.BaseAuth): rescoping_plugin = token.Token def __init__(self, auth_url, identity_provider, protocol, **kwargs): - """Class constructor accepting following parameters: + """Class constructor for federated authentication plugins. + + Accepting following parameters: :param auth_url: URL of the Identity Service :type auth_url: string diff --git a/keystoneclient/common/cms.py b/keystoneclient/common/cms.py index 49876d3f9..89ee2895f 100644 --- a/keystoneclient/common/cms.py +++ b/keystoneclient/common/cms.py @@ -202,7 +202,7 @@ def cms_verify(formatted, signing_cert_file_name, ca_file_name, def is_pkiz(token_text): - """Determine if a token a cmsz token + """Determine if a token is PKIZ. Checks if the string has the prefix that indicates it is a Crypto Message Syntax, Z compressed token. diff --git a/keystoneclient/contrib/auth/v3/oidc.py b/keystoneclient/contrib/auth/v3/oidc.py index e2871ac83..fc3a35652 100644 --- a/keystoneclient/contrib/auth/v3/oidc.py +++ b/keystoneclient/contrib/auth/v3/oidc.py @@ -47,7 +47,9 @@ class OidcPassword(federated.FederatedBaseAuth): username, password, client_id, client_secret, access_token_endpoint, scope='profile', grant_type='password'): - """The OpenID Connect plugin expects the following: + """The OpenID Connect plugin. + + It expects the following: :param auth_url: URL of the Identity Service :type auth_url: string diff --git a/keystoneclient/contrib/revoke/model.py b/keystoneclient/contrib/revoke/model.py index 925847c29..914a1f4c2 100644 --- a/keystoneclient/contrib/revoke/model.py +++ b/keystoneclient/contrib/revoke/model.py @@ -94,7 +94,7 @@ def attr_keys(event): class RevokeTree(object): - """Fast Revocation Checking Tree Structure + """Fast Revocation Checking Tree Structure. The Tree is an index to quickly match tokens against events. Each node is a hashtable of key=value combinations from revocation events. @@ -127,7 +127,7 @@ class RevokeTree(object): return event def remove_event(self, event): - """Update the tree based on the removal of a Revocation Event + """Update the tree based on the removal of a Revocation Event. Removes empty nodes from the tree from the leaf back to the root. @@ -158,7 +158,7 @@ class RevokeTree(object): return map(self.add_event, revoke_events or []) def is_revoked(self, token_data): - """Check if a token matches the revocation event + """Check if a token is revoked. Compare the values for each level of the tree with the values from the token, accounting for attributes that have alternative diff --git a/keystoneclient/fixture/__init__.py b/keystoneclient/fixture/__init__.py index 9e4de4b64..158ad18c9 100644 --- a/keystoneclient/fixture/__init__.py +++ b/keystoneclient/fixture/__init__.py @@ -11,9 +11,10 @@ # under the License. """ -The generators in this directory produce keystone compliant structures for use -in testing. +Produce keystone compliant structures for testing. +The generators in this directory produce keystone compliant structures for +use in testing. They should be considered part of the public API because they may be relied upon to generate test tokens for other clients. However they should never be imported into the main client (keystoneclient or other). Because of this there diff --git a/keystoneclient/httpclient.py b/keystoneclient/httpclient.py index f56f130e3..59d5af4dc 100644 --- a/keystoneclient/httpclient.py +++ b/keystoneclient/httpclient.py @@ -147,7 +147,7 @@ class _KeystoneAdapter(adapter.LegacyJsonAdapter): class HTTPClient(baseclient.Client, base.BaseAuthPlugin): - """HTTP client + """HTTP client. .. warning:: diff --git a/keystoneclient/tests/functional/base.py b/keystoneclient/tests/functional/base.py index f3b883727..c0eeae195 100644 --- a/keystoneclient/tests/functional/base.py +++ b/keystoneclient/tests/functional/base.py @@ -20,7 +20,7 @@ OPENSTACK_CLOUDS = ('functional_admin', 'devstack-admin', 'envvars') def get_client(version): - """Create a keystoneclient instance to run functional tests + """Create a keystoneclient instance to run functional tests. The client is instantiated via os-client-config either based on a clouds.yaml config file or from the environment variables. diff --git a/keystoneclient/tests/unit/test_session.py b/keystoneclient/tests/unit/test_session.py index b72a1858c..8c72be50f 100644 --- a/keystoneclient/tests/unit/test_session.py +++ b/keystoneclient/tests/unit/test_session.py @@ -144,7 +144,7 @@ class SessionTests(utils.TestCase): session.get, self.TEST_URL) def test_session_debug_output(self): - """Test request and response headers in debug logs + """Test request and response headers in debug logs. in order to redact secure headers while debug is true. """ @@ -179,7 +179,7 @@ class SessionTests(utils.TestCase): self.assertNotIn(v, self.logger.output) def test_logs_failed_output(self): - """Test that output is logged even for failed requests""" + """Test that output is logged even for failed requests.""" session = client_session.Session() body = uuid.uuid4().hex diff --git a/keystoneclient/tests/unit/utils.py b/keystoneclient/tests/unit/utils.py index 6e313a49b..ffed85959 100644 --- a/keystoneclient/tests/unit/utils.py +++ b/keystoneclient/tests/unit/utils.py @@ -102,7 +102,7 @@ class TestCase(testtools.TestCase): self.assertIn(v, qs[k]) def assertRequestHeaderEqual(self, name, val): - """Verify that the last request made contains a header and its value + """Verify that the last request made contains a header and its value. The request must have already been made. """ diff --git a/keystoneclient/tests/unit/v3/test_federation.py b/keystoneclient/tests/unit/v3/test_federation.py index bf6bca9c7..22ae50935 100644 --- a/keystoneclient/tests/unit/v3/test_federation.py +++ b/keystoneclient/tests/unit/v3/test_federation.py @@ -166,7 +166,7 @@ class ProtocolTests(utils.ClientTestCase, utils.CrudTests): self.assertEqual('/'.join([base_url, self.collection_key]), url) def test_build_url_w_idp_id(self): - """Test whether kwargs ``base_url`` discards object's base_url + """Test whether kwargs ``base_url`` discards object's base_url. This test shows, that when ``base_url`` is specified in the dict_args_in_out dictionary, values like ``identity_provider_id`` @@ -299,7 +299,7 @@ class ProtocolTests(utils.ClientTestCase, utils.CrudTests): self.assertQueryStringContains(**filter_kwargs) def test_update(self): - """Test updating federation protocol + """Test updating federation protocol. URL to be tested: PATCH /OS-FEDERATION/identity_providers/ $identity_provider/protocols/$protocol diff --git a/keystoneclient/utils.py b/keystoneclient/utils.py index c20aa96a8..d15072cd6 100644 --- a/keystoneclient/utils.py +++ b/keystoneclient/utils.py @@ -84,7 +84,7 @@ def hash_signed_token(signed_text, mode='md5'): def prompt_user_password(): - """Prompt user for a password + """Prompt user for a password. Prompt for a password if stdin is a tty. """ diff --git a/keystoneclient/v2_0/tenants.py b/keystoneclient/v2_0/tenants.py index b222fa45c..2c95ae15b 100644 --- a/keystoneclient/v2_0/tenants.py +++ b/keystoneclient/v2_0/tenants.py @@ -23,7 +23,7 @@ from keystoneclient import exceptions class Tenant(base.Resource): - """Represents a Keystone tenant + """Represents a Keystone tenant. Attributes: * id: a uuid that identifies the tenant diff --git a/keystoneclient/v3/contrib/federation/identity_providers.py b/keystoneclient/v3/contrib/federation/identity_providers.py index d93064f90..349317dbe 100644 --- a/keystoneclient/v3/contrib/federation/identity_providers.py +++ b/keystoneclient/v3/contrib/federation/identity_providers.py @@ -16,7 +16,7 @@ from keystoneclient import base class IdentityProvider(base.Resource): - """Object representing Identity Provider container + """Object representing Identity Provider container. Attributes: * id: user-defined unique string identifying Identity Provider. @@ -53,7 +53,7 @@ class IdentityProviderManager(base.CrudManager): **kwargs) def get(self, identity_provider): - """Fetch Identity Provider object + """Fetch Identity Provider object. Utilize Keystone URI: GET /OS-FEDERATION/identity_providers/$identity_provider diff --git a/keystoneclient/v3/contrib/federation/mappings.py b/keystoneclient/v3/contrib/federation/mappings.py index d047e7572..7e8293139 100644 --- a/keystoneclient/v3/contrib/federation/mappings.py +++ b/keystoneclient/v3/contrib/federation/mappings.py @@ -16,7 +16,7 @@ from keystoneclient import base class Mapping(base.Resource): - """An object representing mapping container + """An object representing mapping container. Attributes: * id: user defined unique string identifying mapping. diff --git a/keystoneclient/v3/contrib/federation/service_providers.py b/keystoneclient/v3/contrib/federation/service_providers.py index 81b581b40..17d458f01 100644 --- a/keystoneclient/v3/contrib/federation/service_providers.py +++ b/keystoneclient/v3/contrib/federation/service_providers.py @@ -16,7 +16,7 @@ from keystoneclient import base class ServiceProvider(base.Resource): - """Object representing Service Provider container + """Object representing Service Provider container. Attributes: * id: user-defined unique string identifying Service Provider. @@ -55,7 +55,7 @@ class ServiceProviderManager(base.CrudManager): **kwargs) def get(self, service_provider): - """Fetch Service Provider object + """Fetch Service Provider object. Utilize Keystone URI: ``GET /OS-FEDERATION/service_providers/{id}`` diff --git a/keystoneclient/v3/contrib/oauth1/utils.py b/keystoneclient/v3/contrib/oauth1/utils.py index bf741ab4e..3a68794b4 100644 --- a/keystoneclient/v3/contrib/oauth1/utils.py +++ b/keystoneclient/v3/contrib/oauth1/utils.py @@ -19,7 +19,7 @@ OAUTH_PATH = '/OS-OAUTH1' def get_oauth_token_from_body(body): - """Parse the URL response body to retrieve the oauth token key and secret + """Parse the URL response body to retrieve the oauth token key and secret. The response body will look like: 'oauth_token=12345&oauth_token_secret=67890' with diff --git a/keystoneclient/v3/credentials.py b/keystoneclient/v3/credentials.py index b4b3e7622..14e891eab 100644 --- a/keystoneclient/v3/credentials.py +++ b/keystoneclient/v3/credentials.py @@ -57,7 +57,7 @@ class CredentialManager(base.CrudManager): removal_version='2.0.0') @positional(1, enforcement=positional.WARN) def create(self, user, type, blob=None, data=None, project=None, **kwargs): - """Create a credential + """Create a credential. :param user: User :type user: :class:`keystoneclient.v3.users.User` or str @@ -80,7 +80,7 @@ class CredentialManager(base.CrudManager): **kwargs) def get(self, credential): - """Get a credential + """Get a credential. :param credential: Credential :type credential: :class:`Credential` or str @@ -102,7 +102,7 @@ class CredentialManager(base.CrudManager): @positional(2, enforcement=positional.WARN) def update(self, credential, user, type=None, blob=None, data=None, project=None, **kwargs): - """Update a credential + """Update a credential. :param credential: Credential to update :type credential: :class:`Credential` or str @@ -128,7 +128,7 @@ class CredentialManager(base.CrudManager): **kwargs) def delete(self, credential): - """Delete a credential + """Delete a credential. :param credential: Credential :type credential: :class:`Credential` or str diff --git a/keystoneclient/v3/roles.py b/keystoneclient/v3/roles.py index 92185ec99..bb77e3b5e 100644 --- a/keystoneclient/v3/roles.py +++ b/keystoneclient/v3/roles.py @@ -34,7 +34,7 @@ class Role(base.Resource): class InferenceRule(base.Resource): - """Represents an Rule that states one ROle implies another + """Represents an Rule that states one ROle implies another. Attributes: * prior_role: this role implies the other diff --git a/tox.ini b/tox.ini index 11e80b720..9152b11e4 100644 --- a/tox.ini +++ b/tox.ini @@ -55,8 +55,7 @@ passenv = OS_* # D208: Docstring is over-indented # D211: No blank lines allowed before class docstring # D301: Use r”“” if any backslashes in a docstring -# D400: First line should end with a period. -ignore = D100,D101,D102,D103,D104,D105,D200,D202,D203,D204,D205,D207,D208,D211,D301,D400 +ignore = D100,D101,D102,D103,D104,D105,D200,D202,D203,D204,D205,D207,D208,D211,D301 show-source = True exclude = .venv,.tox,dist,doc,*egg,build,*openstack/common*