Skip to content

Commit 17448ad

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Clean up W503 and E402 pep8 errors"
2 parents 30b2203 + d601415 commit 17448ad

13 files changed

Lines changed: 232 additions & 255 deletions

File tree

openstackclient/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
# under the License.
1212
#
1313

14-
__all__ = ['__version__']
15-
1614
import pbr.version
1715

16+
__all__ = ['__version__']
17+
1818
version_info = pbr.version.VersionInfo('python-openstackclient')
1919
try:
2020
__version__ = version_info.version_string()

openstackclient/common/extension.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ def take_action(self, parsed_args):
7575
# by default we want to show everything, unless the
7676
# user specifies one or more of the APIs to show
7777
# for now, only identity and compute are supported.
78-
show_all = (not parsed_args.identity and not parsed_args.compute
79-
and not parsed_args.volume and not parsed_args.network)
78+
show_all = (not parsed_args.identity and
79+
not parsed_args.compute and
80+
not parsed_args.volume and
81+
not parsed_args.network)
8082

8183
if parsed_args.identity or show_all:
8284
identity_client = self.app.client_manager.identity

openstackclient/identity/v3/role.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ def get_parser(self, prog_name):
126126
def take_action(self, parsed_args):
127127
identity_client = self.app.client_manager.identity
128128

129-
if (not parsed_args.user and not parsed_args.domain
130-
and not parsed_args.group and not parsed_args.project):
129+
if (not parsed_args.user and not parsed_args.domain and
130+
not parsed_args.group and not parsed_args.project):
131131
msg = _("Role not added, incorrect set of arguments "
132132
"provided. See openstack --help for more details")
133133
raise exceptions.CommandError(msg)
@@ -399,8 +399,8 @@ def get_parser(self, prog_name):
399399
def take_action(self, parsed_args):
400400
identity_client = self.app.client_manager.identity
401401

402-
if (not parsed_args.user and not parsed_args.domain
403-
and not parsed_args.group and not parsed_args.project):
402+
if (not parsed_args.user and not parsed_args.domain and
403+
not parsed_args.group and not parsed_args.project):
404404
msg = _("Incorrect set of arguments provided. "
405405
"See openstack --help for more details")
406406
raise exceptions.CommandError(msg)

openstackclient/image/v1/image.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121
import os
2222
import sys
2323

24-
if os.name == "nt":
25-
import msvcrt
26-
else:
27-
msvcrt = None
28-
2924
from glanceclient.common import utils as gc_utils
3025
from osc_lib.cli import parseractions
3126
from osc_lib.command import command
@@ -35,6 +30,11 @@
3530
from openstackclient.api import utils as api_utils
3631
from openstackclient.i18n import _
3732

33+
if os.name == "nt":
34+
import msvcrt
35+
else:
36+
msvcrt = None
37+
3838

3939
CONTAINER_CHOICES = ["ami", "ari", "aki", "bare", "docker", "ova", "ovf"]
4040
DEFAULT_CONTAINER_FORMAT = 'bare'

openstackclient/network/v2/router.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ def _get_attrs(client_manager, parsed_args):
8686
attrs['distributed'] = False
8787
if parsed_args.distributed:
8888
attrs['distributed'] = True
89-
if ('availability_zone_hints' in parsed_args
90-
and parsed_args.availability_zone_hints is not None):
89+
if ('availability_zone_hints' in parsed_args and
90+
parsed_args.availability_zone_hints is not None):
9191
attrs['availability_zone_hints'] = parsed_args.availability_zone_hints
9292
if parsed_args.description is not None:
9393
attrs['description'] = parsed_args.description

openstackclient/tests/functional/network/v2/test_network.py

Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_network_delete_network(self):
209209
cmd_output["description"],
210210
)
211211

212-
del_output = self.openstack('network delete ' + name1 + ' ' + name2)
212+
del_output = self.openstack('network delete %s %s' % (name1, name2))
213213
self.assertOutput('', del_output)
214214

