Browse Source

Enable check for E127

E127 continuation line over-indented for visual indent

Change-Id: I9dfd489565ee2d1469b2048a930c3a8384dd245d
Andrey Kurilin 4 years ago
parent
commit
ae6c39397e

+ 2
- 2
novaclient/service_catalog.py View File

@@ -32,8 +32,8 @@ class ServiceCatalog(object):
32 32
         return self.catalog['access']['token']['tenant']['id']
33 33
 
34 34
     def url_for(self, attr=None, filter_value=None,
35
-                    service_type=None, endpoint_type='publicURL',
36
-                    service_name=None, volume_service_name=None):
35
+                service_type=None, endpoint_type='publicURL',
36
+                service_name=None, volume_service_name=None):
37 37
         """Fetch the public URL from the Compute service for
38 38
         a particular endpoint attribute. If none given, return
39 39
         the first. See tests for sample service catalog.

+ 5
- 2
novaclient/shell.py View File

@@ -765,8 +765,11 @@ class OpenStackComputeShell(object):
765 765
         commands.remove('bash_completion')
766 766
         print(' '.join(commands | options))
767 767
 
768
-    @utils.arg('command', metavar='<subcommand>', nargs='?',
769
-                    help='Display help for <subcommand>')
768
+    @utils.arg(
769
+        'command',
770
+        metavar='<subcommand>',
771
+        nargs='?',
772
+        help='Display help for <subcommand>')
770 773
     def do_help(self, args):
771 774
         """
772 775
         Display help about this program or one of its subcommands.

+ 5
- 6
novaclient/tests/fakes.py View File

@@ -43,10 +43,10 @@ class FakeClient(object):
43 43
         called = self.client.callstack[pos][0:2]
44 44
 
45 45
         assert self.client.callstack, \
46
-                       "Expected %s %s but no calls were made." % expected
46
+            "Expected %s %s but no calls were made." % expected
47 47
 
48
-        assert expected == called, 'Expected %s %s; got %s %s' % \
49
-                                               (expected + called)
48
+        assert expected == called, \
49
+            'Expected %s %s; got %s %s' % (expected + called)
50 50
 
51 51
         if body is not None:
52 52
             if self.client.callstack[pos][2] != body:
@@ -60,7 +60,7 @@ class FakeClient(object):
60 60
         expected = (method, url)
61 61
 
62 62
         assert self.client.callstack, \
63
-                       "Expected %s %s but no calls were made." % expected
63
+            "Expected %s %s but no calls were made." % expected
64 64
 
65 65
         found = False
66 66
         for entry in self.client.callstack:
@@ -68,8 +68,7 @@ class FakeClient(object):
68 68
                 found = True
69 69
                 break
70 70
 
71
-        assert found, 'Expected %s; got %s' % \
72
-                              (expected, self.client.callstack)
71
+        assert found, 'Expected %s; got %s' % (expected, self.client.callstack)
73 72
         if body is not None:
74 73
             try:
75 74
                 assert entry[2] == body

+ 2
- 2
novaclient/tests/fixture_data/servers.py View File

@@ -614,8 +614,8 @@ class V3(Base):
614 614
             context.headers['location'] = "http://blah/images/456"
615 615
 
616 616
         if action not in set.union(set(body_is_none_list),
617
-                                     set(body_params_check_exact.keys()),
618
-                                     set(body_param_check_exists.keys())):
617
+                                   set(body_params_check_exact.keys()),
618
+                                   set(body_param_check_exists.keys())):
619 619
             raise AssertionError("Unexpected server action: %s" % action)
620 620
 
621 621
         return _body

+ 11
- 14
novaclient/tests/test_client.py View File

@@ -57,10 +57,9 @@ class ClientTest(utils.TestCase):
57 57
         }
58 58
         with mock.patch('requests.request', mock_request):
59 59
             instance.authenticate()
60
-            requests.request.assert_called_with(mock.ANY, mock.ANY,
61
-                                                        timeout=2,
62
-                                                        headers=mock.ANY,
63
-                                                        verify=mock.ANY)
60
+            requests.request.assert_called_with(
61
+                mock.ANY, mock.ANY, timeout=2, headers=mock.ANY,
62
+                verify=mock.ANY)
64 63
 
65 64
     def test_client_reauth(self):
