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
This commit is contained in:
Navid Pustchi
2016-04-23 06:48:46 +00:00
parent 946e928b52
commit 20e23f3e0d
21 changed files with 37 additions and 33 deletions

View File

@@ -153,7 +153,7 @@ class AccessInfo(dict):
@property @property
def expires(self): def expires(self):
"""Return the token expiration (as datetime object) """Return the token expiration (as datetime object).
:returns: datetime :returns: datetime
""" """
@@ -161,7 +161,7 @@ class AccessInfo(dict):
@property @property
def issued(self): def issued(self):
"""Return the token issue time (as datetime object) """Return the token issue time (as datetime object).
:returns: datetime :returns: datetime
""" """

View File

@@ -351,7 +351,7 @@ class BaseAuthPlugin(object):
@classmethod @classmethod
def load_from_options_getter(cls, getter, **kwargs): 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 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 specify a custom loader function that will be queried for the option

View File

@@ -27,7 +27,9 @@ class FederatedBaseAuth(base.BaseAuth):
rescoping_plugin = token.Token rescoping_plugin = token.Token
def __init__(self, auth_url, identity_provider, protocol, **kwargs): 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 :param auth_url: URL of the Identity Service
:type auth_url: string :type auth_url: string

View File

@@ -202,7 +202,7 @@ def cms_verify(formatted, signing_cert_file_name, ca_file_name,
def is_pkiz(token_text): 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 Checks if the string has the prefix that indicates it is a
Crypto Message Syntax, Z compressed token. Crypto Message Syntax, Z compressed token.

View File

@@ -47,7 +47,9 @@ class OidcPassword(federated.FederatedBaseAuth):
username, password, client_id, client_secret, username, password, client_id, client_secret,
access_token_endpoint, scope='profile', access_token_endpoint, scope='profile',
grant_type='password'): 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 :param auth_url: URL of the Identity Service
:type auth_url: string :type auth_url: string

View File

@@ -94,7 +94,7 @@ def attr_keys(event):
class RevokeTree(object): class RevokeTree(object):
"""Fast Revocation Checking Tree Structure """Fast Revocation Checking Tree Structure.
The Tree is an index to quickly match tokens against events. The Tree is an index to quickly match tokens against events.
Each node is a hashtable of key=value combinations from revocation events. Each node is a hashtable of key=value combinations from revocation events.
@@ -127,7 +127,7 @@ class RevokeTree(object):
return event return event
def remove_event(self, 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. 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 []) return map(self.add_event, revoke_events or [])
def is_revoked(self, token_data): 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 Compare the values for each level of the tree with the values from
the token, accounting for attributes that have alternative the token, accounting for attributes that have alternative

View File

@@ -11,9 +11,10 @@
# under the License. # under the License.
""" """
The generators in this directory produce keystone compliant structures for use Produce keystone compliant structures for testing.
in 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 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 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 imported into the main client (keystoneclient or other). Because of this there

View File

@@ -147,7 +147,7 @@ class _KeystoneAdapter(adapter.LegacyJsonAdapter):
class HTTPClient(baseclient.Client, base.BaseAuthPlugin): class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
"""HTTP client """HTTP client.
.. warning:: .. warning::

View File

@@ -20,7 +20,7 @@ OPENSTACK_CLOUDS = ('functional_admin', 'devstack-admin', 'envvars')
def get_client(version): 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 The client is instantiated via os-client-config either based on a
clouds.yaml config file or from the environment variables. clouds.yaml config file or from the environment variables.

View File

@@ -144,7 +144,7 @@ class SessionTests(utils.TestCase):
session.get, self.TEST_URL) session.get, self.TEST_URL)
def test_session_debug_output(self): 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. in order to redact secure headers while debug is true.
""" """
@@ -179,7 +179,7 @@ class SessionTests(utils.TestCase):
self.assertNotIn(v, self.logger.output) self.assertNotIn(v, self.logger.output)
def test_logs_failed_output(self): 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() session = client_session.Session()
body = uuid.uuid4().hex body = uuid.uuid4().hex

View File

@@ -102,7 +102,7 @@ class TestCase(testtools.TestCase):
self.assertIn(v, qs[k]) self.assertIn(v, qs[k])
def assertRequestHeaderEqual(self, name, val): 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. The request must have already been made.
""" """

View File

@@ -166,7 +166,7 @@ class ProtocolTests(utils.ClientTestCase, utils.CrudTests):
self.assertEqual('/'.join([base_url, self.collection_key]), url) self.assertEqual('/'.join([base_url, self.collection_key]), url)
def test_build_url_w_idp_id(self): 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 This test shows, that when ``base_url`` is specified in the
dict_args_in_out dictionary, values like ``identity_provider_id`` dict_args_in_out dictionary, values like ``identity_provider_id``
@@ -299,7 +299,7 @@ class ProtocolTests(utils.ClientTestCase, utils.CrudTests):
self.assertQueryStringContains(**filter_kwargs) self.assertQueryStringContains(**filter_kwargs)
def test_update(self): def test_update(self):
"""Test updating federation protocol """Test updating federation protocol.
URL to be tested: PATCH /OS-FEDERATION/identity_providers/ URL to be tested: PATCH /OS-FEDERATION/identity_providers/
$identity_provider/protocols/$protocol $identity_provider/protocols/$protocol

