pass on @abc.abstractmethods
Although a bare docstring is entirely valid grammar, those new to Python find that pattern baffling, *especially* when other similar methods contain pass statements. So, for consistency, add a pass statement to otherwise bare @abc.abstractmethods. Note that the implementation of an @abc.abstractmethod (in the abstract base class) can still be called by concrete children, so suddenly raising a NotImplementedError() instead might be "surprising" to implementors. A no-op such as "pass" or "return None" is preferable. Change-Id: I79969ad1a3429516ea785c649a165ead54944225
This commit is contained in:
@@ -184,6 +184,7 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
|
|||||||
:returns: Token access information.
|
:returns: Token access information.
|
||||||
:rtype: :py:class:`keystoneclient.access.AccessInfo`
|
:rtype: :py:class:`keystoneclient.access.AccessInfo`
|
||||||
"""
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def get_token(self, session, **kwargs):
|
def get_token(self, session, **kwargs):
|
||||||
"""Return a valid auth token.
|
"""Return a valid auth token.
|
||||||
|
@@ -103,6 +103,7 @@ class Auth(base.BaseIdentityPlugin):
|
|||||||
:return: A dict of authentication data for the auth type.
|
:return: A dict of authentication data for the auth type.
|
||||||
:rtype: dict
|
:rtype: dict
|
||||||
"""
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
_NOT_PASSED = object()
|
_NOT_PASSED = object()
|
||||||
|
@@ -240,6 +240,7 @@ class AuthMethod(object):
|
|||||||
data for the auth type.
|
data for the auth type.
|
||||||
:rtype: tuple(string, dict)
|
:rtype: tuple(string, dict)
|
||||||
"""
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
|
@@ -204,8 +204,8 @@ class BaseAuthPlugin(object):
|
|||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def _do_authenticate(self, http_client):
|
def _do_authenticate(self, http_client):
|
||||||
"""Protected method for authentication.
|
"""Protected method for authentication."""
|
||||||
"""
|
pass
|
||||||
|
|
||||||
def sufficient_options(self):
|
def sufficient_options(self):
|
||||||
"""Check if all required options are present.
|
"""Check if all required options are present.
|
||||||
@@ -232,3 +232,4 @@ class BaseAuthPlugin(object):
|
|||||||
:returns: tuple of token and endpoint strings
|
:returns: tuple of token and endpoint strings
|
||||||
:raises: EndpointException
|
:raises: EndpointException
|
||||||
"""
|
"""
|
||||||
|
pass
|
||||||
|
@@ -110,6 +110,7 @@ class ServiceCatalog(object):
|
|||||||
:returns: True if the provided endpoint matches the required
|
:returns: True if the provided endpoint matches the required
|
||||||
endpoint_type otherwise False.
|
endpoint_type otherwise False.
|
||||||
"""
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def _normalize_endpoint_type(self, endpoint_type):
|
def _normalize_endpoint_type(self, endpoint_type):
|
||||||
@@ -122,6 +123,7 @@ class ServiceCatalog(object):
|
|||||||
:returns: the endpoint string in the format appropriate for this
|
:returns: the endpoint string in the format appropriate for this
|
||||||
service catalog.
|
service catalog.
|
||||||
"""
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def get_endpoints(self, service_type=None, endpoint_type=None,
|
def get_endpoints(self, service_type=None, endpoint_type=None,
|
||||||
region_name=None, service_name=None):
|
region_name=None, service_name=None):
|
||||||
|
@@ -55,6 +55,7 @@ class CommonIdentityTests(object):
|
|||||||
It doesn't really matter what auth mechanism is used but it should be
|
It doesn't really matter what auth mechanism is used but it should be
|
||||||
appropriate to the API version.
|
appropriate to the API version.
|
||||||
"""
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def get_auth_data(self, **kwargs):
|
def get_auth_data(self, **kwargs):
|
||||||
@@ -63,6 +64,7 @@ class CommonIdentityTests(object):
|
|||||||
This should register a valid token response and ensure that the compute
|
This should register a valid token response and ensure that the compute
|
||||||
endpoints are set to TEST_COMPUTE_PUBLIC, _INTERNAL and _ADMIN.
|
endpoints are set to TEST_COMPUTE_PUBLIC, _INTERNAL and _ADMIN.
|
||||||
"""
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def stub_auth_data(self, **kwargs):
|
def stub_auth_data(self, **kwargs):
|
||||||
token = self.get_auth_data(**kwargs)
|
token = self.get_auth_data(**kwargs)
|
||||||
|
Reference in New Issue
Block a user