Fix H405 and E131 ignored pep8 rules

Updated tox.ini and fixed rules.

Fix H405:
Multi line docstring summary not separated with an empty line
Fix E131:
Continuation line unaligned for hanging indent

Change-Id: I20cf75c75cffc434fbdcb05b8e04bffcd4059cd1
Closes-Bug: #1498870
changes/83/224183/3
Tom Cammann 7 years ago
parent dbd6a8d1d2
commit bdf880d8fa
  1. 2
      magnum/api/controllers/v1/__init__.py
  2. 1
      magnum/api/hooks.py
  3. 1
      magnum/common/k8s_manifest.py
  4. 1
      magnum/common/policy.py
  5. 1
      magnum/conductor/bay_lock.py
  6. 8
      magnum/conductor/handlers/ca_conductor.py
  7. 10
      magnum/conductor/handlers/conductor_listener.py
  8. 8
      magnum/conductor/handlers/k8s_conductor.py
  9. 8
      magnum/conductor/handlers/x509keypair_conductor.py
  10. 20
      magnum/conductor/template_definition.py
  11. 1
      magnum/objects/base.py
  12. 16
      magnum/objects/replicationcontroller.py
  13. 1
      magnum/objects/service.py
  14. 10
      magnum/objects/x509keypair.py
  15. 3
      magnum/tests/functional/common/client.py
  16. 7
      magnum/tests/unit/api/base.py
  17. 8
      magnum/tests/unit/db/utils.py
  18. 4
      magnum/tests/unit/test_hacking.py
  19. 4
      tox.ini

@ -60,7 +60,7 @@ MIN_VER = controllers_base.Version(
{controllers_base.Version.string: MIN_VER_STR}, MIN_VER_STR, MAX_VER_STR)
MAX_VER = controllers_base.Version(
{controllers_base.Version.string: MAX_VER_STR},
MIN_VER_STR, MAX_VER_STR)
MIN_VER_STR, MAX_VER_STR)
class MediaType(controllers_base.APIBase):

@ -86,6 +86,7 @@ class RPCHook(hooks.PecanHook):
class NoExceptionTracebackHook(hooks.PecanHook):
"""Workaround rpc.common: deserialize_remote_exception.
deserialize_remote_exception builds rpc exception traceback into error
message which is then sent to the client. Such behavior is a security
concern so this hook is aimed to cut-off traceback from the error message.

@ -33,6 +33,7 @@ def _construct_yaml_str(self, node):
def parse(manifest_str):
'''Takes a string and returns a dict containing the parsed structure.
This includes determination of whether the string is using the
JSON or YAML format.
'''

@ -96,6 +96,7 @@ def enforce(context, action=None, target=None,
# decorator) on an API method for it to work correctly
def enforce_wsgi(api_name, act=None):
"""This is a decorator to simplify wsgi action policy rule check.
:param api_name: The collection name to be evaluate.
:param act: The function name of wsgi action.

@ -117,6 +117,7 @@ class BayLock(object):
@contextlib.contextmanager
def thread_lock(self, bay_uuid):
"""Acquire a lock and release it only if there is an exception.
The release method still needs to be scheduled to be run at the
end of the thread using the Thread.link method.
"""

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Magnum CA RPC handler."""
from oslo_log import log as logging
@ -22,9 +21,10 @@ LOG = logging.getLogger(__name__)
class Handler(object):
"""These are the backend operations. They are executed by the backend
service. API calls via AMQP (within the ReST API) trigger the
handlers to be called.
"""Magnum CA RPC handler.
These are the backend operations. They are executed by the backend service.
API calls via AMQP (within the ReST API) trigger the handlers to be called.
"""

@ -12,11 +12,15 @@
class Handler(object):
'''Listen on an AMQP queue named for the conductor. Allows individual
conductors to communicate with each other for multi-conductor support.
'''Listen on an AMQP queue named for the conductor.
Allows individual conductors to communicate with each other for
multi-conductor support.
'''
def ping_conductor(self, context):
'''Respond affirmatively to confirm that the conductor performing the
'''Respond to conductor.
Respond affirmatively to confirm that the conductor performing the
action is still alive.
'''
return True

@ -10,7 +10,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Magnum Kubernetes RPC handler."""
from oslo_log import log as logging
@ -26,9 +25,10 @@ LOG = logging.getLogger(__name__)
class Handler(object):
"""These are the backend operations. They are executed by the backend
service. API calls via AMQP (within the ReST API) trigger the
handlers to be called.
"""Magnum Kubernetes RPC handler.
These are the backend operations. They are executed by the backend service.
API calls via AMQP (within the ReST API) trigger the handlers to be called.
"""

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Magnum X509KeyPair RPC handler."""
from oslo_log import log as logging
@ -22,9 +21,10 @@ LOG = logging.getLogger(__name__)
class Handler(object):
"""These are the backend operations. They are executed by the backend
service. API calls via AMQP (within the ReST API) trigger the
handlers to be called.
"""Magnum X509KeyPair RPC handler.
These are the backend operations. They are executed by the backend service.
API calls via AMQP (within the ReST API) trigger the handlers to be called.
"""

