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
This commit is contained in:
David Sariel 2016-02-14 14:55:46 +02:00
parent f16ff3ee7e
commit 4a61faa065
11 changed files with 17 additions and 51 deletions

View File

@ -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 <jesse@ansolabs.com>
.. moduleauthor:: Devin Carlen <devin.carlen@gmail.com>
.. moduleauthor:: Vishvananda Ishaya <vishvananda@gmail.com>
.. moduleauthor:: Joshua McKenty <joshua@cognition.ca>
.. moduleauthor:: Manish Singh <yosh@gimp.org>
.. moduleauthor:: Andy Smith <andy@anarkystic.com>
"""

View File

@ -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.

View File

@ -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()

View File

@ -20,12 +20,6 @@
.. automodule:: manila.tests
:platform: Unix
.. moduleauthor:: Jesse Andrews <jesse@ansolabs.com>
.. moduleauthor:: Devin Carlen <devin.carlen@gmail.com>
.. moduleauthor:: Vishvananda Ishaya <vishvananda@gmail.com>
.. moduleauthor:: Joshua McKenty <joshua@cognition.ca>
.. moduleauthor:: Manish Singh <yosh@gimp.org>
.. moduleauthor:: Andy Smith <andy@anarkystic.com>
"""
import eventlet

View File

@ -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

View File

@ -19,7 +19,7 @@ def example_function_a():
return 'Example function'
class ExampleClassA():
class ExampleClassA(object):
def example_method(self):
return 'Example method'

View File

@ -20,7 +20,7 @@ def example_function_b():
return 'Example function'
class ExampleClassB():
class ExampleClassB(object):
def example_method(self):
return 'Example method'

View File

@ -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(

View File

@ -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):

View File

@ -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):

View File

@ -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