View File

@@ -84,7 +84,7 @@ def hash_signed_token(signed_text, mode='md5'):
def prompt_user_password(): def prompt_user_password():
"""Prompt user for a password """Prompt user for a password.
Prompt for a password if stdin is a tty. Prompt for a password if stdin is a tty.
""" """

View File

@@ -23,7 +23,7 @@ from keystoneclient import exceptions
class Tenant(base.Resource): class Tenant(base.Resource):
"""Represents a Keystone tenant """Represents a Keystone tenant.
Attributes: Attributes:
* id: a uuid that identifies the tenant * id: a uuid that identifies the tenant

View File

@@ -16,7 +16,7 @@ from keystoneclient import base
class IdentityProvider(base.Resource): class IdentityProvider(base.Resource):
"""Object representing Identity Provider container """Object representing Identity Provider container.
Attributes: Attributes:
* id: user-defined unique string identifying Identity Provider. * id: user-defined unique string identifying Identity Provider.
@@ -53,7 +53,7 @@ class IdentityProviderManager(base.CrudManager):
**kwargs) **kwargs)
def get(self, identity_provider): def get(self, identity_provider):
"""Fetch Identity Provider object """Fetch Identity Provider object.
Utilize Keystone URI: Utilize Keystone URI:
GET /OS-FEDERATION/identity_providers/$identity_provider GET /OS-FEDERATION/identity_providers/$identity_provider

View File

@@ -16,7 +16,7 @@ from keystoneclient import base
class Mapping(base.Resource): class Mapping(base.Resource):
"""An object representing mapping container """An object representing mapping container.
Attributes: Attributes:
* id: user defined unique string identifying mapping. * id: user defined unique string identifying mapping.

View File

@@ -16,7 +16,7 @@ from keystoneclient import base
class ServiceProvider(base.Resource): class ServiceProvider(base.Resource):
"""Object representing Service Provider container """Object representing Service Provider container.
Attributes: Attributes:
* id: user-defined unique string identifying Service Provider. * id: user-defined unique string identifying Service Provider.
@@ -55,7 +55,7 @@ class ServiceProviderManager(base.CrudManager):
**kwargs) **kwargs)
def get(self, service_provider): def get(self, service_provider):
"""Fetch Service Provider object """Fetch Service Provider object.
Utilize Keystone URI: Utilize Keystone URI:
``GET /OS-FEDERATION/service_providers/{id}`` ``GET /OS-FEDERATION/service_providers/{id}``

View File

@@ -19,7 +19,7 @@ OAUTH_PATH = '/OS-OAUTH1'
def get_oauth_token_from_body(body): 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: The response body will look like:
'oauth_token=12345&oauth_token_secret=67890' with 'oauth_token=12345&oauth_token_secret=67890' with

View File

@@ -57,7 +57,7 @@ class CredentialManager(base.CrudManager):
removal_version='2.0.0') removal_version='2.0.0')
@positional(1, enforcement=positional.WARN) @positional(1, enforcement=positional.WARN)
def create(self, user, type, blob=None, data=None, project=None, **kwargs): def create(self, user, type, blob=None, data=None, project=None, **kwargs):
"""Create a credential """Create a credential.
:param user: User :param user: User
:type user: :class:`keystoneclient.v3.users.User` or str :type user: :class:`keystoneclient.v3.users.User` or str
@@ -80,7 +80,7 @@ class CredentialManager(base.CrudManager):
**kwargs) **kwargs)
def get(self, credential): def get(self, credential):
"""Get a credential """Get a credential.
:param credential: Credential :param credential: Credential
:type credential: :class:`Credential` or str :type credential: :class:`Credential` or str
@@ -102,7 +102,7 @@ class CredentialManager(base.CrudManager):
@positional(2, enforcement=positional.WARN) @positional(2, enforcement=positional.WARN)
def update(self, credential, user, type=None, blob=None, data=None, def update(self, credential, user, type=None, blob=None, data=None,
project=None, **kwargs): project=None, **kwargs):
"""Update a credential """Update a credential.
:param credential: Credential to update :param credential: Credential to update
:type credential: :class:`Credential` or str :type credential: :class:`Credential` or str
@@ -128,7 +128,7 @@ class CredentialManager(base.CrudManager):
**kwargs) **kwargs)
def delete(self, credential): def delete(self, credential):
"""Delete a credential """Delete a credential.
:param credential: Credential :param credential: Credential
:type credential: :class:`Credential` or str :type credential: :class:`Credential` or str

View File

@@ -34,7 +34,7 @@ class Role(base.Resource):
class InferenceRule(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: Attributes:
* prior_role: this role implies the other * prior_role: this role implies the other

View File

@@ -55,8 +55,7 @@ passenv = OS_*
# D208: Docstring is over-indented # D208: Docstring is over-indented
# D211: No blank lines allowed before class docstring # D211: No blank lines allowed before class docstring
# D301: Use r”“” if any backslashes in a 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
ignore = D100,D101,D102,D103,D104,D105,D200,D202,D203,D204,D205,D207,D208,D211,D301,D400
show-source = True show-source = True
exclude = .venv,.tox,dist,doc,*egg,build,*openstack/common* exclude = .venv,.tox,dist,doc,*egg,build,*openstack/common*