-
Notifications
You must be signed in to change notification settings - Fork 45
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
Validate that the metadata is always a dict #466
Conversation
Codecov ReportAll modified lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #466 +/- ##
==========================================
+ Coverage 76.84% 76.87% +0.02%
==========================================
Files 93 93
Lines 3395 3395
==========================================
+ Hits 2609 2610 +1
+ Misses 786 785 -1
☔ View full report in Codecov by Sentry. |
@R-Palazzo we should not be accepting the actual metadata object. We should only accept dictionaries. I would avoid doing any conversions in SDMetrics and stick to the original issue. |
sdmetrics/reports/base_report.py
Outdated
"""If the metadta is not a dict, try to convert it.""" | ||
if not isinstance(metadata, dict): | ||
try: | ||
metadata = metadata.to_dict() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something we actually want to support? Other objects might implement a to_dict
method which might lead to weird issues down the road (i.e. I'm pretty sure you can call to_dict
on a pandas dataframe). Maybe @npatki has thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@frances-h agreed. I think we should stick to the issue's description, which states that we should only accept dictionaries. We do not intend to convert to a dictionary on the user's behalf.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Resolve #428