Skip to content
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

DM-36472: Fix a bug in _validateGalsimInterpolant #17

Merged
merged 5 commits into from Oct 5, 2022

Conversation

arunkannawadi
Copy link
Member

No description provided.

@arunkannawadi arunkannawadi marked this pull request as ready for review October 5, 2022 14:34
@arunkannawadi arunkannawadi force-pushed the tickets/DM-36472 branch 2 times, most recently from 297f783 to b9dd883 Compare October 5, 2022 14:58
@arunkannawadi
Copy link
Member Author

Problems with GHA I guess. Linting check is not getting triggered.

Copy link
Contributor

@erykoff erykoff left a comment

Choose a reason for hiding this comment

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

Tests are a big improvement, but the method itself is in the wrong place. Also, thanks for updating the workflow!

@@ -33,8 +33,8 @@


class PiffPsfDeterminerConfig(BasePsfDeterminerTask.ConfigClass):
def _validateGalsimInterpolant(name: str) -> bool: # noqa: N805
"""A helper function to validate the GalSim interpolant at config time.
def validateGalsimInterpolant(name: str) -> bool: # noqa: N805
Copy link
Contributor

Choose a reason for hiding this comment

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

I still think this should be a private method (leading underscore) even though it is used in the tests.

Also, I don't know how this works as a static method without the @staticmethod decorator... or wait, it's because it's a local method, I guess, that just happens to work because it's at the class scope.

Recommendation: remove this from the class level, the check function should be outside the class (at line 33), and have a leading underscore. The noqa can then be removed and the scope will make more sense.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks Eli. Done. My rationale for making it a public method was so that the user could check for themselves whether a string is valid or not, without having to start a processing job. But one could also argue that that is conveyed in the docstring accurately.

class PiffPsfDeterminerConfig(BasePsfDeterminerTask.ConfigClass):
def _validateGalsimInterpolant(name: str) -> bool: # noqa: N805
"""A helper function to validate the GalSim interpolant at config time.
def validateGalsimInterpolant(name: str) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also be a private method with a leading underscore. Thanks!

@arunkannawadi arunkannawadi changed the title DM-36472: Expose validateGalsimInterpolant and fix a bug in it DM-36472: Fix a bug in _validateGalsimInterpolant Oct 5, 2022
@arunkannawadi arunkannawadi merged commit 733dce7 into main Oct 5, 2022
@arunkannawadi arunkannawadi deleted the tickets/DM-36472 branch October 5, 2022 17:52
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.

None yet

2 participants