diff --git a/sumpy/cse.py b/sumpy/cse.py
index 8c9776711bd783e2ef878f4817cb4a7167cfb482..49ba690f2d4aa278c2f91cb826bad9c177ca67ef 100644
--- a/sumpy/cse.py
+++ b/sumpy/cse.py
@@ -305,7 +305,7 @@ def match_common_args(func_class, funcs, opt_subs):
         # This makes us try combining smaller matches first.
         common_arg_candidates = OrderedSet(sorted(
                 common_arg_candidates_counts.keys(),
-                key=lambda k: (common_arg_candidates_counts[k], k)))
+                key=lambda k: (common_arg_candidates_counts[k], k)))  # noqa: B023
 
         while common_arg_candidates:
             j = common_arg_candidates.pop(last=False)
diff --git a/sumpy/expansion/local.py b/sumpy/expansion/local.py
index d170aba9a9da39c1a84001c63c38a61ca9bc9217..64919b17ec4992fcfbfecb95d19fe6a71c7770a1 100644
--- a/sumpy/expansion/local.py
+++ b/sumpy/expansion/local.py
@@ -197,7 +197,7 @@ class VolumeTaylorLocalExpansionBase(LocalExpansionBase):
             # Following is a hack to make sure cse works.
             if 1:
                 def save_temp(x):
-                    return add_to_sac(sac, weight * x)
+                    return add_to_sac(sac, weight * x)  # noqa: B023
 
                 for i, mi in enumerate(self.get_coefficient_identifiers()):
                     result[i] += taker.diff(mi, save_temp)
diff --git a/test/test_fmm.py b/test/test_fmm.py
index 4d6d0d480dbe1cc2fea190523bd291e421528b37..3e8ebf0b9c7aaebdd612d11e4c4151eaab749cf7 100644
--- a/test/test_fmm.py
+++ b/test/test_fmm.py
@@ -204,10 +204,10 @@ def test_sumpy_fmm(ctx_factory, knl, local_expn_class, mpole_expn_class,
 
         if order_varies_with_level:
             def fmm_level_to_order(kernel, kernel_args, tree, lev):
-                return order + lev % 2
+                return order + lev % 2  # noqa: B023
         else:
             def fmm_level_to_order(kernel, kernel_args, tree, lev):
-                return order
+                return order  # noqa: B023
 
         wrangler = SumpyExpansionWrangler(tree_indep, trav, dtype,
             fmm_level_to_order=fmm_level_to_order,