From 4a61faa065dc445bb32cff1a464d2e22e84e5427 Mon Sep 17 00:00:00 2001 From: David Sariel Date: Sun, 14 Feb 2016 14:55:46 +0200 Subject: [PATCH] Removed ignored checks from tox.ini and fixed pep8 issues Due to the hacking version update several pep8 checks where ignored in the flakes8 section of the tox.ini. Removed ignored checks and fixed appropriate pep8 issues. The list of fixed issues: - H105 Don't use author tags - H238 Old style class declaration, use new style (inherit from `object`) - H501 Do not use self.__dict__ for string formatting Closes-Bug: 1530719 Change-Id: I890ba4c54b0da10060767620ff5ff7e480d79a9c --- manila/__init__.py | 30 ------------------- manila/api/v1/limits.py | 8 +++-- manila/network/linux/ovs_lib.py | 2 +- manila/tests/__init__.py | 6 ---- manila/tests/api/openstack/test_wsgi.py | 2 +- .../tests/monkey_patch_example/example_a.py | 2 +- .../tests/monkey_patch_example/example_b.py | 2 +- manila/tests/share/drivers/emc/test_driver.py | 2 +- manila/tests/share/test_manager.py | 2 +- tools/lintstack.py | 7 +++-- tox.ini | 5 +--- 11 files changed, 17 insertions(+), 51 deletions(-) diff --git a/manila/__init__.py b/manila/__init__.py index 5ac22d4181..e69de29bb2 100644 --- a/manila/__init__.py +++ b/manila/__init__.py @@ -1,30 +0,0 @@ -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -""" -:mod:`manila` -- Cloud IaaS Platform -=================================== - -.. automodule:: manila - :platform: Unix - :synopsis: Infrastructure-as-a-Service Cloud platform. -.. moduleauthor:: Jesse Andrews -.. moduleauthor:: Devin Carlen -.. moduleauthor:: Vishvananda Ishaya -.. moduleauthor:: Joshua McKenty -.. moduleauthor:: Manish Singh -.. moduleauthor:: Andy Smith -""" diff --git a/manila/api/v1/limits.py b/manila/api/v1/limits.py index 3d48411926..66c04ec6f9 100644 --- a/manila/api/v1/limits.py +++ b/manila/api/v1/limits.py @@ -108,9 +108,11 @@ class Limit(object): self.water_level = 0 self.capacity = self.unit self.request_value = float(self.capacity) / float(self.value) - msg = _("Only %(value)s %(verb)s request(s) can be " - "made to %(uri)s every %(unit_string)s.") - self.error_message = msg % self.__dict__ + msg = (_("Only %(value)s %(verb)s request(s) can be " + "made to %(uri)s every %(unit_string)s.") % + {'value': self.value, 'verb': self.verb, + 'uri': self.uri, 'unit_string': self.unit_string}) + self.error_message = msg def __call__(self, verb, url): """Represents a call to this limit from a relevant request. diff --git a/manila/network/linux/ovs_lib.py b/manila/network/linux/ovs_lib.py index 3e436e9789..58e304d6ac 100644 --- a/manila/network/linux/ovs_lib.py +++ b/manila/network/linux/ovs_lib.py @@ -23,7 +23,7 @@ from manila import utils LOG = log.getLogger(__name__) -class OVSBridge: +class OVSBridge(object): def __init__(self, br_name): self.br_name = br_name self.re_id = self.re_compile_id() diff --git a/manila/tests/__init__.py b/manila/tests/__init__.py index 6132d017f4..c935a415d1 100644 --- a/manila/tests/__init__.py +++ b/manila/tests/__init__.py @@ -20,12 +20,6 @@ .. automodule:: manila.tests :platform: Unix -.. moduleauthor:: Jesse Andrews -.. moduleauthor:: Devin Carlen -.. moduleauthor:: Vishvananda Ishaya -.. moduleauthor:: Joshua McKenty -.. moduleauthor:: Manish Singh -.. moduleauthor:: Andy Smith """ import eventlet diff --git a/manila/tests/api/openstack/test_wsgi.py b/manila/tests/api/openstack/test_wsgi.py index c2a3d827a1..a98f241523 100644 --- a/manila/tests/api/openstack/test_wsgi.py +++ b/manila/tests/api/openstack/test_wsgi.py @@ -289,7 +289,7 @@ class ResourceTest(test.TestCase): '{"barAction": true}') def test_get_method_action_method(self): - class Controller(): + class Controller(object): def action(self, req, pants=None): return pants diff --git a/manila/tests/monkey_patch_example/example_a.py b/manila/tests/monkey_patch_example/example_a.py index 5a1bd7a306..88209bb656 100644 --- a/manila/tests/monkey_patch_example/example_a.py +++ b/manila/tests/monkey_patch_example/example_a.py @@ -19,7 +19,7 @@ def example_function_a(): return 'Example function' -class ExampleClassA(): +class ExampleClassA(object): def example_method(self): return 'Example method' diff --git a/manila/tests/monkey_patch_example/example_b.py b/manila/tests/monkey_patch_example/example_b.py index 62adae0a76..b303bd752f 100644 --- a/manila/tests/monkey_patch_example/example_b.py +++ b/manila/tests/monkey_patch_example/example_b.py @@ -20,7 +20,7 @@ def example_function_b(): return 'Example function' -class ExampleClassB(): +class ExampleClassB(object): def example_method(self): return 'Example method' diff --git a/manila/tests/share/drivers/emc/test_driver.py b/manila/tests/share/drivers/emc/test_driver.py index 050571af03..4e86e4b707 100644 --- a/manila/tests/share/drivers/emc/test_driver.py +++ b/manila/tests/share/drivers/emc/test_driver.py @@ -78,7 +78,7 @@ class FakeConnection(base.StorageConnection): FAKE_BACKEND = 'fake_backend' -class FakeEMCExtensionManager(): +class FakeEMCExtensionManager(object): def __init__(self): self.extensions = [] self.extensions.append( diff --git a/manila/tests/share/test_manager.py b/manila/tests/share/test_manager.py index 5dc6538862..9baf9d37c0 100644 --- a/manila/tests/share/test_manager.py +++ b/manila/tests/share/test_manager.py @@ -52,7 +52,7 @@ def fake_replica(**kwargs): class LockedOperationsTestCase(test.TestCase): - class FakeManager: + class FakeManager(object): @manager.locked_share_replica_operation def fake_replica_operation(self, context, replica, share_id=None): diff --git a/tools/lintstack.py b/tools/lintstack.py index 2613a7e976..9dee28565b 100755 --- a/tools/lintstack.py +++ b/tools/lintstack.py @@ -110,8 +110,11 @@ class LintOutput(object): return json.dumps(self.__dict__) def review_str(self): - return ("File %(filename)s\nLine %(lineno)d:%(line_content)s\n" - "%(code)s: %(message)s" % self.__dict__) + return ("File %(filename)s\nLine %(lineno)d:" + "%(line_content)s\n%(code)s: %(message)s" % + {'filename': self.filename, 'lineno': self.lineno, + 'line_content': self.line_content, 'code': self.code, + 'message': self.message}) class ErrorKeys(object): diff --git a/tox.ini b/tox.ini index ce8c27f269..69786c861c 100644 --- a/tox.ini +++ b/tox.ini @@ -68,10 +68,7 @@ commands = python tools/lintstack.py check [flake8] # Following checks are ignored on purpose: -# H105 using author tags -# H238 hacking no old style class -# H501 hacking no locals -ignore = H105,H238,H501 +ignore = builtins = _ exclude = .venv,.tox,dist,doc,*egg