Adopt the latest version of flake8, 6.1.0, and fix the issues detected
by the new version.
Change-Id: Iadaea2b02d80fe0cefb6322694f1988708b5daed
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
exclude: '\.robot'
- repo: https://github.com/PyCQA/flake8
- rev: 4.0.1
+ rev: 6.1.0
hooks:
- id: flake8
else:
if rsp.status_code not in [200, 201, 204]:
print(
- f"*WARN* [{req_no}] Status code {rsp.status_code}:"
+ f"*WARN* [{req_no}] Status code {rsp.status_code}: "
f" {req.method} {req.url}\n{rsp.text}"
)
num_errors += 1
@staticmethod
def print_safe_encoding(string):
try:
- if type(string) == unicode:
+ # FIXME: Python3 does not have 'unicode'
+ if isinstance(string, unicode):
encoding = "utf-8"
if hasattr(sys.stdout, "encoding") and sys.stdout.encoding:
encoding = sys.stdout.encoding