Cleanup pep8 and flake8 errors in nova-api-proxy

A newer version of flake8 needed to be used, and
several error codes are no longer being suppressed.

Closes-Bug: 1906529
Signed-off-by: albailey <Al.Bailey@windriver.com>
Change-Id: Ifc38b664722da533fbf46614d59c00670c8f8780
This commit is contained in:
albailey 2020-12-02 09:13:48 -06:00
parent 43e6a9f768
commit f529a7e337
6 changed files with 10 additions and 20 deletions

View File

@ -53,8 +53,8 @@ class APIController(Middleware):
def __call__(self, req):
self._generate_log(req)
LOG.debug("Check if it is a NFVI action")
if (req.environ['REQUEST_METHOD'] == 'POST' and
self._is_nfvi_request(req)):
if (req.environ['REQUEST_METHOD'] == 'POST' and self._is_nfvi_request(
req)):
remote_host = CONF.nfvi_compute_listen
remote_port = CONF.nfvi_compute_listen_port
return APIDispatcher(self.application, remote_host, remote_port)
@ -169,7 +169,7 @@ class DebugHeaders(Middleware):
translate_keys = {
'CONTENT_LENGTH': 'HTTP_CONTENT_LENGTH',
'CONTENT_TYPE': 'HTTP_CONTENT_TYPE',
}
}
def __init__(self, app, conf):
self._show_body = CONF.show_request_body

View File

@ -89,8 +89,7 @@ class DebugProxy(Application):
else:
body = ''
path = (environ.get('SCRIPT_NAME', '') +
environ.get('PATH_INFO', ''))
path = (environ.get('SCRIPT_NAME', '') + environ.get('PATH_INFO', ''))
path = urllib.quote(path)
if 'QUERY_STRING' in environ:
path += '?' + environ['QUERY_STRING']

View File

@ -101,8 +101,8 @@ class Histogram(object):
for idx, bucket_value in enumerate(self._buckets):
if 0 != bucket_value:
LOG.info(" %03i [up to %03i secs]: %07i %s"
% (idx, math.pow(2, idx), bucket_value,
'*' * min(60, bucket_value)))
% (idx, math.pow(2, idx), bucket_value,
'*' * min(60, bucket_value)))
LOG.info("%s" % '-' * 120)

View File

@ -70,7 +70,7 @@ server_opts = [
"If an incoming connection is idle for this number of "
"seconds it will be closed. A value of '0' means "
"wait forever."),
]
]
CONF = cfg.CONF
CONF.register_opts(server_opts)

View File

@ -17,5 +17,5 @@ def set_request_forward_environ(req, remote_host, remote_port):
req.environ['SERVER_NAME'] = remote_host
req.environ['SERVER_PORT'] = remote_port
if ('REMOTE_ADDR' in req.environ and 'HTTP_X_FORWARDED_FOR' not in
req.environ):
req.environ):
req.environ['HTTP_X_FORWARDED_FOR'] = req.environ['REMOTE_ADDR']

View File

@ -20,24 +20,16 @@ whitelist_externals = find
commands = {posargs}
[flake8]
# Temporarily ignoring these warnings
# E123 closing bracket does not match indentation of opening bracket
# E127 continuation line over-indented for visual indent
# E129 visually indented line with same indent as next logical line
# - hacking codes -
# H104: File contains nothing but comments
# H301: one import per line
# H404: multi line docstring should start without a leading new line
# H405: multi line docstring summary not separated with an empty line
# H501: Do not use self.__dict__ for string formatting
# - flake8 codes -
# F821 undefined name 'unicode' (python3 specific)
ignore=E123,E127,E129
H104,H301,H404,H405,H501,
F821
ignore=H104,H301,H404,H405,H501
# H106 Dont put vim configuration in source files (off by default).
# H203 Use assertIs(Not)None to check for None (off by default).
# TODO: enable: H904 Delay string interpolations at logging calls (off by default).
# TODO: enable: H904 Delay string interpolations at logging calls
enable-extensions = H106,H203
max-line-length=84
@ -47,7 +39,6 @@ skip_install = True
deps =
hacking
flake8-bugbear
flake8<3.6.0
commands =
flake8