215215
def test_network_list(self):
@@ -224,7 +224,7 @@ def test_network_list(self):
224224
network_options +
225225
name1
226226
))
227-
self.addCleanup(self.openstack, 'network delete ' + name1)
227+
self.addCleanup(self.openstack, 'network delete %s' % name1)
228228
self.assertIsNotNone(cmd_output["id"])
229229
if self.haz_network:
230230
self.assertEqual(
@@ -264,10 +264,8 @@ def test_network_list(self):
264264
else:
265265
network_options = '--subnet 4.5.6.7/28 '
266266
cmd_output = json.loads(self.openstack(
267-
'network create -f json ' +
268-
'--share ' +
269-
network_options +
270-
name2
267+
'network create -f json --share %s%s' %
268+
(network_options, name2)
271269
))
272270
self.addCleanup(self.openstack, 'network delete ' + name2)
273271
self.assertIsNotNone(cmd_output["id"])
@@ -313,8 +311,7 @@ def test_network_list(self):
313311
# Test list --long
314312
if self.haz_network:
315313
cmd_output = json.loads(self.openstack(
316-
"network list -f json " +
317-
"--long"
314+
"network list -f json --long"
318315
))
319316
col_name = [x["Name"] for x in cmd_output]
320317
self.assertIn(name1, col_name)
@@ -323,9 +320,7 @@ def test_network_list(self):
323320
# Test list --long --enable
324321
if self.haz_network:
325322
cmd_output = json.loads(self.openstack(
326-
"network list -f json " +
327-
"--enable " +
328-
"--long"
323+
"network list -f json --enable --long"
329324
))
330325
col_name = [x["Name"] for x in cmd_output]
331326
self.assertIn(name1, col_name)
@@ -334,9 +329,7 @@ def test_network_list(self):
334329
# Test list --long --disable
335330
if self.haz_network:
336331
cmd_output = json.loads(self.openstack(
337-
"network list -f json " +
338-
"--disable " +
339-
"--long"
332+
"network list -f json --disable --long"
340333
))
341334
col_name = [x["Name"] for x in cmd_output]
342335
self.assertNotIn(name1, col_name)
@@ -345,8 +338,7 @@ def test_network_list(self):
345338
# Test list --share
346339
if self.haz_network:
347340
cmd_output = json.loads(self.openstack(
348-
"network list -f json " +
349-
"--share "
341+
"network list -f json --share "
350342
))
351343
col_name = [x["Name"] for x in cmd_output]
352344
self.assertNotIn(name1, col_name)
@@ -355,8 +347,7 @@ def test_network_list(self):
355347
# Test list --no-share
356348
if self.haz_network:
357349
cmd_output = json.loads(self.openstack(
358-
"network list -f json " +
359-
"--no-share "
350+
"network list -f json --no-share "
360351
))
361352
col_name = [x["Name"] for x in cmd_output]
362353
self.assertIn(name1, col_name)
@@ -368,12 +359,10 @@ def test_network_dhcp_agent(self):
368359

369360
name1 = uuid.uuid4().hex
370361
cmd_output1 = json.loads(self.openstack(
371-
'network create -f json ' +
372-
'--description aaaa ' +
373-
name1
362+
'network create -f json --description aaaa %s' % name1
374363
))
375364

376-
self.addCleanup(self.openstack, 'network delete ' + name1)
365+
self.addCleanup(self.openstack, 'network delete %s' % name1)
377366

378367
# Get network ID
379368
network_id = cmd_output1['id']
@@ -386,20 +375,19 @@ def test_network_dhcp_agent(self):
386375

387376
# Add Agent to Network
388377
self.openstack(
389-
'network agent add network --dhcp '
390-
+ agent_id + ' ' + network_id
378+
'network agent add network --dhcp %s %s' % (agent_id, network_id)
391379
)
392380

393381
# Test network list --agent
394382
cmd_output3 = json.loads(self.openstack(
395-
'network list -f json --agent ' + agent_id
383+
'network list -f json --agent %s' % agent_id
396384
))
397385

398386
# Cleanup
399387
# Remove Agent from Network
400388
self.openstack(
401-
'network agent remove network --dhcp '
402-
+ agent_id + ' ' + network_id
389+
'network agent remove network --dhcp %s %s' %
390+
(agent_id, network_id)
403391
)
404392

405393
# Assert
@@ -415,16 +403,16 @@ def test_network_set(self):
415403

416404
name = uuid.uuid4().hex
417405
cmd_output = json.loads(self.openstack(
418-
'network create -f json ' +
419-
'--description aaaa ' +
420-
'--enable ' +
421-
'--no-share ' +
422-
'--internal ' +
423-
'--no-default ' +
424-
'--enable-port-security ' +
406+
'network create -f json '
407+
'--description aaaa '
408+
'--enable '
409+
'--no-share '
410+
'--internal '
411+
'--no-default '
412+
'--enable-port-security %s' %
425413
name
426414
))
427-
self.addCleanup(self.openstack, 'network delete ' + name)
415+
self.addCleanup(self.openstack, 'network delete %s' % name)
428416
self.assertIsNotNone(cmd_output["id"])
429417
self.assertEqual(
430418
'aaaa',
@@ -453,12 +441,12 @@ def test_network_set(self):
453441
)
454442

455443
raw_output = self.openstack(
456-
'network set ' +
457-
'--description cccc ' +
458-
'--disable ' +
459-
'--share ' +
460-
'--external ' +
461-
'--disable-port-security ' +
444+
'network set '
445+
'--description cccc '
446+
'--disable '
447+
'--share '
448+
'--external '
449+
'--disable-port-security %s' %
462450
name
463451
)
464452
self.assertOutput('', raw_output)

openstackclient/tests/functional/network/v2/test_network_agent.py

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ def test_network_agent_list_show_set(self):
4242

4343
# agent show
4444
cmd_output = json.loads(self.openstack(
45-
'network agent show -f json ' +
46-
agent_ids[0]
45+
'network agent show -f json %s' % agent_ids[0]
4746
))
4847
self.assertEqual(
4948
agent_ids[0],
@@ -52,31 +51,25 @@ def test_network_agent_list_show_set(self):
5251

5352
# agent set
5453
raw_output = self.openstack(
55-
'network agent set ' +
56-
'--disable ' +
57-
agent_ids[0]
54+
'network agent set --disable %s' % agent_ids[0]
5855
)
5956
self.assertOutput('', raw_output)
6057

6158
cmd_output = json.loads(self.openstack(
62-
'network agent show -f json ' +
63-
agent_ids[0]
59+
'network agent show -f json %s' % agent_ids[0]
6460
))
6561
self.assertEqual(
6662
"DOWN",
6763
cmd_output['admin_state_up'],
6864
)
6965

7066
raw_output = self.openstack(
71-
'network agent set ' +
72-
'--enable ' +
73-
agent_ids[0]
67+
'network agent set --enable %s' % agent_ids[0]
7468
)
7569
self.assertOutput('', raw_output)
7670

7771
cmd_output = json.loads(self.openstack(
78-
'network agent show -f json ' +
79-
agent_ids[0]
72+
'network agent show -f json %s' % agent_ids[0]
8073
))
8174
self.assertEqual(
8275
"UP",
@@ -98,12 +91,10 @@ def test_network_dhcp_agent_list(self):
9891

9992
name1 = uuid.uuid4().hex
10093
cmd_output1 = json.loads(self.openstack(
101-
'network create -f json ' +
102-
'--description aaaa ' +
103-
name1
94+
'network create -f json --description aaaa %s' % name1
10495
))
10596

106-
self.addCleanup(self.openstack, 'network delete ' + name1)
97+
self.addCleanup(self.openstack, 'network delete %s' % name1)
10798

10899
# Get network ID
109100
network_id = cmd_output1['id']
@@ -116,20 +107,20 @@ def test_network_dhcp_agent_list(self):
116107

117108
# Add Agent to Network
118109
self.openstack(
119-
'network agent add network --dhcp '
120-
+ agent_id + ' ' + network_id
110+
'network agent add network --dhcp %s %s' %
111+
(agent_id, network_id)
121112
)
122113

123114
# Test network agent list --network
124115
cmd_output3 = json.loads(self.openstack(
125-
'network agent list -f json --network ' + network_id
116+
'network agent list -f json --network %s' % network_id
126117
))
127118

128119
# Cleanup
129120
# Remove Agent from Network
130121
self.openstack(
131-
'network agent remove network --dhcp '
132-
+ agent_id + ' ' + network_id
122+
'network agent remove network --dhcp %s %s' %
123+
(agent_id, network_id)
133124
)
134125

135126
# Assert
@@ -142,9 +133,9 @@ def test_network_agent_list_routers(self):
142133
"""Add agent to router, list agents on router, delete."""
143134
name = uuid.uuid4().hex
144135
cmd_output = json.loads(self.openstack(
145-
'router create -f json ' + name))
136+
'router create -f json %s' % name))
146137

147-
self.addCleanup(self.openstack, 'router delete ' + name)
138+
self.addCleanup(self.openstack, 'router delete %s' % name)
148139
# Get router ID
149140
router_id = cmd_output['id']
150141
# Get l3 agent id
@@ -157,19 +148,19 @@ def test_network_agent_list_routers(self):
157148

158149
# Add router to agent
159150
self.openstack(
160-
'network agent add router --l3 ' + agent_id + ' ' + router_id)
151+
'network agent add router --l3 %s %s' % (agent_id, router_id))
161152

