This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 806692bceaa pre-commit: enable Python flake8 rule `E272` (#9361)
806692bceaa is described below

commit 806692bceaa46950a21ddc8417ac1ebd379095ce
Author: John Bampton <jbamp...@users.noreply.github.com>
AuthorDate: Wed Jul 10 17:17:25 2024 +1000

    pre-commit: enable Python flake8 rule `E272` (#9361)
    
    There should be only one space before a keyword.
---
 .github/linters/.flake8                                             | 3 ++-
 .../ovm/src/main/scripts/vm/hypervisor/ovm/ConfigFileOps.py         | 2 +-
 python/lib/cloudutils/configFileOps.py                              | 2 +-
 scripts/vm/network/security_group.py                                | 4 ++--
 systemvm/debian/opt/cloud/bin/passwd_server_ip.py                   | 4 ++--
 test/integration/component/test_assign_vm.py                        | 6 +++---
 test/integration/component/test_egress_fw_rules.py                  | 6 +++---
 test/integration/plugins/storpool/TestStorPoolVolumes.py            | 4 ++--
 test/integration/plugins/storpool/sp_util.py                        | 4 ++--
 test/integration/testpaths/testpath_vmlc.py                         | 2 +-
 tools/marvin/marvin/deployDataCenter.py                             | 2 +-
 11 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/.github/linters/.flake8 b/.github/linters/.flake8
index 73cb430f182..3364ad14f29 100644
--- a/.github/linters/.flake8
+++ b/.github/linters/.flake8
@@ -23,6 +23,7 @@
 # E227 Missing whitespace around bitwise or shift operator
 # E242 Tab after ','
 # E271 Multiple spaces after keyword
+# E272 Multiple spaces before keyword
 # E273 Tab after keyword
 # E274 Tab before keyword
 # E713 Test for membership should be 'not in'
@@ -39,4 +40,4 @@
 exclude =
     .git,
     venv
-select = 
E112,E113,E133,E223,E224,E227,E242,E271,E273,E274,E713,E742,E743,E901,E902,W291,W292,W293,W391
+select = 
E112,E113,E133,E223,E224,E227,E242,E271,E272,E273,E274,E713,E742,E743,E901,E902,W291,W292,W293,W391
diff --git 
a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/ConfigFileOps.py 
b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/ConfigFileOps.py
index bd922623656..6cfa6bb1396 100755
--- 
a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/ConfigFileOps.py
+++ 
b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/ConfigFileOps.py
@@ -58,7 +58,7 @@ class ConfigFileOps:
     def save(self):
         fp = open(self.fileName, "r")
         newLines = []
-        for line  in fp.readlines():
+        for line in fp.readlines():
             matched = False
             for entry in self.entries:
                 if entry.op == "add":
diff --git a/python/lib/cloudutils/configFileOps.py 
b/python/lib/cloudutils/configFileOps.py
index 41e9c7a1e8e..c061071b96e 100644
--- a/python/lib/cloudutils/configFileOps.py
+++ b/python/lib/cloudutils/configFileOps.py
@@ -63,7 +63,7 @@ class configFileOps:
         newLines = []
         if os.path.exists(self.fileName) and os.path.isfile(self.fileName):
             fp = open(self.fileName, "r")
-            for line  in fp.readlines():
+            for line in fp.readlines():
                 matched = False
                 for entry in self.entries:
                     if entry.op == "add":
diff --git a/scripts/vm/network/security_group.py 
b/scripts/vm/network/security_group.py
index 37a1a94fe7f..d71e27eb264 100755
--- a/scripts/vm/network/security_group.py
+++ b/scripts/vm/network/security_group.py
@@ -938,7 +938,7 @@ def cleanup_rules():
                 vmpresent = False
 
                 for vm in vmsInHost:
-                    if vm_name  in vm:
+                    if vm_name in vm:
                         vmpresent = True
                         break
 
@@ -958,7 +958,7 @@ def cleanup_rules():
                 vm_name = chain
                 vmpresent = False
                 for vm in vmsInHost:
-                    if vm_name  in vm:
+                    if vm_name in vm:
                         vmpresent = True
                         break
 
diff --git a/systemvm/debian/opt/cloud/bin/passwd_server_ip.py 
b/systemvm/debian/opt/cloud/bin/passwd_server_ip.py
index 4d296176aa3..08e6b838f18 100755
--- a/systemvm/debian/opt/cloud/bin/passwd_server_ip.py
+++ b/systemvm/debian/opt/cloud/bin/passwd_server_ip.py
@@ -33,8 +33,8 @@ import syslog
 import threading
 import urllib.parse
 
-from http.server   import BaseHTTPRequestHandler, HTTPServer
-from socketserver     import ThreadingMixIn #, ForkingMixIn
+from http.server import BaseHTTPRequestHandler, HTTPServer
+from socketserver import ThreadingMixIn #, ForkingMixIn
 
 
 passMap = {}
diff --git a/test/integration/component/test_assign_vm.py 
b/test/integration/component/test_assign_vm.py
index c2ee442e32e..e01f6fbc686 100644
--- a/test/integration/component/test_assign_vm.py
+++ b/test/integration/component/test_assign_vm.py
@@ -18,9 +18,9 @@
 """
 """
 #Import Local Modules
-from nose.plugins.attrib           import attr
-from marvin.cloudstackTestCase     import cloudstackTestCase
-from marvin.lib.base   import (Account,
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.base import (Account,
                                            Domain,
                                            User,
                                            Project,
diff --git a/test/integration/component/test_egress_fw_rules.py 
b/test/integration/component/test_egress_fw_rules.py
index 7e045a6f845..780f9f2615d 100644
--- a/test/integration/component/test_egress_fw_rules.py
+++ b/test/integration/component/test_egress_fw_rules.py
@@ -18,10 +18,10 @@
 """
 """
 #Import Local Modules
-from nose.plugins.attrib           import attr
-from marvin.cloudstackTestCase     import cloudstackTestCase
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
 import unittest
-from marvin.lib.base   import (Account,
+from marvin.lib.base import (Account,
                                            Domain,
                                            Router,
                                            Network,
diff --git a/test/integration/plugins/storpool/TestStorPoolVolumes.py 
b/test/integration/plugins/storpool/TestStorPoolVolumes.py
index 640a2f9d2bc..70f8900df58 100644
--- a/test/integration/plugins/storpool/TestStorPoolVolumes.py
+++ b/test/integration/plugins/storpool/TestStorPoolVolumes.py
@@ -2073,7 +2073,7 @@ class TestStoragePool(cloudstackTestCase):
                clusterid = c.id
                )
            for conf in configuration:
-               if conf.name == 'sp.cluster.id'  and (conf.value in 
clusterid[1]):
+               if conf.name == 'sp.cluster.id' and (conf.value in 
clusterid[1]):
                    return c
 
     @classmethod
@@ -2088,7 +2088,7 @@ class TestStoragePool(cloudstackTestCase):
                clusterid = c.id
                )
            for conf in configuration:
-               if conf.name == 'sp.cluster.id'  and (conf.value not in 
clusterid[1]):
+               if conf.name == 'sp.cluster.id' and (conf.value not in 
clusterid[1]):
                    return c
 
     @classmethod
diff --git a/test/integration/plugins/storpool/sp_util.py 
b/test/integration/plugins/storpool/sp_util.py
index 569aa4a2539..eaea3d4934d 100644
--- a/test/integration/plugins/storpool/sp_util.py
+++ b/test/integration/plugins/storpool/sp_util.py
@@ -384,7 +384,7 @@ class StorPoolHelper():
                clusterid = c.id
                )
            for conf in configuration:
-               if conf.name == 'sp.cluster.id'  and (conf.value in 
clusterid[1]):
+               if conf.name == 'sp.cluster.id' and (conf.value in 
clusterid[1]):
                    return c
 
     @classmethod
@@ -399,7 +399,7 @@ class StorPoolHelper():
                clusterid = c.id
                )
            for conf in configuration:
-               if conf.name == 'sp.cluster.id'  and (conf.value not in 
clusterid[1]):
+               if conf.name == 'sp.cluster.id' and (conf.value not in 
clusterid[1]):
                    return c
 
     @classmethod
diff --git a/test/integration/testpaths/testpath_vmlc.py 
b/test/integration/testpaths/testpath_vmlc.py
index 0ae70c8e4bd..8384a472a0b 100755
--- a/test/integration/testpaths/testpath_vmlc.py
+++ b/test/integration/testpaths/testpath_vmlc.py
@@ -338,7 +338,7 @@ class TestPathVMLC(cloudstackTestCase):
         # 13. Find suitable host for VM to migrate and migrate the VM
         # 14. Verify VM accessibility on new host
         """
-        if self.hypervisor.lower() in ['hyperv', 'lxc']  and value == 
VPC_NETWORK:
+        if self.hypervisor.lower() in ['hyperv', 'lxc'] and value == 
VPC_NETWORK:
             self.skipTest("can't be run for {} 
hypervisor".format(self.hypervisor))
 
         # List created service offering in setUpClass by name
diff --git a/tools/marvin/marvin/deployDataCenter.py 
b/tools/marvin/marvin/deployDataCenter.py
index 4e23a6a5d45..db88f762788 100644
--- a/tools/marvin/marvin/deployDataCenter.py
+++ b/tools/marvin/marvin/deployDataCenter.py
@@ -172,7 +172,7 @@ class DeployDataCenters(object):
     def addBaremetalRct(self, config):
         networktype= config.zones[0].networktype
         baremetalrcturl= config.zones[0].baremetalrcturl
-        if networktype is None or baremetalrcturl  is None:
+        if networktype is None or baremetalrcturl is None:
             return
         if networktype.lower()=="advanced":
 

Reply via email to