-
Notifications
You must be signed in to change notification settings - Fork 101
feat(ComparisonReport): Delegate available_if to sub-reports
#2000
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
Conversation
available_if to sub-reports
|
|
||
| def check(accessor: Any) -> bool: | ||
| return any( | ||
| hasattr(report.metrics, metric) for report in accessor._parent.reports_ |
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.
Nitpick: you can factorize your function to check_any_sub_report_has_accessor with the following :
| hasattr(report.metrics, metric) for report in accessor._parent.reports_ | |
| reduce(getattr, accessor.split("."), report) | |
| for report in accessor._parent.reports_ |
@available_if(_check_any_sub_report_has_accessor("metrics.rmse"))
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.
Do you have any example in mind where the previous implementation would cause problems?
If so, please add a dedicated test, otherwise LGTM.
I think this was the point of @guillaume that I split into #2001. That issue is proving hard to solve, so I could either add tests here and change them in #1985, or we could wait for #1985 (might be a while) and then merge this one. |
Replaces the checks in available_if with a check that at least one of the compared reports has the requested metric.
Closes #1473