Cleanup code and remove newly ignored hack rules

newer hacking has rules for the following:
  H105  Don't use author tags
  H238  old style class declaration, use new style (inherit from `object`)
  W292 no newline at end of file

So we need to clean them up and stop ignoring them

Change-Id: I12b995cf87d6bc0938298f397b41a4693627bb4b
changes/61/153761/1
Davanum Srinivas 8 years ago
parent e9dba9d4cd
commit d43259dbf2
  1. 2
      magnum/api/auth.py
  2. 2
      magnum/api/controllers/root.py
  3. 4
      magnum/api/hooks.py
  4. 4
      magnum/api/middleware/parsable_error.py
  5. 2
      magnum/base.py
  6. 2
      magnum/common/k8s_manifest.py
  7. 2
      magnum/conductor/handlers/common/docker_client.py
  8. 2
      magnum/objects/base.py
  9. 2
      magnum/tests/api/controllers/v1/test_node.py
  10. 2
      magnum/tests/api/controllers/v1/test_pod.py
  11. 2
      magnum/tests/api/controllers/v1/test_service.py
  12. 2
      magnum/tests/api/test_hooks.py
  13. 2
      magnum/tests/api/utils.py
  14. 2
      magnum/tests/common/test_exception.py
  15. 2
      magnum/tests/common/test_k8s_manifest.py
  16. 2
      magnum/tests/common/test_safeutils.py
  17. 2
      magnum/tests/common/test_urlfetch.py
  18. 2
      magnum/tests/common/test_utils.py
  19. 2
      magnum/tests/conductor/handlers/common/test_kube_utils.py
  20. 2
      magnum/tests/fakes.py
  21. 2
      magnum/tests/objects/utils.py
  22. 3
      tox.ini

@ -2,8 +2,6 @@
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# Author: Doug Hellmann <doug.hellmann@dreamhost.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at

@ -2,8 +2,6 @@
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# Author: Doug Hellmann <doug.hellmann@dreamhost.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at

@ -2,8 +2,6 @@
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# Author: Doug Hellmann <doug.hellmann@dreamhost.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
@ -117,4 +115,4 @@ class NoExceptionTracebackHook(hooks.PecanHook):
json_body['faultstring'] = faultsting.rstrip()
# Replace the whole json. Cannot change original one beacause it's
# generated on the fly.
state.response.json = json_body
state.response.json = json_body

@ -2,8 +2,6 @@
#
# Copyright ? 2012 New Dream Network, LLC (DreamHost)
#
# Author: Doug Hellmann <doug.hellmann@dreamhost.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
@ -88,4 +86,4 @@ class ParsableErrorMiddleware(object):
state['headers'].append(('Content-Length', len(body[0])))
else:
body = app_iter
return body
return body

@ -110,4 +110,4 @@ class Container(ContainerBase):
@abc.abstractmethod
def execute(self, cmd):
pass
pass

@ -65,4 +65,4 @@ def parse(manifest_str):
raise ValueError(_('The manifest is not a JSON object '
'or YAML mapping.'))
# TODO(yuanying): check manifest version
return manifest
return manifest

@ -76,4 +76,4 @@ class DockerHTTPClient(client.Client):
self.load_image(fh)
def get_container_logs(self, docker_id):
return self.attach(docker_id, 1, 1, 0, 1)
return self.attach(docker_id, 1, 1, 0, 1)

@ -32,7 +32,7 @@ from magnum.openstack.common import versionutils
LOG = logging.getLogger('object')
class NotSpecifiedSentinel:
class NotSpecifiedSentinel(object):
pass

@ -265,4 +265,4 @@ class TestDelete(api_base.FunctionalTest):
response = self.delete('/nodes/%s' % uuid, expect_errors=True)
self.assertEqual(404, response.status_int)
self.assertEqual('application/json', response.content_type)
self.assertTrue(response.json['error_message'])
self.assertTrue(response.json['error_message'])

@ -381,4 +381,4 @@ class TestDelete(api_base.FunctionalTest):
response = self.delete('/pods/%s' % uuid, expect_errors=True)
self.assertEqual(404, response.status_int)
self.assertEqual('application/json', response.content_type)
self.assertTrue(response.json['error_message'])
self.assertTrue(response.json['error_message'])

@ -311,4 +311,4 @@ class TestDelete(api_base.FunctionalTest):
response = self.delete('/services/%s' % uuid, expect_errors=True)
self.assertEqual(404, response.status_int)
self.assertEqual('application/json', response.content_type)
self.assertTrue(response.json['error_message'])
self.assertTrue(response.json['error_message'])

@ -136,4 +136,4 @@ class TestNoExceptionTracebackHook(api_base.FunctionalTest):
actual_msg = json.loads(
response.json['error_message'])['faultstring']
self.assertEqual(self.MSG_WITH_TRACE, actual_msg)
self.assertEqual(self.MSG_WITH_TRACE, actual_msg)

@ -91,4 +91,4 @@ def rc_post_data(**kw):
def node_post_data(**kw):
node = utils.get_test_node(**kw)
internal = node_controller.NodePatchType.internal_attrs()
return remove_internal(node, internal)
return remove_internal(node, internal)

@ -193,4 +193,4 @@ class TestException(base.BaseTestCase):
def test_NodeAssociated(self):
self.assertRaises(exception.NodeAssociated,
lambda: self.raise_(exception.NodeAssociated()))
lambda: self.raise_(exception.NodeAssociated()))

@ -56,4 +56,4 @@ class K8sManifestTestCase(base.TestCase):
def test_parse_invalid_value(self):
invalid_str = 'aoa89**'
self.assertRaises(ValueError, k8s_manifest.parse, invalid_str)
self.assertRaises(ValueError, k8s_manifest.parse, invalid_str)

@ -96,4 +96,4 @@ class GetCallArgsTestCase(base.BaseTestCase):
self.assertIn('red', callargs)
self.assertEqual(3, callargs['red'])
self.assertIn('blue', callargs)
self.assertIsNone(callargs['blue'])
self.assertIsNone(callargs['blue'])

@ -52,4 +52,4 @@ class TestUrlFetch(base.BaseTestCase):
self.assertRaises(urlfetch.URLFetchError,
urlfetch.get,
'http://example.com')
'http://example.com')

@ -498,4 +498,4 @@ class TempFilesTestCase(base.TestCase):
tempdir_created = tempdir
rmtree_mock.assert_called_once_with(tempdir_created)
self.assertTrue(log_mock.error.called)
self.assertTrue(log_mock.error.called)

@ -141,4 +141,4 @@ class TestKubeUtils(base.BaseTestCase):
mock_file.write.assert_called_once_with(expected_data)
mock_k8s_update.assert_called_once_with(expected_master_address,
expected_filename)
expected_filename)

@ -54,7 +54,7 @@ class FakePecanResponse(mock.Mock):
self.status = None
class FakeApp:
class FakeApp(object):
pass

@ -177,4 +177,4 @@ def create_test_node(ctxt, **kw):
"""
node = get_test_node(ctxt, **kw)
node.create()
return node
return node

@ -40,7 +40,6 @@ commands =
# 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
# TODO(dims): Fix temporarily ignored H105, H238, W292
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H302,H105,H238,H405,H803,H904,E711,W292
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H302,H405,H803,H904,E711
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools

Loading…
Cancel
Save