66 65
         instance = novaclient.client.HTTPClient(user='user',
@@ -208,7 +207,7 @@ class ClientTest(utils.TestCase):
208 207
 
209 208
     def test_client_get_reset_timings_v3(self):
210 209
         cs = novaclient.v3.client.Client("user", "password", "project_id",
211
-                                           auth_url="foo/v2")
210
+                                         auth_url="foo/v2")
212 211
         self.assertEqual(0, len(cs.get_timings()))
213 212
         cs.client.times.append("somevalue")
214 213
         self.assertEqual(["somevalue"], cs.get_timings())
@@ -220,15 +219,13 @@ class ClientTest(utils.TestCase):
220 219
         fake_attribute_name1 = "FakeAttribute1"
221 220
         fake_attribute_name2 = "FakeAttribute2"
222 221
         extensions = [
223
-            novaclient.extension.Extension(fake_attribute_name1,
224
-                                fakes),
225
-            novaclient.extension.Extension(fake_attribute_name2,
226
-                                utils),
222
+            novaclient.extension.Extension(fake_attribute_name1, fakes),
223
+            novaclient.extension.Extension(fake_attribute_name2, utils),
227 224
         ]
228 225
 
229 226
         cs = novaclient.v3.client.Client("user", "password", "project_id",
230
-                                           auth_url="foo/v2",
231
-                                           extensions=extensions)
227
+                                         auth_url="foo/v2",
228
+                                         extensions=extensions)
232 229
         self.assertIsInstance(getattr(cs, fake_attribute_name1, None),
233 230
                               fakes.FakeManager)
234 231
         self.assertFalse(hasattr(cs, fake_attribute_name2))
@@ -236,7 +233,7 @@ class ClientTest(utils.TestCase):
236 233
     @mock.patch.object(novaclient.client.HTTPClient, 'authenticate')
237 234
     def test_authenticate_call_v3(self, mock_authenticate):
238 235
         cs = novaclient.v3.client.Client("user", "password", "project_id",
239
-                                           auth_url="foo/v2")
236
+                                         auth_url="foo/v2")
240 237
         cs.authenticate()
241 238
         self.assertTrue(mock_authenticate.called)
242 239
 
@@ -245,7 +242,7 @@ class ClientTest(utils.TestCase):
245 242
         fake_client = mock.Mock()
246 243
         mock_http_client.return_value = fake_client
247 244
         with novaclient.v1_1.client.Client("user", "password", "project_id",
248
-                auth_url="foo/v2"):
245
+                                           auth_url="foo/v2"):
249 246
             pass
250 247
         self.assertTrue(fake_client.open_session.called)
251 248
         self.assertTrue(fake_client.close_session.called)
@@ -255,7 +252,7 @@ class ClientTest(utils.TestCase):
255 252
         fake_client = mock.Mock()
256 253
         mock_http_client.return_value = fake_client
257 254
         with novaclient.v3.client.Client("user", "password", "project_id",
258
-                auth_url="foo/v2"):
255
+                                         auth_url="foo/v2"):
259 256
             pass
260 257
         self.assertTrue(fake_client.open_session.called)
261 258
         self.assertTrue(fake_client.close_session.called)

+ 28
- 31
novaclient/tests/v1_1/fakes.py View File

@@ -879,11 +879,11 @@ class FakeHTTPClient(base_client.HTTPClient):
879 879
         if body.get('pool'):
880 880
             return (200, {}, {'floating_ip':
881 881
                 {'id': 1, 'fixed_ip': '10.0.0.1', 'ip': '11.0.0.1',
882
-                                                            'pool': 'nova'}})
882
+                 'pool': 'nova'}})
883 883
         else:
884 884
             return (200, {}, {'floating_ip':
885 885
                 {'id': 1, 'fixed_ip': '10.0.0.1', 'ip': '11.0.0.1',
886
-                                                            'pool': None}})
886
+                 'pool': None}})
887 887
 
888 888
     def delete_os_floating_ips_1(self, **kw):
889 889
         return (204, {}, None)
@@ -895,43 +895,42 @@ class FakeHTTPClient(base_client.HTTPClient):
895 895
 
896 896
     def get_os_floating_ip_dns_testdomain_entries(self, **kw):
897 897
         if kw.get('ip'):
