Fix E731 flake8
This patch fixes E731 for flake8/pep8 which recommends preferring functions over lambda expressions. Change-Id: Ied905e1d55ae73b8d390240d3320a8ba0dcca17c
This commit is contained in:
parent
d5da988792
commit
1925aa9c24
|
@ -105,8 +105,8 @@ class TestDomainConfigs(unit.BaseTestCase):
|
|||
name,
|
||||
identity.DOMAIN_CONF_FTAIL)))
|
||||
|
||||
walk_fake = lambda *a, **kwa: (
|
||||
('/fake/keystone/domains/config', [], files), )
|
||||
def walk_fake(*a, **kwa):
|
||||
return ('/fake/keystone/domains/config', [], files),
|
||||
|
||||
generic_driver = mock.Mock(is_sql=False)
|
||||
|
||||
|
|
|
@ -88,7 +88,8 @@ class TestTemplatedCatalog(unit.TestCase, catalog_tests.CatalogTests):
|
|||
"Templated backend doesn't have disabled endpoints")
|
||||
|
||||
def assert_catalogs_equal(self, expected, observed):
|
||||
sort_key = lambda d: d['id']
|
||||
def sort_key(d):
|
||||
return d['id']
|
||||
for e, o in zip(sorted(expected, key=sort_key),
|
||||
sorted(observed, key=sort_key)):
|
||||
expected_endpoints = e.pop('endpoints')
|
||||
|
|
|
@ -22,4 +22,4 @@ for FILE in $CHANGED; do
|
|||
fi
|
||||
done
|
||||
|
||||
diff -u --from-file /dev/null $CHECK | flake8 --diff --ignore=D100,D101,D102,D103,D104,E305,E402,E501,W503,W504,W605,E731
|
||||
diff -u --from-file /dev/null $CHECK | flake8 --diff --ignore=D100,D101,D102,D103,D104,E305,E402,E501,W503,W504,W605
|
||||
|
|
5
tox.ini
5
tox.ini
|
@ -32,7 +32,7 @@ deps =
|
|||
.[bandit]
|
||||
{[testenv]deps}
|
||||
commands =
|
||||
flake8 --ignore=D100,D101,D102,D103,D104,E305,E402,E501,W503,W504,W605,E731
|
||||
flake8 --ignore=D100,D101,D102,D103,D104,E305,E402,E501,W503,W504,W605
|
||||
# Run bash8 during pep8 runs to ensure violations are caught by
|
||||
# the check and gate queues
|
||||
bashate devstack/plugin.sh
|
||||
|
@ -127,8 +127,7 @@ enable-extensions = H203,H904
|
|||
# TODO(wxy): Fix the pep8 issue.
|
||||
# E402: module level import not at top of file
|
||||
# W503: line break before binary operator
|
||||
# E731: do not assign a lambda expression, use a def
|
||||
ignore = D100,D101,D102,D103,D104,D203,E402,W503,E731
|
||||
ignore = D100,D101,D102,D103,D104,D203,E402,W503
|
||||
|
||||
exclude=.venv,.git,.tox,build,dist,*lib/python*,*egg,tools,vendor,.update-venv,*.ini,*.po,*.pot
|
||||
max-complexity=24
|
||||
|
|
Loading…
Reference in New Issue