Skip to content

Commit 0bf79ca

Browse files
committed
[CE-489] Fixed Code Format Issue
The updated of flake8 will lead to failure of 'make check', because some of the existed codes are unable to pass the extended format check, this patch make the following changes for fixing this problem: 1. Ignore flake8 W504(break after binary operator) checking 2. Ignore flake8 W605(invalid escape sequence) checking 3. Remove some unused variable CE-489 #done Change-Id: Ied16719faa8a2caf0bd4dfabd72a0e095cf2e5ea Signed-off-by: luke <jiahaochen1993@gmail.com>
1 parent ea7d123 commit 0bf79ca

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/agent/vsphere/host.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def create(self, vcip, username, pwd, port, params, hid):
4444
connection = si.RetrieveContent()
4545
vc_resources = params.get(VCENTER)
4646

47-
except Exception as e:
47+
except Exception:
4848
error_msg = (
4949
"Cannot complete login due"
5050
"to an incorrect user name or password."

src/agent/vsphere/host_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,6 @@ def check_isport_open(self, vmip, vmport, timeout=300):
437437
timeout -= 5
438438
sk.connect((vmip, vmport))
439439
return True
440-
except Exception as e:
440+
except Exception:
441441
pass
442442
return False

src/common/stringvalidator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def validate(self, input, checks=[], log=False):
4242
return False
4343

4444
except Exception as e:
45-
raise
45+
raise e
4646

4747
return True if not fail else results
4848

@@ -55,7 +55,7 @@ def _check_is_numeric(self, input):
5555
try:
5656
float(input)
5757
return True
58-
except Exception as e:
58+
except Exception:
5959
return False
6060

6161
def _check_is_alpha(self, input):
@@ -71,14 +71,14 @@ def _check_is_integer(self, input):
7171
try:
7272
int(input)
7373
return True
74-
except Exception as e:
74+
except Exception:
7575
return False
7676

7777
def _check_is_float(self, input):
7878
"""Check if a given string is float"""
7979
try:
8080
return True if str(float(input)) == input else False
81-
except Exception as e:
81+
except Exception:
8282
return False
8383

8484
def _check_longer_than(self, input, args):

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ basepython = python3
2121
skip_install = true
2222
deps = flake8
2323
-r{toxinidir}/src/requirements.txt
24-
commands = flake8 --ignore=E402,F401 {toxinidir}/src
24+
commands = flake8 --ignore=E402,F401,W504,W605 {toxinidir}/src

0 commit comments

Comments
 (0)