-
Notifications
You must be signed in to change notification settings - Fork 262
Clarified error messages in LazyTractogram #504
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
Codecov Report
@@ Coverage Diff @@
## master #504 +/- ##
==========================================
+ Coverage 94.02% 94.05% +0.02%
==========================================
Files 166 166
Lines 21843 22047 +204
Branches 2325 2345 +20
==========================================
+ Hits 20538 20736 +198
- Misses 875 877 +2
- Partials 430 434 +4
Continue to review full report at Codecov.
|
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.
Suggestion for rephrase.
nibabel/streamlines/tractogram.py
Outdated
raise TypeError("`value` must be a generator function or None.") | ||
if not callable(value): | ||
msg = ("Values in a `LazyDict` must be generator functions." | ||
" Those are functions which whenever are called return an" |
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.
Maybe "These are functions which, when called, return an instantiated generator."
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.
Thank for the suggestion, it is indeed way better.
@@ -604,7 +607,10 @@ def _apply_affine(): | |||
|
|||
def _set_streamlines(self, value): | |||
if value is not None and not callable(value): | |||
raise TypeError("`streamlines` must be a generator function.") | |||
msg = ("`streamlines` must be a generator function. That is a" |
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.
Ditto.
Completely forgot about this PR :O. |
@matthew-brett This PR should be good to go. I've modified some outputs messages as you suggested. |
Thanks - in it goes. |
This PR clarifies what "generator function" means in relevant error messages. It also makes sure all values contained in a
LazyDict
object are callable.