-
Notifications
You must be signed in to change notification settings - Fork 44
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
Update _utils_nanoplots.py
#295
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #295 +/- ##
==========================================
- Coverage 81.71% 81.68% -0.03%
==========================================
Files 41 41
Lines 4321 4314 -7
==========================================
- Hits 3531 3524 -7
Misses 790 790 ☔ View full report in Codecov by Sentry. |
# If the element is of type list, iterate through the sublist | ||
for item in element: | ||
flat_list.append(item) | ||
if isinstance(element, list): |
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.
Thanks for this cleanup--I would be on board merging this piece
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.
Sorry for the confusion. Are you in favor of just if isinstance(element, list):
or do you prefer the entire updated _flatten_list
function? I'll assume it's the latter.
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.
By the way, there are still some places in the codebase where direct type comparisons like if type(x) == list
are used. Do you think it would be better if we try to replace all of them with if isinstance(x, list)
?
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.
Thanks for submitting this PR! I think we're likely going to try and remove numpy in the near future, so aren't looking to add it to functions like _gt_min
. I flagged one block of code that would be nice to merge, though!
If you're up for it, we'd gladly accept a separate PR that removes numpy, but I realize it's a fairly gnarly task. No worries if it's outside of what you're looking to do. I really appreciate all this time you've put into cleaning things up 😅.
I've added an issue describing removing numpy, in case you want to tackle it. But no worries if not! |
May I inquire about the possibility of handling or representing something like |
Removing |
Yeah, we can use a combo of |
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, thanks!
This PR primarily addresses the following three issues:
numpy
._flatten_list
into a function that can recursively flatten the list. This feature may be unwanted, so feel free to reject this change._gt_first
and_gt_last
more general so they can accept any iterable as the parameter.