898
-            return (205, {}, {'dns_entries':
899
-                          [{'dns_entry':
900
-                             {'ip': kw.get('ip'),
901
-                              'name': "host1",
902
-                              'type': "A",
903
-                              'domain': 'testdomain'}},
904
-                           {'dns_entry':
905
-                             {'ip': kw.get('ip'),
906
-                              'name': "host2",
907
-                              'type': "A",
908
-                              'domain': 'testdomain'}}]})
898
+            return (205, {}, {
899
+                'dns_entries': [
900
+                    {'dns_entry': {'ip': kw.get('ip'),
901
+                                   'name': "host1",
902
+                                   'type': "A",
903
+                                   'domain': 'testdomain'}},
904
+                    {'dns_entry': {'ip': kw.get('ip'),
905
+                                   'name': "host2",
906
+                                   'type': "A",
907
+                                   'domain': 'testdomain'}}]})
909 908
         else:
910 909
             return (404, {}, None)
911 910
 
912 911
     def get_os_floating_ip_dns_testdomain_entries_testname(self, **kw):
913
-        return (205, {}, {'dns_entry':
914
-                        {'ip': "10.10.10.10",
915
-                         'name': 'testname',
916
-                         'type': "A",
917
-                         'domain': 'testdomain'}})
912
+        return (205, {}, {
913
+            'dns_entry': {'ip': "10.10.10.10",
914
+                          'name': 'testname',
915
+                          'type': "A",
916
+                          'domain': 'testdomain'}})
918 917
 
919 918
     def put_os_floating_ip_dns_testdomain(self, body, **kw):
920 919
         if body['domain_entry']['scope'] == 'private':
921 920
             fakes.assert_has_keys(body['domain_entry'],
922
-                            required=['availability_zone', 'scope'])
921
+                                  required=['availability_zone', 'scope'])
923 922
         elif body['domain_entry']['scope'] == 'public':
924 923
             fakes.assert_has_keys(body['domain_entry'],
925
-                            required=['project', 'scope'])
924
+                                  required=['project', 'scope'])
926 925
 
927 926
         else:
928 927
             fakes.assert_has_keys(body['domain_entry'],
929
-                            required=['project', 'scope'])
928
+                                  required=['project', 'scope'])
930 929
         return (205, {}, body)
931 930
 
932 931
     def put_os_floating_ip_dns_testdomain_entries_testname(self, body, **kw):
933 932
         fakes.assert_has_keys(body['dns_entry'],
934
-                        required=['ip', 'dns_type'])
933
+                              required=['ip', 'dns_type'])
935 934
         return (205, {}, body)
936 935
 
937 936
     def delete_os_floating_ip_dns_testdomain(self, **kw):
