Skip to content

Fix rest of flake8 error lambda functions (E731) #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 25, 2024

Conversation

bobleesj
Copy link

@bobleesj bobleesj commented Aug 24, 2024

This is the last bit of all flake8 remaining in cookie.

Tests pass

imac@imacs-iMac diffpy.srfit % python -m diffpy.srfit.tests.run
WARNING:diffpy.srfit.tests:No module named 'sas', SaS tests skipped.
WARNING:diffpy.srfit.tests:Cannot import pyobjcryst, pyobjcryst tests skipped.
WARNING:diffpy.srfit.tests:Cannot import diffpy.srreal, PDF tests skipped.
......ssss................................sssssssssss....ssssss...........................sss..s..............
----------------------------------------------------------------------
Ran 110 tests in 0.197s

Copy link
Author

@bobleesj bobleesj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review @sbillinge

and cls not in excluded_types
)

def is_exported_type(cls):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__wrapSrFitOperators is a public function and I decided to make is_exported_type nested as well to encapsulate.

calculate_pr = lambda x: self._invertor.pr(c, x)
pr = map(calculate_pr, r)

pr = map(lambda x: self._invertor.pr(c, x), r)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly inserted the lambda inside the map.

@@ -270,7 +270,7 @@ def test_releaseOldEquations(self):
def test_registerFunction(self):
"""Ensure registered function works after second setEquation call."""
fc = self.fitcontribution
fsquare = lambda x: x**2
fsquare = lambda x: x**2 # noqa: E731
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For testing, its usage seems ok, adding noqa.

@bobleesj bobleesj marked this pull request as ready for review August 24, 2024 20:20
@sbillinge sbillinge merged commit 7ea0fa9 into diffpy:cookie Aug 25, 2024
1 check failed
@bobleesj bobleesj deleted the flake8-lambda-3 branch August 25, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants