Skip to content

Commit 7ea0fa9

Browse files
authored
Merge pull request #82 from bobleesj/flake8-lambda-3
Fix rest of flake8 error lambda functions (E731)
2 parents 15d57bd + e649789 commit 7ea0fa9

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

Diff for: src/diffpy/srfit/equation/builder.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -662,13 +662,16 @@ def __wrapSrFitOperators():
662662
"""
663663
opmod = literals.operators
664664
excluded_types = set((opmod.CustomOperator, opmod.UFuncOperator))
665-
# check if opmod member should be wrapped as OperatorBuilder
666-
is_exported_type = lambda cls: (
667-
inspect.isclass(cls)
668-
and issubclass(cls, opmod.Operator)
669-
and not inspect.isabstract(cls)
670-
and cls not in excluded_types
671-
)
665+
666+
def is_exported_type(cls):
667+
"""Check if the class should be wrapped as OperatorBuilder."""
668+
return (
669+
inspect.isclass(cls) and
670+
issubclass(cls, opmod.Operator) and
671+
not inspect.isabstract(cls) and
672+
cls not in excluded_types
673+
)
674+
672675
# create OperatorBuilder objects
673676
for nm, opclass in inspect.getmembers(opmod, is_exported_type):
674677
op = opclass()

Diff for: src/diffpy/srfit/sas/prcalculator.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ def __call__(self, r):
9292
self._invertor.y = iq
9393
self._invertor.err = diq
9494
c, c_cov = self._invertor.invert_optimize()
95-
calculate_pr = lambda x: self._invertor.pr(c, x)
96-
pr = map(calculate_pr, r)
97-
95+
pr = map(lambda x: self._invertor.pr(c, x), r)
9896
pr = numpy.array(pr)
9997
return self.scale.value * pr
10098

Diff for: src/diffpy/srfit/tests/testcontribution.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def test_releaseOldEquations(self):
270270
def test_registerFunction(self):
271271
"""Ensure registered function works after second setEquation call."""
272272
fc = self.fitcontribution
273-
fsquare = lambda x: x**2
273+
fsquare = lambda x: x**2 # noqa: E731
274274
fc.registerFunction(fsquare, name="fsquare")
275275
fc.setEquation("fsquare")
276276
fc.x.setValue(5)

0 commit comments

Comments
 (0)