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

Remove dead modules #212

Merged

Conversation

WilliamJamieson
Copy link
Contributor

@WilliamJamieson WilliamJamieson commented Jun 20, 2023

This PR removes some dead modules:

  • roman_datamodels.utils
  • roman_datamodels.mktest

These modules appear to be untested, unused, duplicate other functionality, and essentially abandoned.

Checklist

@codecov
Copy link

codecov bot commented Jun 20, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +14.61 🎉

Comparison is base (0302d9b) 80.99% compared to head (f154171) 95.60%.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #212       +/-   ##
===========================================
+ Coverage   80.99%   95.60%   +14.61%     
===========================================
  Files          19       17        -2     
  Lines        2252     1913      -339     
===========================================
+ Hits         1824     1829        +5     
+ Misses        428       84      -344     
Impacted Files Coverage Δ
src/roman_datamodels/datamodels.py 87.81% <100.00%> (+0.22%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@WilliamJamieson WilliamJamieson marked this pull request as ready for review June 20, 2023 15:49
@WilliamJamieson WilliamJamieson requested a review from a team as a code owner June 20, 2023 15:49
Comment on lines +379 to +387
@classmethod
def is_association(cls, asn_data):
"""
Test if an object is an association by checking for required fields
"""
if isinstance(asn_data, dict):
if "asn_id" in asn_data and "asn_pool" in asn_data:
return True
return False
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mairanteodoro requested that we keep this method in roman_datamodels but we directly associate it with the AssociationsModel as that is what it is needed for.

This change simply binds the is_association method with the AssociationsModel to make the relationship clear. romancal will simply call AssociationsModel.is_association in a utility is_association function.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@WilliamJamieson I'm OK with moving it out of roman_datamodels.

Comment on lines +194 to +209
@pytest.mark.parametrize(
"expected, asn_data",
[
(True, {"asn_id": "foo", "asn_pool": "bar"}),
(False, {"asn_id": "foo"}),
(False, {"asn_pool": "bar"}),
(False, {"foo": "bar"}),
(False, "foo"),
],
)
def test_is_association(expected, asn_data):
"""
Test the is_association function.
"""

assert datamodels.AssociationsModel.is_association(asn_data) is expected
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, test the is_association (it was never tested before).

@WilliamJamieson
Copy link
Contributor Author

Close/reopen due to messing up branch pushes

Copy link
Collaborator

@mairanteodoro mairanteodoro Jun 20, 2023

Choose a reason for hiding this comment

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

Are we adding mktest and utils to the romancal docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, they were linked to in the roman_datamodels docs accidentally.

Copy link
Collaborator

@PaulHuwe PaulHuwe left a comment

Choose a reason for hiding this comment

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

LGTM modulo @mairanteodoro's approval.

@WilliamJamieson WilliamJamieson merged commit 11bb110 into spacetelescope:main Jun 20, 2023
@WilliamJamieson WilliamJamieson deleted the refactor/remove_dead branch June 20, 2023 20:34
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.

3 participants