Skip to content

Commit

Permalink
[CE-489] Fixed Code Format Issue
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jiahaoc1993 committed Oct 26, 2018
1 parent ea7d123 commit 0bf79ca
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/agent/vsphere/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def create(self, vcip, username, pwd, port, params, hid):
connection = si.RetrieveContent()
vc_resources = params.get(VCENTER)

except Exception as e:
except Exception:
error_msg = (
"Cannot complete login due"
"to an incorrect user name or password."
Expand Down
2 changes: 1 addition & 1 deletion src/agent/vsphere/host_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,6 @@ def check_isport_open(self, vmip, vmport, timeout=300):
timeout -= 5
sk.connect((vmip, vmport))
return True
except Exception as e:
except Exception:
pass
return False
8 changes: 4 additions & 4 deletions src/common/stringvalidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def validate(self, input, checks=[], log=False):
return False

except Exception as e:
raise
raise e

return True if not fail else results

Expand All @@ -55,7 +55,7 @@ def _check_is_numeric(self, input):
try:
float(input)
return True
except Exception as e:
except Exception:
return False

def _check_is_alpha(self, input):
Expand All @@ -71,14 +71,14 @@ def _check_is_integer(self, input):
try:
int(input)
return True
except Exception as e:
except Exception:
return False

def _check_is_float(self, input):
"""Check if a given string is float"""
try:
return True if str(float(input)) == input else False
except Exception as e:
except Exception:
return False

def _check_longer_than(self, input, args):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ basepython = python3
skip_install = true
deps = flake8
-r{toxinidir}/src/requirements.txt
commands = flake8 --ignore=E402,F401 {toxinidir}/src
commands = flake8 --ignore=E402,F401,W504,W605 {toxinidir}/src

0 comments on commit 0bf79ca

Please sign in to comment.