From 85d6e625dd6ba0ca486aea1f876ad3afa17559bc Mon Sep 17 00:00:00 2001 From: Michael Fritch Date: Thu, 28 Jan 2021 12:17:22 -0700 Subject: [PATCH] mgr/cephadm: Do not assign a lambda expression, use a def (E731) Signed-off-by: Michael Fritch (cherry picked from commit e26db8c21063f53d2fe471d39e6cf4037e3ead15) --- src/pybind/mgr/cephadm/tests/test_scheduling.py | 6 +++--- src/pybind/mgr/orchestrator/_interface.py | 2 +- src/pybind/mgr/tox.ini | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pybind/mgr/cephadm/tests/test_scheduling.py b/src/pybind/mgr/cephadm/tests/test_scheduling.py index 1d41fcc9710ad..071c5c26e7217 100644 --- a/src/pybind/mgr/cephadm/tests/test_scheduling.py +++ b/src/pybind/mgr/cephadm/tests/test_scheduling.py @@ -89,12 +89,12 @@ def get_result(key, results): def mk_spec_and_host(spec_section, hosts, explicit_key, explicit, count): if spec_section == 'hosts': - mk_spec = lambda: ServiceSpec('mgr', placement=PlacementSpec( + mk_spec = lambda: ServiceSpec('mgr', placement=PlacementSpec( # noqa: E731 hosts=explicit, count=count, )) elif spec_section == 'label': - mk_spec = lambda: ServiceSpec('mgr', placement=PlacementSpec( + mk_spec = lambda: ServiceSpec('mgr', placement=PlacementSpec( # noqa: E731 label='mylabel', count=count, )) @@ -105,7 +105,7 @@ def mk_spec_and_host(spec_section, hosts, explicit_key, explicit, count): '12': '[1-2]', '123': '*', }[explicit_key] - mk_spec = lambda: ServiceSpec('mgr', placement=PlacementSpec( + mk_spec = lambda: ServiceSpec('mgr', placement=PlacementSpec( # noqa: E731 host_pattern=pattern, count=count, )) diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index b3543cc429a74..b959060889118 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -105,7 +105,7 @@ def handle_exception(prefix: str, perm: str, func: FuncT) -> FuncT: return HandleCommandResult(-errno.ENOENT, stderr=msg) # misuse lambda to copy `wrapper` - wrapper_copy = lambda *l_args, **l_kwargs: wrapper(*l_args, **l_kwargs) + wrapper_copy = lambda *l_args, **l_kwargs: wrapper(*l_args, **l_kwargs) # noqa: E731 wrapper_copy._prefix = prefix # type: ignore wrapper_copy._cli_command = CLICommand(prefix, perm) # type: ignore wrapper_copy._cli_command.store_func_metadata(func) # type: ignore diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini index f50f59399da0a..3666dd6e0a67b 100644 --- a/src/pybind/mgr/tox.ini +++ b/src/pybind/mgr/tox.ini @@ -12,7 +12,6 @@ requires = cython max-line-length = 100 ignore = E501, - E731, E741, F401, F541, -- 2.39.5