Skip to content

Commit c6d3f6e

Browse files
authored
pre-commit: enable Python flake8 rule E271 (#9358)
1 parent a1d8bab commit c6d3f6e

File tree

14 files changed

+18
-17
lines changed

14 files changed

+18
-17
lines changed

.github/linters/.flake8

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# E224 Tab after operator
2323
# E227 Missing whitespace around bitwise or shift operator
2424
# E242 Tab after ','
25+
# E271 Multiple spaces after keyword
2526
# E273 Tab after keyword
2627
# E274 Tab before keyword
2728
# E713 Test for membership should be 'not in'
@@ -38,4 +39,4 @@
3839
exclude =
3940
.git,
4041
venv
41-
select = E112,E113,E133,E223,E224,E227,E242,E273,E274,E713,E742,E743,E901,E902,W291,W292,W293,W391
42+
select = E112,E113,E133,E223,E224,E227,E242,E271,E273,E274,E713,E742,E743,E901,E902,W291,W292,W293,W391

python/lib/cloud_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def list_zonespods(host):
375375
x = [ (zonename,podname)
376376
for pod in dom.childNodes[0].childNodes
377377
for podname in [ x.childNodes[0].wholeText for x in pod.childNodes if x.tagName == "name" ]
378-
for zonename in [ x.childNodes[0].wholeText for x in pod.childNodes if x.tagName == "zonename" ]
378+
for zonename in [ x.childNodes[0].wholeText for x in pod.childNodes if x.tagName == "zonename" ]
379379
]
380380
return x
381381

python/lib/cloudutils/syscfg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def check(self):
114114
pass
115115

116116
if size != -1 and size < (30 * 1024 * 1024):
117-
raise CloudRuntimeException("Need at least 30G free disk space under /var/lib/libvirt/images")
117+
raise CloudRuntimeException("Need at least 30G free disk space under /var/lib/libvirt/images")
118118

119119
#check memory
120120
mem = -1
@@ -124,7 +124,7 @@ def check(self):
124124
pass
125125

126126
if mem != -1 and mem < 1:
127-
raise CloudRuntimeException("Need at least 1G memory")
127+
raise CloudRuntimeException("Need at least 1G memory")
128128

129129

130130
if os.geteuid() != 0:

python/lib/cloudutils/utilities.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ def alarm_handler(signum, frame):
4747
alarm(0)
4848
except Alarm:
4949
os.kill(self.process.pid, SIGKILL)
50-
raise CloudRuntimeException("Timeout during command execution")
50+
raise CloudRuntimeException("Timeout during command execution")
5151

5252
self.success = self.process.returncode == 0
5353
except:
54-
raise CloudRuntimeException(formatExceptionInfo())
54+
raise CloudRuntimeException(formatExceptionInfo())
5555

5656
if not self.success:
5757
logging.debug("Failed to execute:" + self.getErrMsg())

systemvm/debian/root/monitorServices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def getServicesConfig( config_file_path = "/etc/monitor.conf" ):
6767
process_dict[section][name] = value
6868
printd (" %s = %r" % (name, value))
6969

70-
return process_dict
70+
return process_dict
7171

7272
def printd (msg):
7373
"""

test/integration/component/maint/testpath_vMotion_vmware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ def test_02_vm_and_volumes_live_migration_for_vmware_vmfs_local_storage(self, fi
11901190
a) Create VM snapshots to check data integrity - @method used : VmSnapshotToCheckDataIntegrity(self, vm)
11911191
c) Check for VM accessibility by sshing to the VM - @method used : check_for_vm_access_by_ssh_using_nat(self, virtual_machine_1)
11921192
"""
1193-
if not self.zone.localstorageenabled:
1193+
if not self.zone.localstorageenabled:
11941194
raise self.skipTest("The setup doesn't have local storage enabled")
11951195
scope = first_value
11961196
ostype = second_value

test/integration/component/test_interop_xd_ccp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def test_10_detach_volume(self):
571571
id=self.volume.id
572572
)
573573

574-
if list_volume_response1[0].virtualmachineid is None:
574+
if list_volume_response1[0].virtualmachineid is None:
575575
self.skipTest("Check if volume is attached to the VM before detach")
576576

577577
self.virtual_machine.detach_volume(self.user_api_client, self.volume)
@@ -618,7 +618,7 @@ def test_11_delete_detached_volume(self):
618618
id=self.volume.id
619619
)
620620

621-
if list_volume_response1[0].virtualmachineid is not None:
621+
if list_volume_response1[0].virtualmachineid is not None:
622622
self.skipTest("Check if volume is detached before deleting")
623623

624624
cmd = deleteVolume.deleteVolumeCmd()

test/integration/component/test_rootvolume_resize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ def test_03_vmsnapshot__on_resized_rootvolume_vm(self):
647647
self.assertEqual(virtualmachine_snapshot.id,
648648
virtulmachine_snapshot_list[0].id,
649649
"Virtual Machine Snapshot id do not match")
650-
except Exception as e:
650+
except Exception as e:
651651
raise Exception("Issue CLOUDSTACK-10080: Exception while performing"
652652
" vmsnapshot: %s" % e)
653653
else:

test/integration/smoke/test_kubernetes_clusters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ def getValidKubernetesCluster(self, size=1, control_nodes=1, version={}):
766766
self.verifyKubernetesCluster(cluster, cluster.name, None, size, control_nodes)
767767
self.debug("Existing Kubernetes cluster available with name %s" % cluster.name)
768768
return cluster
769-
except AssertionError as error:
769+
except AssertionError as error:
770770
self.debug("Existing cluster failed verification due to %s, need to deploy a new one" % error)
771771
self.deleteKubernetesClusterAndVerify(cluster.id, False, True)
772772

test/integration/smoke/test_privategw_acl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,6 @@ def get_guest_traffic_physical_network(self, apiclient, zoneid):
920920
(select id from physical_network where uuid='%s');" % physical_network.id
921921
)
922922
for traffic_type in traffic_type_list:
923-
if "Guest" in str(traffic_type[0]):
923+
if "Guest" in str(traffic_type[0]):
924924
return physical_network
925925
return None

0 commit comments

Comments
 (0)