@ -82,7 +82,9 @@ cfg.CONF.register_opts(template_def_opts, group='bay')
class ParameterMapping(object):
"""A ParameterMapping is an association of a Heat parameter name with
"""A mapping associating heat param and bay/baymodel attr.
A ParameterMapping is an association of a Heat parameter name with
an attribute on a Bay, Baymodel, or both.
In the case of both baymodel_attr and bay_attr being set, the Baymodel
@ -120,7 +122,9 @@ class ParameterMapping(object):
class OutputMapping(object):
"""An OutputMapping is an association of a Heat output with a key
"""A mapping associating heat outputs and bay attr.
An OutputMapping is an association of a Heat output with a key
Magnum understands.
"""
@ -150,7 +154,9 @@ class OutputMapping(object):
@six.add_metaclass(abc.ABCMeta)
class TemplateDefinition(object):
'''A TemplateDefinition is essentially a mapping between Magnum objects
'''A mapping between Magnum objects and Heat templates.
A TemplateDefinition is essentially a mapping between Magnum objects
and Heat templates. Each TemplateDefinition has a mapping of Heat
parameters.
'''
@ -215,7 +221,9 @@ class TemplateDefinition(object):
@classmethod
def get_template_definition(cls, server_type, os, coe):
'''Returns the enabled TemplateDefinition class for the provided
'''Get enabled TemplateDefinitions.
Returns the enabled TemplateDefinition class for the provided
bay_type.
With the following classes:
@ -300,7 +308,9 @@ class TemplateDefinition(object):
return template_params
def get_heat_param(self, bay_attr=None, baymodel_attr=None):
"""Returns stack param name using bay and baymodel attributes
"""Returns stack param name.
Return stack param name using bay and baymodel attributes
:param bay_attr bay attribute from which it maps to stack attribute
:param baymodel_attr baymodel attribute from which it maps
to stack attribute

@ -54,6 +54,7 @@ class MagnumObjectDictCompat(ovoo_base.VersionedObjectDictCompat):
class MagnumPersistentObject(object):
"""Mixin class for Persistent objects.
This adds the fields that we use in common for all persistent objects.
"""
fields = {

@ -63,7 +63,9 @@ class ReplicationController(base.MagnumPersistentObject, base.MagnumObject,
@base.remotable_classmethod
def get_by_id(cls, context, rc_id):
"""Find a ReplicationController based on its integer id and return a
"""Find a ReplicationController based on its integer id.
Find ReplicationController based on id and return a
ReplicationController object.
:param rc_id: the id of a ReplicationController.
@ -75,8 +77,10 @@ class ReplicationController(base.MagnumPersistentObject, base.MagnumObject,
@base.remotable_classmethod
def get_by_uuid(cls, context, uuid):
"""Find a ReplicationController based on uuid and return
a :class:`ReplicationController` object.
"""Find a ReplicationController based on uuid.
Find ReplicationController by uuid and return a
:class:`ReplicationController` object.
:param uuid: the uuid of a ReplicationController.
:param context: Security context
@ -88,8 +92,10 @@ class ReplicationController(base.MagnumPersistentObject, base.MagnumObject,
@base.remotable_classmethod
def get_by_name(cls, context, name):
"""Find a ReplicationController based on name and return
a :class:`ReplicationController` object.
"""Find a ReplicationController based on name.
Find ReplicationController by name and return a
:class:`ReplicationController` object.
:param name: the name of a ReplicationController.
:param context: Security context

@ -89,6 +89,7 @@ class Service(base.MagnumPersistentObject, base.MagnumObject,
@base.remotable_classmethod
def get_by_name(cls, context, name):
"""Find a service based on service name and
return a :class:`Service` object.
:param name: the name of a service.

