Browse Source

Start using Hacking and PyFlakes

Only blacklisting those warnings that are numerous,
so that in principle Hacking and PyFlakes warnings
are tested. Fix the easy ones alongway.

Change-Id: I571f51ebf570ac114509f2dcd71cdce281e7c70a
Dirk Mueller 5 years ago
parent
commit
67c80558b1

+ 1
- 1
novaclient/service_catalog.py View File

@@ -50,7 +50,7 @@ class ServiceCatalog(object):
50 50
                 raise novaclient.exceptions.EndpointNotFound()
51 51
 
52 52
         # We don't always get a service catalog back ...
53
-        if not 'serviceCatalog' in self.catalog['access']:
53
+        if 'serviceCatalog' not in self.catalog['access']:
54 54
             return None
55 55
 
56 56
         # Full catalog ...

+ 2
- 2
novaclient/tests/v1_1/test_servers.py View File

@@ -169,9 +169,9 @@ class ServersTest(utils.TestCase):
169 169
                          {'metadata': {'test_key': 'test_value'}})
170 170
 
171 171
     def test_find(self):
172
-        s = cs.servers.find(name='sample-server')
172
+        server = cs.servers.find(name='sample-server')
173 173
         cs.assert_called('GET', '/servers/detail')
174
-        self.assertEqual(s.name, 'sample-server')
174
+        self.assertEqual(server.name, 'sample-server')
175 175
 
176 176
         self.assertRaises(exceptions.NoUniqueMatch, cs.servers.find,
177 177
                           flavor={"id": 1, "name": "256 MB Server"})

+ 1
- 1
novaclient/v1_1/__init__.py View File

@@ -14,4 +14,4 @@
14 14
 #    License for the specific language governing permissions and limitations
15 15
 #    under the License.
16 16
 
17
-from novaclient.v1_1.client import Client
17
+from novaclient.v1_1.client import Client   # noqa

+ 1
- 1
novaclient/v1_1/flavors.py View File

@@ -170,7 +170,7 @@ class FlavorManager(base.ManagerWithFind):
170 170
 
171 171
         try:
172 172
             is_public = utils.bool_from_str(is_public)
173
-        except:
173
+        except Exception:
174 174
             raise exceptions.CommandError("is_public must be a boolean.")
175 175
 
176 176
         body = {

+ 1
- 1
novaclient/v1_1/servers.py View File

@@ -536,7 +536,7 @@ class ServerManager(local_base.BootingManagerWithFind):
536 536
                key_name=None, availability_zone=None,
537 537
                block_device_mapping=None, nics=None, scheduler_hints=None,
538 538
                config_drive=None, **kwargs):
539
-        # TODO: (anthony) indicate in doc string if param is an extension
539
+        # TODO(anthony): indicate in doc string if param is an extension
540 540
         # and/or optional
541 541
         """
542 542
         Create (boot) a new server.

+ 2
- 2
novaclient/v1_1/shell.py View File

@@ -1251,7 +1251,7 @@ def do_image_create(cs, args):
1251 1251
 @utils.arg('rotation', metavar='<rotation>',
1252 1252
            help='Int parameter representing how many backups to keep around.')
1253 1253
 def do_backup(cs, args):
1254
-    """ Backup a instance by create a 'backup' type snapshot """
1254
+    """Backup a instance by create a 'backup' type snapshot """
1255 1255
     _find_server(cs, args.server).backup(args.name,
1256 1256
                                          args.backup_type,
1257 1257
                                          args.rotation)
@@ -3127,7 +3127,7 @@ def do_availability_zone_list(cs, _args):
3127 3127
     except exceptions.Forbidden as e:  # policy doesn't allow probably
3128 3128
         try:
3129 3129
             availability_zones = cs.availability_zones.list(detailed=False)
3130
-        except:
3130
+        except Exception:
3131 3131
             raise e
3132 3132
 
3133 3133
     result = []

+ 0
- 1
tools/install_venv.py View File

@@ -27,7 +27,6 @@ import optparse
27 27
 import os
28 28
 import subprocess
29 29
 import sys
30
-import platform
31 30
 
32 31
 
33 32
 ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))

+ 1
- 1
tox.ini View File

@@ -24,6 +24,6 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
24 24
 downloadcache = ~/cache/pip
25 25
 
26 26
 [flake8]
27
-ignore = E12,E711,E721,E712,F,H
27
+ignore = E12,E711,E721,E712,F841,F811,F821,H302,H306,H402,H403,H404
28 28
 show-source = True
29 29
 exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build

Loading…
Cancel
Save