Browse Source

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
David Sariel 3 years ago
parent
commit
4a61faa065

+ 0
- 30
manila/__init__.py View File

@@ -1,30 +0,0 @@
1
-# Copyright 2010 United States Government as represented by the
2
-# Administrator of the National Aeronautics and Space Administration.
3
-# All Rights Reserved.
4
-#
5
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
6
-#    not use this file except in compliance with the License. You may obtain
7
-#    a copy of the License at
8
-#
9
-#         http://www.apache.org/licenses/LICENSE-2.0
10
-#
11
-#    Unless required by applicable law or agreed to in writing, software
12
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
-#    License for the specific language governing permissions and limitations
15
-#    under the License.
16
-
17
-"""
18
-:mod:`manila` -- Cloud IaaS Platform
19
-===================================
20
-
21
-.. automodule:: manila
22
-   :platform: Unix
23
-   :synopsis: Infrastructure-as-a-Service Cloud platform.
24
-.. moduleauthor:: Jesse Andrews <jesse@ansolabs.com>
25
-.. moduleauthor:: Devin Carlen <devin.carlen@gmail.com>
26
-.. moduleauthor:: Vishvananda Ishaya <vishvananda@gmail.com>
27
-.. moduleauthor:: Joshua McKenty <joshua@cognition.ca>
28
-.. moduleauthor:: Manish Singh <yosh@gimp.org>
29
-.. moduleauthor:: Andy Smith <andy@anarkystic.com>
30
-"""

+ 5
- 3
manila/api/v1/limits.py View File

@@ -108,9 +108,11 @@ class Limit(object):
108 108
         self.water_level = 0
109 109
         self.capacity = self.unit
110 110
         self.request_value = float(self.capacity) / float(self.value)
111
-        msg = _("Only %(value)s %(verb)s request(s) can be "
112
-                "made to %(uri)s every %(unit_string)s.")
113
-        self.error_message = msg % self.__dict__
111
+        msg = (_("Only %(value)s %(verb)s request(s) can be "
112
+               "made to %(uri)s every %(unit_string)s.") %
113
+               {'value': self.value, 'verb': self.verb,
114
+                'uri': self.uri, 'unit_string': self.unit_string})
115
+        self.error_message = msg
114 116
 
115 117
     def __call__(self, verb, url):
116 118
         """Represents a call to this limit from a relevant request.

+ 1
- 1
manila/network/linux/ovs_lib.py View File

@@ -23,7 +23,7 @@ from manila import utils
23 23
 LOG = log.getLogger(__name__)
24 24
 
25 25
 
26
-class OVSBridge:
26
+class OVSBridge(object):
27 27
     def __init__(self, br_name):
28 28
         self.br_name = br_name
29 29
         self.re_id = self.re_compile_id()

+ 0
- 6
manila/tests/__init__.py View File

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

+ 1
- 1
manila/tests/api/openstack/test_wsgi.py View File

@@ -289,7 +289,7 @@ class ResourceTest(test.TestCase):
289 289
                           '{"barAction": true}')
290 290
 
291 291
     def test_get_method_action_method(self):
292
-        class Controller():
292
+        class Controller(object):
293 293
             def action(self, req, pants=None):
294 294
                 return pants
295 295
 

+ 1
- 1
manila/tests/monkey_patch_example/example_a.py View File

@@ -19,7 +19,7 @@ def example_function_a():
19 19
     return 'Example function'
20 20
 
21 21
 
22
-class ExampleClassA():
22
+class ExampleClassA(object):
23 23
     def example_method(self):
24 24
         return 'Example method'
25 25
 

+ 1
- 1
manila/tests/monkey_patch_example/example_b.py View File

@@ -20,7 +20,7 @@ def example_function_b():
20 20
     return 'Example function'
21 21
 
22 22
 
23
-class ExampleClassB():
23
+class ExampleClassB(object):
24 24
     def example_method(self):
25 25
         return 'Example method'
26 26
 

+ 1
- 1
manila/tests/share/drivers/emc/test_driver.py View File

@@ -78,7 +78,7 @@ class FakeConnection(base.StorageConnection):
78 78
 FAKE_BACKEND = 'fake_backend'
79 79
 
80 80
 
81
-class FakeEMCExtensionManager():
81
+class FakeEMCExtensionManager(object):
82 82
     def __init__(self):
83 83
         self.extensions = []
84 84
         self.extensions.append(

+ 1
- 1
manila/tests/share/test_manager.py View File

@@ -52,7 +52,7 @@ def fake_replica(**kwargs):
52 52
 
53 53
 class LockedOperationsTestCase(test.TestCase):
54 54
 
55
-    class FakeManager:
55
+    class FakeManager(object):
56 56
 
57 57
         @manager.locked_share_replica_operation
58 58
         def fake_replica_operation(self, context, replica, share_id=None):

+ 5
- 2
tools/lintstack.py View File

@@ -110,8 +110,11 @@ class LintOutput(object):
110 110
         return json.dumps(self.__dict__)
111 111
 
112 112
     def review_str(self):
113
-        return ("File %(filename)s\nLine %(lineno)d:%(line_content)s\n"
114
-                "%(code)s: %(message)s" % self.__dict__)
113
+        return ("File %(filename)s\nLine %(lineno)d:"
114
+                "%(line_content)s\n%(code)s: %(message)s" %
115
+                {'filename': self.filename, 'lineno': self.lineno,
116
+                 'line_content': self.line_content, 'code': self.code,
117
+                 'message': self.message})
115 118
 
116 119
 
117 120
 class ErrorKeys(object):

+ 1
- 4
tox.ini View File

@@ -68,10 +68,7 @@ commands = python tools/lintstack.py check
68 68
 
69 69
 [flake8]
70 70
 # Following checks are ignored on purpose:
71
-# H105 using author tags
72
-# H238 hacking no old style class
73
-# H501 hacking no locals
74
-ignore = H105,H238,H501
71
+ignore = 
75 72
 builtins = _
76 73
 exclude = .venv,.tox,dist,doc,*egg
77 74
 

Loading…
Cancel
Save