162153
# Test router list --agent
163154
cmd_output = json.loads(self.openstack(
164-
'network agent list -f json --router ' + router_id))
155+
'network agent list -f json --router %s' % router_id))
165156

166157
agent_ids = [x['ID'] for x in cmd_output]
167158
self.assertIn(agent_id, agent_ids)
168159

169160
# Remove router from agent
170161
self.openstack(
171-
'network agent remove router --l3 ' + agent_id + ' ' + router_id)
162+
'network agent remove router --l3 %s %s' % (agent_id, router_id))
172163
cmd_output = json.loads(self.openstack(
173-
'network agent list -f json --router ' + router_id))
164+
'network agent list -f json --router %s' % router_id))
174165
agent_ids = [x['ID'] for x in cmd_output]
175166
self.assertNotIn(agent_id, agent_ids)

openstackclient/tests/functional/network/v2/test_network_flavor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ def test_network_flavor_add_remove_profile(self):
3939
# Create Service Flavor
4040
cmd_output2 = json.loads(self.openstack(
4141
'network flavor profile create -f json --description '
42-
+ 'fakedescription' + ' --enable --metainfo ' + 'Extrainfo'
42+
'fakedescription --enable --metainfo Extrainfo'
4343
))
4444
service_profile_id = cmd_output2.get('id')
4545

46-
self.addCleanup(self.openstack, 'network flavor delete ' +
46+
self.addCleanup(self.openstack, 'network flavor delete %s' %
4747
flavor_id)
48-
self.addCleanup(self.openstack, 'network flavor profile delete ' +
48+
self.addCleanup(self.openstack, 'network flavor profile delete %s' %
4949
service_profile_id)
5050
# Add flavor to service profile
5151
self.openstack(

0 commit comments

Comments
 (0)