@@ -1271,8 +1270,7 @@ class FakeHTTPClient(base_client.HTTPClient):
1271 1270
         return (200, {}, {"security_groups": [
1272 1271
             {"name": "test",
1273 1272
              "description": "FAKE_SECURITY_GROUP",
1274
-             "tenant_id":
1275
-                 "4ffc664c198e435e9853f2538fbcd7a7",
1273
+             "tenant_id": "4ffc664c198e435e9853f2538fbcd7a7",
1276 1274
              "id": 1,
1277 1275
              "rules": [
1278 1276
                  {"id": 11,
@@ -1330,7 +1328,7 @@ class FakeHTTPClient(base_client.HTTPClient):
1330 1328
         fakes.assert_has_keys(body['security_group'],
1331 1329
                               required=['name', 'description'])
1332 1330
         r = {'security_group':
1333
-                self.get_os_security_groups()[2]['security_groups'][0]}
1331
+             self.get_os_security_groups()[2]['security_groups'][0]}
1334 1332
         return (202, {}, r)
1335 1333
 
1336 1334
     def put_os_security_groups_1(self, body, **kw):
@@ -1363,12 +1361,13 @@ class FakeHTTPClient(base_client.HTTPClient):
1363 1361
 
1364 1362
     def post_os_security_group_rules(self, body, **kw):
1365 1363
         assert list(body) == ['security_group_rule']
1366
-        fakes.assert_has_keys(body['security_group_rule'],
1364
+        fakes.assert_has_keys(
1365
+            body['security_group_rule'],
1367 1366
             required=['parent_group_id'],
1368 1367
             optional=['group_id', 'ip_protocol', 'from_port',
1369 1368
                       'to_port', 'cidr'])
1370 1369
         r = {'security_group_rule':
1371
-            self.get_os_security_group_rules()[2]['security_group_rules'][0]}
1370
+             self.get_os_security_group_rules()[2]['security_group_rules'][0]}
1372 1371
         return (202, {}, r)
1373 1372
 
1374 1373
     #
@@ -2160,12 +2159,10 @@ class FakeHTTPClient(base_client.HTTPClient):
2160 2159
     def post_os_server_groups(self, body, **kw):
2161 2160
         return self._return_server_group()
2162 2161
 
2163
-    def get_os_server_groups_2cbd51f4_fafe_4cdb_801b_cf913a6f288b(self,
2164
-                                                                    **kw):
2162
+    def get_os_server_groups_2cbd51f4_fafe_4cdb_801b_cf913a6f288b(self, **kw):
2165 2163
         return self._return_server_group()
2166 2164
 
2167
-    def put_os_server_groups_2cbd51f4_fafe_4cdb_801b_cf913a6f288b(self,
2168
-                                                                    **kw):
2165
+    def put_os_server_groups_2cbd51f4_fafe_4cdb_801b_cf913a6f288b(self, **kw):
2169 2166
         return self._return_server_group()
2170 2167
 
2171 2168
     def post_os_server_groups_2cbd51f4_fafe_4cdb_801b_cf913a6f288b_action(

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

@@ -28,5 +28,5 @@ class TestFloatingIPPools(utils.FixturedTestCase):
28 28
     def test_list_floating_ips(self):
29 29
         fl = self.cs.floating_ip_pools.list()
30 30
         self.assert_called('GET', '/os-floating-ip-pools')
31
-        [self.assertIsInstance(f, floating_ip_pools.FloatingIPPool)
32
-                                                                   for f in fl]
31
+        for f in fl:
32
+            self.assertIsInstance(f, floating_ip_pools.FloatingIPPool)

+ 3
- 3
novaclient/tests/v1_1/test_floating_ips_bulk.py View File

@@ -46,9 +46,9 @@ class FloatingIPsBulkTest(utils.FixturedTestCase):
46 46
     def test_create_floating_ips_bulk_with_pool_and_host(self):
47 47
         fl = self.cs.floating_ips_bulk.create('192.168.1.0/30', 'poolTest',
48 48
                                               'interfaceTest')
49
-        body = {'floating_ips_bulk_create':
50
-                    {'ip_range': '192.168.1.0/30', 'pool': 'poolTest',
51
-                     'interface': 'interfaceTest'}}
49
+        body = {'floating_ips_bulk_create': {
50
+            'ip_range': '192.168.1.0/30', 'pool': 'poolTest',
51
+            'interface': 'interfaceTest'}}
52 52
         self.assert_called('POST', '/os-floating-ips-bulk', body)
53 53
         self.assertEqual(fl.ip_range,
54 54
                          body['floating_ips_bulk_create']['ip_range'])

+ 6
- 9
novaclient/tests/v1_1/test_shell.py View File

@@ -800,8 +800,8 @@ class ShellTest(utils.TestCase):
800 800
         )
801 801
 
802 802
     def test_create_image_show(self):
803
-        output = self.run_command('image-create '
804
-                                    'sample-server mysnapshot --show')
803
+        output = self.run_command(
804
+            'image-create sample-server mysnapshot --show')
805 805
         self.assert_called_anytime(
806 806
             'POST', '/servers/1234/action',
807 807
             {'createImage': {'name': 'mysnapshot', 'metadata': {}}},
@@ -2243,10 +2243,8 @@ class ShellTest(utils.TestCase):
2243 2243
              mock.mock_open(read_data='FAKE_PUBLIC_KEY'))
2244 2244
     def test_keypair_import(self):
2245 2245
         self.run_command('keypair-add --pub-key test.pub test')
2246
-        self.assert_called('POST', '/os-keypairs',
2247
-                           {'keypair':
2248
-                              {'public_key': 'FAKE_PUBLIC_KEY',
2249
-                               'name': 'test'}})
2246
+        self.assert_called('POST', '/os-keypairs', {
2247
+            'keypair': {'public_key': 'FAKE_PUBLIC_KEY', 'name': 'test'}})
2250 2248
 
2251 2249
     def test_keypair_list(self):
2252 2250
         self.run_command('keypair-list')
@@ -2263,9 +2261,8 @@ class ShellTest(utils.TestCase):
2263 2261
     def test_create_server_group(self):
2264 2262
         self.run_command('server-group-create wjsg affinity')
2265 2263
         self.assert_called('POST', '/os-server-groups',
2266
-                           {'server_group':
2267
-                              {'name': 'wjsg',
2268
-                               'policies': ['affinity']}})
2264
+                           {'server_group': {'name': 'wjsg',
2265
+                                             'policies': ['affinity']}})
2269 2266
 
2270 2267
     def test_delete_multi_server_groups(self):
2271 2268
         self.run_command('server-group-delete 12345 56789')

+ 3
- 3
novaclient/tests/v3/fakes.py View File

@@ -243,9 +243,9 @@ class FakeHTTPClient(fakes_v1_1.FakeHTTPClient):
243 243
             _headers = dict(location="http://blah/images/456")
244 244
 
245 245
         if action not in set.union(set(body_is_none_list),
246
-                                     set(body_params_check_exact.keys()),
247
-                                     set(body_param_check_exists.keys()),
248
-                                     set(body_params_check_superset.keys())):
246
+                                   set(body_params_check_exact.keys()),
247
+                                   set(body_param_check_exists.keys()),
248
+                                   set(body_params_check_superset.keys())):
249 249
             raise AssertionError("Unexpected server action: %s" % action)
250 250
 
251 251
         return (resp, _headers, _body)

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

@@ -67,4 +67,4 @@ class FlavorAccessManager(base.ManagerWithFind):
67 67
         _resp, body = self.api.client.post(url, body=body)
68 68
 
69 69
         return [self.resource_class(self, res)
70
-                    for res in body['flavor_access']]
70
+                for res in body['flavor_access']]

+ 12
- 27
novaclient/v1_1/floating_ip_dns.py View File

@@ -56,22 +56,18 @@ class FloatingIPDNSDomainManager(base.Manager):
56 56
 
57 57
     def create_private(self, fqdomain, availability_zone):
58 58
         """Add or modify a private DNS domain."""
59
-        body = {'domain_entry':
60
-                 {'scope': 'private',
61
-                  'availability_zone': availability_zone}}
59
+        body = {'domain_entry': {'scope': 'private',
60
+                                 'availability_zone': availability_zone}}
62 61
         return self._update('/os-floating-ip-dns/%s' % _quote_domain(fqdomain),
63 62
                             body,
64 63
                             'domain_entry')
65 64
 
66 65
     def create_public(self, fqdomain, project):
67 66
         """Add or modify a public DNS domain."""
68
-        body = {'domain_entry':
69
-                 {'scope': 'public',
70
-                  'project': project}}
67
+        body = {'domain_entry': {'scope': 'public', 'project': project}}
71 68
 
72 69
         return self._update('/os-floating-ip-dns/%s' % _quote_domain(fqdomain),
73
-                            body,
74
-                            'domain_entry')
70
+                            body, 'domain_entry')
75 71
 
76 72
     def delete(self, fqdomain):
77 73
         """Delete the specified domain."""
@@ -83,8 +79,7 @@ class FloatingIPDNSEntry(base.Resource):
83 79
         self.manager.delete(self.name, self.domain)
84 80
 
85 81
     def create(self):
86
-        self.manager.create(self.domain, self.name,
87
-                                  self.ip, self.dns_type)
82
+        self.manager.create(self.domain, self.name, self.ip, self.dns_type)
88 83
 
89 84
     def get(self):
90 85
         return self.manager.get(self.domain, self.name)
@@ -96,8 +91,7 @@ class FloatingIPDNSEntryManager(base.Manager):
96 91
     def get(self, domain, name):
97 92
         """Return a list of entries for the given domain and ip or name."""
98 93
         return self._get("/os-floating-ip-dns/%s/entries/%s" %
99
-                              (_quote_domain(domain), name),
100
-                          "dns_entry")
94
+                         (_quote_domain(domain), name), "dns_entry")
101 95
 
