diff --git a/keystoneauth1/access/access.py b/keystoneauth1/access/access.py index 73d9c732..e7ff207c 100644 --- a/keystoneauth1/access/access.py +++ b/keystoneauth1/access/access.py @@ -85,7 +85,7 @@ class AccessInfo(object): return self._service_catalog def will_expire_soon(self, stale_duration=STALE_TOKEN_DURATION): - """Determines if expiration is about to occur. + """Determine if expiration is about to occur. :returns: true if expiration is within the given duration :rtype: boolean @@ -98,7 +98,7 @@ class AccessInfo(object): return norm_expires < soon def has_service_catalog(self): - """Returns true if the auth token has a service catalog. + """Return true if the auth token has a service catalog. :returns: boolean """ @@ -106,7 +106,7 @@ class AccessInfo(object): @property def auth_token(self): - """Returns the token_id associated with the auth request. + """Return the token_id associated with the auth request. To be used in headers for authenticating OpenStack API requests. @@ -116,7 +116,7 @@ class AccessInfo(object): @property def expires(self): - """Returns the token expiration (as datetime object) + """Return the token expiration (as datetime object) :returns: datetime """ @@ -124,7 +124,7 @@ class AccessInfo(object): @property def issued(self): - """Returns the token issue time (as datetime object) + """Return the token issue time (as datetime object) :returns: datetime """ @@ -132,7 +132,7 @@ class AccessInfo(object): @property def username(self): - """Returns the username associated with the auth request. + """Return the username associated with the auth request. Follows the pattern defined in the V2 API of first looking for 'name', returning that if available, and falling back to 'username' if name @@ -144,7 +144,7 @@ class AccessInfo(object): @property def user_id(self): - """Returns the user id associated with the auth request. + """Return the user id associated with the auth request. :returns: str """ @@ -152,7 +152,7 @@ class AccessInfo(object): @property def user_domain_id(self): - """Returns the user's domain id associated with the auth request. + """Return the user's domain id associated with the auth request. :returns: str """ @@ -160,7 +160,7 @@ class AccessInfo(object): @property def user_domain_name(self): - """Returns the user's domain name associated with the auth request. + """Return the user's domain name associated with the auth request. :returns: str """ @@ -168,7 +168,7 @@ class AccessInfo(object): @property def role_ids(self): - """Returns a list of user's role ids associated with the auth request. + """Return a list of user's role ids associated with the auth request. :returns: a list of strings of role ids """ @@ -176,7 +176,7 @@ class AccessInfo(object): @property def role_names(self): - """Returns a list of user's role names associated with the auth request. + """Return a list of user's role names associated with the auth request. :returns: a list of strings of role names """ @@ -184,7 +184,7 @@ class AccessInfo(object): @property def domain_name(self): - """Returns the domain name associated with the auth request. + """Return the domain name associated with the auth request. :returns: str or None (if no domain associated with the token) """ @@ -192,7 +192,7 @@ class AccessInfo(object): @property def domain_id(self): - """Returns the domain id associated with the auth request. + """Return the domain id associated with the auth request. :returns: str or None (if no domain associated with the token) """ @@ -200,7 +200,7 @@ class AccessInfo(object): @property def project_name(self): - """Returns the project name associated with the auth request. + """Return the project name associated with the auth request. :returns: str or None (if no project associated with the token) """ @@ -213,7 +213,7 @@ class AccessInfo(object): @property def scoped(self): - """Returns true if the auth token was scoped. + """Return true if the auth token was scoped. Returns true if scoped to a tenant(project) or domain, and contains a populated service catalog. @@ -226,7 +226,7 @@ class AccessInfo(object): @property def project_scoped(self): - """Returns true if the auth token was scoped to a tenant(project). + """Return true if the auth token was scoped to a tenant (project). :returns: bool """ @@ -234,7 +234,7 @@ class AccessInfo(object): @property def domain_scoped(self): - """Returns true if the auth token was scoped to a domain. + """Return true if the auth token was scoped to a domain. :returns: bool """ @@ -242,7 +242,7 @@ class AccessInfo(object): @property def trust_id(self): - """Returns the trust id associated with the auth request. + """Return the trust id associated with the auth request. :returns: str or None (if no trust associated with the token) """ @@ -250,7 +250,7 @@ class AccessInfo(object): @property def trust_scoped(self): - """Returns true if the auth token was scoped from a delegated trust. + """Return true if the auth token was scoped from a delegated trust. The trust delegation is via the OS-TRUST v3 extension. @@ -260,7 +260,7 @@ class AccessInfo(object): @property def trustee_user_id(self): - """Returns the trustee user id associated with a trust. + """Return the trustee user id associated with a trust. :returns: str or None (if no trust associated with the token) """ @@ -268,7 +268,7 @@ class AccessInfo(object): @property def trustor_user_id(self): - """Returns the trustor user id associated with a trust. + """Return the trustor user id associated with a trust. :returns: str or None (if no trust associated with the token) """ @@ -276,7 +276,7 @@ class AccessInfo(object): @property def project_id(self): - """Returns the project ID associated with the auth request. + """Return the project ID associated with the auth request. This returns None if the auth token wasn't scoped to a project. @@ -291,7 +291,7 @@ class AccessInfo(object): @property def project_domain_id(self): - """Returns the project's domain id associated with the auth request. + """Return the project's domain id associated with the auth request. :returns: str """ @@ -299,7 +299,7 @@ class AccessInfo(object): @property def project_domain_name(self): - """Returns the project's domain name associated with the auth request. + """Return the project's domain name associated with the auth request. :returns: str """ @@ -323,7 +323,7 @@ class AccessInfo(object): @property def is_federated(self): - """Returns true if federation was used to get the token. + """Return true if federation was used to get the token. :returns: boolean """ diff --git a/keystoneauth1/discover.py b/keystoneauth1/discover.py index b60a198f..ecde40e6 100644 --- a/keystoneauth1/discover.py +++ b/keystoneauth1/discover.py @@ -327,7 +327,7 @@ def _get_catalog_discover_hack(service_type, url): def add_catalog_discover_hack(service_type, old, new): - """Adds a version removal rule for a particular service. + """Add a version removal rule for a particular service. Originally deployments of OpenStack would contain a versioned endpoint in the catalog for different services. E.g. an identity service might look diff --git a/keystoneauth1/exceptions/http.py b/keystoneauth1/exceptions/http.py index 5b6da50e..eb842fd3 100644 --- a/keystoneauth1/exceptions/http.py +++ b/keystoneauth1/exceptions/http.py @@ -360,7 +360,7 @@ _code_map = dict( def from_response(response, method, url): - """Returns an instance of :class:`HttpError` or subclass based on response. + """Return an instance of :class:`HttpError` or subclass based on response. :param response: instance of `requests.Response` class :param method: HTTP method used for request diff --git a/keystoneauth1/identity/generic/base.py b/keystoneauth1/identity/generic/base.py index 260c7721..fb20e1da 100644 --- a/keystoneauth1/identity/generic/base.py +++ b/keystoneauth1/identity/generic/base.py @@ -90,14 +90,14 @@ class BaseGenericPlugin(base.BaseIdentityPlugin): @property def _v2_params(self): - """Parameters that are common to v2 plugins.""" + """Return the parameters that are common to v2 plugins.""" return {'trust_id': self._trust_id, 'tenant_id': self._project_id, 'tenant_name': self._project_name} @property def _v3_params(self): - """Parameters that are common to v3 plugins.""" + """Return the parameters that are common to v3 plugins.""" pr_domain_id = self._project_domain_id or self._default_domain_id pr_domain_name = self._project_domain_name or self._default_domain_name diff --git a/keystoneauth1/identity/v2.py b/keystoneauth1/identity/v2.py index e6ca4454..8fc96722 100644 --- a/keystoneauth1/identity/v2.py +++ b/keystoneauth1/identity/v2.py @@ -86,7 +86,7 @@ class Auth(base.BaseIdentityPlugin): @property def has_scope_parameters(self): - """Does the plugin have parameters that will create a scoped token""" + """Return true if parameters can be used to create a scoped token""" return self.tenant_id or self.tenant_name or self.trust_id diff --git a/keystoneauth1/identity/v3/base.py b/keystoneauth1/identity/v3/base.py index 772c59a2..3c0431de 100644 --- a/keystoneauth1/identity/v3/base.py +++ b/keystoneauth1/identity/v3/base.py @@ -77,7 +77,7 @@ class BaseAuth(base.BaseIdentityPlugin): @property def has_scope_parameters(self): - """Does the plugin have parameters that will create a scoped token""" + """Return true if parameters can be used to create a scoped token""" return (self.domain_id or self.domain_name or self.project_id or self.project_name or self.trust_id) diff --git a/keystoneauth1/session.py b/keystoneauth1/session.py index 40974d90..1b4ff0ee 100644 --- a/keystoneauth1/session.py +++ b/keystoneauth1/session.py @@ -198,7 +198,7 @@ class Session(object): @staticmethod def _process_header(header): - """Redacts the secure headers to be logged.""" + """Redact the secure headers to be logged.""" secure_headers = ('authorization', 'x-auth-token', 'x-subject-token',) if header[0].lower() in secure_headers: diff --git a/keystoneauth1/tests/unit/matchers.py b/keystoneauth1/tests/unit/matchers.py index 01c98779..b442d74b 100644 --- a/keystoneauth1/tests/unit/matchers.py +++ b/keystoneauth1/tests/unit/matchers.py @@ -29,7 +29,7 @@ class XMLEquals(object): def match(self, other): def xml_element_equals(expected_doc, observed_doc): - """Tests whether two XML documents are equivalent. + """Test whether two XML documents are equivalent. This is a recursive algorithm that operates on each element in the hierarchy. Siblings are sorted before being checked to diff --git a/tox.ini b/tox.ini index de6b74a3..b618ca16 100644 --- a/tox.ini +++ b/tox.ini @@ -44,8 +44,7 @@ commands = oslo_debug_helper -t keystoneauth1/tests {posargs} # 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. -# D401: First line should be in imperative mood. -ignore = H405,D100,D101,D102,D103,D104,D105,D200,D203,D204,D205,D208,D211,D301,D400,D401 +ignore = H405,D100,D101,D102,D103,D104,D105,D200,D203,D204,D205,D208,D211,D301,D400 show-source = True exclude = .venv,.tox,dist,doc,*egg,build,*openstack/common*