Fix pep8 errors

Recent pep8 upgrade and corresponding pycodestyle update break
horizon pep8 job due to the new rules.

This commit fixes the following new errors:
- E226 missing whitespace around arithmetic operator
- E241 multiple spaces after ','
- E731 do not assign a lambda expression, use a def

The following errors are added to the ignore list
as there are many errors:
- E402 module level import not at top of file
- W503 line break before binary operator

Change-Id: I3478b0684175d2604bbcc1d89cbfca298b97f1e1
This commit is contained in:
Akihiro Motoki 2018-04-11 00:28:25 +09:00
parent b4eb6b992e
commit f545272f12
10 changed files with 40 additions and 36 deletions

View File

@ -53,7 +53,8 @@ def sort_flavor_list(request, flavors):
sort_key = flavor_sort.get('key', 'ram')
rev = flavor_sort.get('reverse', False)
if not callable(sort_key):
key = lambda flavor: get_key(flavor, sort_key)
def key(flavor):
return get_key(flavor, sort_key)
else:
key = sort_key
flavor_list = [(flavor.id, '%s' % flavor.name)

View File

@ -153,5 +153,6 @@ class BaseWebObject(unittest.TestCase):
pass
def wait_till_spinner_disappears(self):
getter = lambda: self.driver.find_element(*self._spinner_locator)
def getter():
return self.driver.find_element(*self._spinner_locator)
self.wait_till_element_disappears(getter)

View File

@ -155,7 +155,9 @@ commands =
[flake8]
filename = *.py,django.wsgi
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject,node_modules,openstack_dashboard/enabled/*
ignore =
# E402 module level import not at top of file
# W503 line break before binary operator
ignore = E402,W503
# Enable the following hacking rules which are disabled by default
# H106 Do not put vim configuration in source files.
# H203 Use assertIs(Not)None to check for None.