102 96
     def get_for_ip(self, domain, ip):
103 97
         """Return a list of entries for the given domain and ip or name."""
@@ -105,32 +99,23 @@ class FloatingIPDNSEntryManager(base.Manager):
105 99
         params = "?%s" % parse.urlencode(qparams)
106 100
 
107 101
         return self._list("/os-floating-ip-dns/%s/entries%s" %
108
-                              (_quote_domain(domain), params),
109
-                          "dns_entries")
102
+                          (_quote_domain(domain), params), "dns_entries")
110 103
 
111 104
     def create(self, domain, name, ip, dns_type):
112 105
         """Add a new DNS entry."""
113
-        body = {'dns_entry':
114
-                 {'ip': ip,
115
-                  'dns_type': dns_type}}
106
+        body = {'dns_entry': {'ip': ip, 'dns_type': dns_type}}
116 107
 
117 108
         return self._update("/os-floating-ip-dns/%s/entries/%s" %
118
-                            (_quote_domain(domain), name),
119
-                            body,
120
-                            "dns_entry")
109
+                            (_quote_domain(domain), name), body, "dns_entry")
121 110
 
122 111
     def modify_ip(self, domain, name, ip):
123 112
         """Add a new DNS entry."""
124
-        body = {'dns_entry':
125
-                 {'ip': ip,
126
-                  'dns_type': 'A'}}
113
+        body = {'dns_entry': {'ip': ip, 'dns_type': 'A'}}
127 114
 