@ -58,8 +58,9 @@ class X509KeyPair(base.MagnumPersistentObject, base.MagnumObject,
@base.remotable_classmethod
def get(cls, context, x509keypair_id):
"""Find a x509keypair_id based on its id or uuid and return a
X509KeyPair object.
"""Find a X509KeyPair based on its id or uuid.
Find X509KeyPair by id or uuid and return a X509KeyPair object.
:param x509keypair_id: the id *or* uuid of a x509keypair.
:returns: a :class:`X509KeyPair` object.
@ -73,8 +74,9 @@ class X509KeyPair(base.MagnumPersistentObject, base.MagnumObject,
@base.remotable_classmethod
def get_by_id(cls, context, x509keypair_id):
"""Find a x509keypair based on its integer id and return a
X509KeyPair object.
"""Find a X509KeyPair based on its integer id.
Find X509KeyPair by id and return a X509KeyPair object.
:param x509keypair_id: the id of a x509keypair.
:returns: a :class:`X509KeyPair` object.

@ -38,8 +38,7 @@ class BaseMagnumClient(rest_client.RestClient):
class MagnumClient(BaseMagnumClient):
"""Responsible for setting up auth provider for default user
"""
"""Responsible for setting up auth provider for default user"""
def get_auth_provider(self):
mgr = manager.Manager()

@ -12,7 +12,6 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Base classes for API tests."""
# NOTE: Ported from ceilometer/tests/api.py (subsequently moved to
# ceilometer/tests/api/__init__.py). This should be oslo'ified:
@ -33,8 +32,10 @@ PATH_PREFIX = '/v1'
class FunctionalTest(base.DbTestCase):
"""Used for functional tests of Pecan controllers where you need to
test your literal application and its integration with the
"""Base class for API tests.
Pecan controller test. Used for functional tests of Pecan controllers where
you need to test your literal application and its integration with the
framework.
"""

@ -58,6 +58,7 @@ def get_test_baymodel(**kw):
def create_test_baymodel(**kw):
"""Create test baymodel entry in DB and return BayModel DB object.
Function to be used to create test BayModel objects in the database.
:param kw: kwargs with overriding values for baymodel's attributes.
:returns: Test BayModel DB object.
@ -97,6 +98,7 @@ def get_test_bay(**kw):
def create_test_bay(**kw):
"""Create test bay entry in DB and return Bay DB object.
Function to be used to create test Bay objects in the database.
:param kw: kwargs with overriding values for bay's attributes.
:returns: Test Bay DB object.
@ -129,6 +131,7 @@ def get_test_pod(**kw):
def create_test_pod(**kw):
"""Create test pod entry in DB and return Pod DB object.
Function to be used to create test Pod objects in the database.
:param kw: kwargs with overriding values for pod's attributes.
:returns: Test Pod DB object.
@ -160,6 +163,7 @@ def get_test_service(**kw):
def create_test_service(**kw):
"""Create test service entry in DB and return Service DB object.
Function to be used to create test Service objects in the database.
:param kw: kwargs with overriding values for service's attributes.
:returns: Test Service DB object.
@ -188,6 +192,7 @@ def get_test_node(**kw):
def create_test_node(**kw):
"""Create test node entry in DB and return Node DB object.
Function to be used to create test Node objects in the database.
:param kw: kwargs with overriding values for node's attributes.
:returns: Test Node DB object.
@ -218,6 +223,7 @@ def get_test_container(**kw):
def create_test_container(**kw):
"""Create test container entry in DB and return Container DB object.
Function to be used to create test Container objects in the database.
:param kw: kwargs with overriding values for container's attributes.
:returns: Test Container DB object.
@ -249,6 +255,7 @@ def get_test_rc(**kw):
def create_test_rc(**kw):
"""Create test rc entry in DB and return ReplicationController DB object.
Function to be used to create test ReplicationController objects in the
database.
:param kw: kwargs with overriding values for
@ -292,6 +299,7 @@ def get_test_x509keypair(**kw):
def create_test_x509keypair(**kw):
"""Create test x509keypair entry in DB and return X509KeyPair DB object.
Function to be used to create test X509KeyPair objects in the database.
:param kw: kwargs with overriding values for x509keypair's attributes.
:returns: Test X509KeyPair DB object.

@ -21,7 +21,9 @@ from magnum.tests import base
class HackingTestCase(base.TestCase):
"""This class tests the hacking checks in magnum.hacking.checks by passing
"""Hacking test class.
This class tests the hacking checks in magnum.hacking.checks by passing
strings to the check methods like the pep8/flake8 parser would. The parser
loops over each line in the file and then passes the parameters to the
check method. The parameter names in the check method dictate what type of

@ -55,11 +55,9 @@ commands =
[flake8]
# E711 is ignored because it is normal to use "column == None" in sqlalchemy
# The rest of the ignores are TODOs
# New from hacking 0.9: E129, E131, H407, H405, H904
# E251 Skipped due to https://github.com/jcrocholl/pep8/issues/301
ignore = E131,E251,H405,E711
ignore = E251,E711
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools,magnum/common/pythonk8sclient
[hacking]

Loading…
Cancel
Save