128 115
         return self._update("/os-floating-ip-dns/%s/entries/%s" %
129
-                            (_quote_domain(domain), name),
130
-                            body,
131
-                            "dns_entry")
116
+                            (_quote_domain(domain), name), body, "dns_entry")
132 117
 
133 118
     def delete(self, domain, name):
134 119
         """Delete entry specified by name and domain."""
135 120
         self._delete("/os-floating-ip-dns/%s/entries/%s" %
136
-                                (_quote_domain(domain), name))
121
+                     (_quote_domain(domain), name))

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

@@ -87,8 +87,8 @@ class ImageManager(base.ManagerWithFind):
87 87
         :param metadata: A dict of metadata to add to the image
88 88
         """
89 89
         body = {'metadata': metadata}
90
-        return self._create("/images/%s/metadata" % base.getid(image), body,
91
-                             "metadata")
90
+        return self._create("/images/%s/metadata" % base.getid(image),
91
+                            body, "metadata")
92 92
 
93 93
     def delete_meta(self, image, keys):
94 94
         """

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

@@ -1086,7 +1086,7 @@ class ServerManager(base.BootingManagerWithFind):
1086 1086
         """
1087 1087
         body = {'metadata': metadata}
1088 1088
         return self._create("/servers/%s/metadata" % base.getid(server),
1089
-                             body, "metadata")
1089
+                            body, "metadata")
1090 1090
 
1091 1091
     def set_meta_item(self, server, key, value):
1092 1092
         """

+ 9
- 10
novaclient/v1_1/shell.py View File

@@ -2367,8 +2367,8 @@ def _print_secgroups(secgroups):
2367 2367
 
2368 2368
 def _get_secgroup(cs, secgroup):
2369 2369
     # Check secgroup is an ID (nova-network) or UUID (neutron)
2370
-    if (utils.is_integer_like(encodeutils.safe_encode(secgroup))
2371
-               or uuidutils.is_uuid_like(secgroup)):
2370
+    if (utils.is_integer_like(encodeutils.safe_encode(secgroup)) or
2371
+            uuidutils.is_uuid_like(secgroup)):
2372 2372
         try:
2373 2373
             return cs.security_groups.get(secgroup)
2374 2374
         except exceptions.NotFound:
@@ -2377,9 +2377,8 @@ def _get_secgroup(cs, secgroup):
2377 2377
     # Check secgroup as a name
2378 2378
     match_found = False
2379 2379
     for s in cs.security_groups.list():
2380
-        encoding = (locale.getpreferredencoding() or
2381
-            sys.stdin.encoding or
2382
-            'UTF-8')
2380
+        encoding = (
2381
+            locale.getpreferredencoding() or sys.stdin.encoding or 'UTF-8')
2383 2382
         if not six.PY3:
2384 2383
             s.name = s.name.encode(encoding)
2385 2384
         if secgroup == s.name:
@@ -3379,8 +3378,8 @@ def do_ssh(cs, args):
3379 3378
     match = lambda addr: all((
3380 3379
         addr.get('version') == version,
3381 3380
         addr.get('OS-EXT-IPS:type', 'floating') == address_type))
3382
-    matching_addresses = [address.get('addr') for address in network_addresses
3383
-                            if match(address)]
3381
+    matching_addresses = [address.get('addr')
3382
+                          for address in network_addresses if match(address)]
3384 3383
     if not any(matching_addresses):
3385 3384
         msg = _("No address that would match network '%(network)s'"
3386 3385
                 " and type '%(address_type)s' of version %(pretty_version)s "
@@ -3568,8 +3567,8 @@ def do_quota_defaults(cs, args):
3568 3567
     dest='force',
3569 3568
     action="store_true",
3570 3569
     default=None,
3571
-    help=_('Whether force update the quota even if the already used'
3572
-            ' and reserved exceeds the new quota'))
3570
+    help=_('Whether force update the quota even if the already used and '
3571
+           'reserved exceeds the new quota'))
3573 3572
 def do_quota_update(cs, args):
3574 3573
     """Update the quotas for a tenant/user."""
3575 3574
 
@@ -3902,7 +3901,7 @@ def do_secgroup_delete_default_rule(cs, args):
3902 3901
            default=argparse.SUPPRESS,
3903 3902
            nargs='*',
3904 3903
            help='Policies for the server groups '
3905
-            '("affinity" or "anti-affinity")')
3904
+                '("affinity" or "anti-affinity")')
3906 3905
 @utils.arg('--policy',
3907 3906
            default=[],
3908 3907
            action='append',

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

@@ -42,8 +42,8 @@ class SnapshotManager(base.ManagerWithFind):
42 42
     """
43 43
     resource_class = Snapshot
44 44
 
45
-    def create(self, volume_id, force=False,
46
-                    display_name=None, display_description=None):
45
+    def create(self, volume_id, force=False, display_name=None,
46
+               display_description=None):
47 47
 
48 48
         """
49 49
         Create a snapshot of the given volume.

+ 10
- 11
novaclient/v1_1/volumes.py View File

@@ -45,10 +45,9 @@ class VolumeManager(base.ManagerWithFind):
45 45
     """
46 46
     resource_class = Volume
47 47
 
48
-    def create(self, size, snapshot_id=None,
49
-                    display_name=None, display_description=None,
50
-                    volume_type=None, availability_zone=None,
51
-                    imageRef=None):
48
+    def create(self, size, snapshot_id=None, display_name=None,
49
+               display_description=None, volume_type=None,
50
+               availability_zone=None, imageRef=None):
52 51
         """
53 52
         Create a volume.
54 53
 
@@ -62,12 +61,12 @@ class VolumeManager(base.ManagerWithFind):
62 61
         :param imageRef: reference to an image stored in glance
63 62
         """
64 63
         body = {'volume': {'size': size,
65
-                            'snapshot_id': snapshot_id,
66
-                            'display_name': display_name,
67
-                            'display_description': display_description,
68
-                            'volume_type': volume_type,
69
-                            'availability_zone': availability_zone,
70
-                            'imageRef': imageRef}}
64
+                           'snapshot_id': snapshot_id,
65
+                           'display_name': display_name,
66
+                           'display_description': display_description,
67
+                           'volume_type': volume_type,
68
+                           'availability_zone': availability_zone,
69
+                           'imageRef': imageRef}}
71 70
         return self._create('/volumes', body, 'volume')
72 71
 
73 72
     def get(self, volume_id):
@@ -162,4 +161,4 @@ class VolumeManager(base.ManagerWithFind):
162 161
         :param attachment_id: The ID of the attachment
163 162
         """
164 163
         self._delete("/servers/%s/os-volume_attachments/%s" %
165
-                                        (server_id, attachment_id,))
164
+                     (server_id, attachment_id,))

+ 3
- 3
novaclient/v3/servers.py View File

@@ -440,7 +440,7 @@ class ServerManager(base.BootingManagerWithFind):
440 440
         if block_device_mapping:
441 441
             bdm_param = 'block_device_mapping'
442 442
             body['server'][bdm_param] = \
443
-              self._parse_block_device_mapping(block_device_mapping)
443
+                self._parse_block_device_mapping(block_device_mapping)
444 444
         elif block_device_mapping_v2:
445 445
             # Append the image to the list only if we have new style BDMs
446 446
             bdm_param = 'block_device_mapping_v2'
@@ -893,8 +893,8 @@ class ServerManager(base.BootingManagerWithFind):
893 893
         :param metadata: A dict of metadata to add to the server
894 894
         """
895 895
         body = {'metadata': metadata}
896
-        return self._create("/servers/%s/metadata" % base.getid(server),
897
-                             body, "metadata")
896
+        return self._create(
897
+            "/servers/%s/metadata" % base.getid(server), body, "metadata")
898 898
 
899 899
     def get_console_output(self, server, length=None):
900 900
         """

+ 12
- 12
novaclient/v3/shell.py View File

@@ -94,8 +94,8 @@ def _boot(cs, args):
94 94
         max_count = args.num_instances
95 95
     elif (args.num_instances is not None and
96 96
           (args.min_count is not None or args.max_count is not None)):
97
-        raise exceptions.CommandError("Don't mix num-instances and "
98
-                                        "max/min-count")
97
+        raise exceptions.CommandError(
98
+            "Don't mix num-instances and max/min-count")
99 99
     if args.min_count is not None:
100 100
         if args.min_count < 1:
101 101
             raise exceptions.CommandError("min_count should be >= 1")
@@ -1945,8 +1945,8 @@ def do_secgroup_add_group_rule(cs, args):
1945 1945
 
1946 1946
     if args.ip_proto or args.from_port or args.to_port:
1947 1947
         if not (args.ip_proto and args.from_port and args.to_port):
1948
-            raise exceptions.CommandError("ip_proto, from_port, and to_port"
1949
-                                           " must be specified together")
1948
+            raise exceptions.CommandError(
1949
+                "ip_proto, from_port, and to_port must be specified together")
1950 1950
         params['ip_protocol'] = args.ip_proto.upper()
1951 1951
         params['from_port'] = args.from_port
1952 1952
         params['to_port'] = args.to_port
@@ -1979,8 +1979,8 @@ def do_secgroup_delete_group_rule(cs, args):
1979 1979
 
1980 1980
     if args.ip_proto or args.from_port or args.to_port:
1981 1981
         if not (args.ip_proto and args.from_port and args.to_port):
1982
-            raise exceptions.CommandError("ip_proto, from_port, and to_port"
1983
-                                           " must be specified together")
1982
+            raise exceptions.CommandError(
1983
+                "ip_proto, from_port, and to_port must be specified together")
1984 1984
         params['ip_protocol'] = args.ip_proto.upper()
1985 1985
         params['from_port'] = int(args.from_port)
1986 1986
         params['to_port'] = int(args.to_port)
@@ -2013,8 +2013,8 @@ def do_keypair_add(cs, args):
2013 2013
             with open(os.path.expanduser(pub_key)) as f:
2014 2014
                 pub_key = f.read()
2015 2015
         except IOError as e:
2016
-            raise exceptions.CommandError("Can't open or read '%s': %s" %
2017
-                                                          (pub_key, e))
2016
+            raise exceptions.CommandError(
2017
+                "Can't open or read '%s': %s" % (pub_key, e))
2018 2018
 
2019 2019
     keypair = cs.keypairs.create(name, pub_key)
2020 2020
 
@@ -2822,8 +2822,8 @@ def do_ssh(cs, args):
2822 2822
     match = lambda addr: all((
2823 2823
         addr.get('version') == version,
2824 2824
         addr.get('OS-EXT-IPS:type', 'floating') == address_type))
2825
-    matching_addresses = [address.get('addr') for address in network_addresses
2826
-                            if match(address)]
2825
+    matching_addresses = [address.get('addr')
2826
+                          for address in network_addresses if match(address)]
2827 2827
     if not any(matching_addresses):
2828 2828
         msg = _("No address that would match network '%(network)s'"
2829 2829
                 " and type '%(address_type)s' of version %(pretty_version)s "
@@ -2980,8 +2980,8 @@ def do_quota_defaults(cs, args):
2980 2980
     dest='force',
2981 2981
     action="store_true",
2982 2982
     default=None,
2983
-    help='Whether force update the quota even if the already used'
2984
-            ' and reserved exceeds the new quota')
2983
+    help='Whether force update the quota even if the already used and '
2984
+         'reserved exceeds the new quota')
2985 2985
 def do_quota_update(cs, args):
2986 2986
     """Update the quotas for a tenant."""
2987 2987
 

+ 1
- 1
tox.ini View File

@@ -42,7 +42,7 @@ downloadcache = ~/cache/pip
42 42
 # reason: removed in hacking (https://review.openstack.org/#/c/101701/)
43 43
 #
44 44
 # Additional checks are also ignored on purpose: F811, F821
45
-ignore = E124,E127,E128,E129,F811,F821,H402,H404,H405,H904
45
+ignore = E124,E128,E129,F811,F821,H402,H404,H405,H904
46 46
 show-source = True
47 47
 exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,build,doc/source/conf.py
48 48
 

Loading…
Cancel
Save