Enable Filtering From List of Profiles#173
Conversation
ilumsden
left a comment
There was a problem hiding this comment.
Mostly looks good. Just a few minor changes.
thicket/thicket.py
Outdated
| profile_truth = _profile_truth_from_component(component) | ||
| self = _sync_indices(component, profile_truth) | ||
|
|
||
| return self |
There was a problem hiding this comment.
Why do you return self here? Is it for method chaining? If not, I don't really get the purpose of doing this.
There was a problem hiding this comment.
There is no specific reason. I think it could be void. Is there a specific problem you had in mind or just for clarity?
There was a problem hiding this comment.
In general, especially given that Python is duck typed, it's better to not return stuff if it's not supposed to be used by the user. So, for example, returning self should only be done if you intend for the user to use that return value for e.g., method chaining. If you start returning stuff when you don't have to, it gets really confusing for users really fast.
There was a problem hiding this comment.
Lets change it to void then.
7b2fbe6 to
24af602
Compare
ilumsden
left a comment
There was a problem hiding this comment.
I'd still remove the return self (as I mentioned in the last review), but otherwise this looks good
pearce8
left a comment
There was a problem hiding this comment.
Are there docs/test/examples for this functionality?
No. This PR needs unit tests. |
d6acfa5 to
1758146
Compare
Unit tests in f0b2f50 |
0d70f3d to
7b776bd
Compare
* Add new function * Change copy to deepcopy * Cast type for consistency * Change _sync_profile_components to void * Fix bug * Fix bug * Add unit tests * Fix bug * improve unit test * black * Simplify logic * Fix unit test * Black --------- Co-authored-by: Michael Richard Mckinsey <mckinsey@quartz386.llnl.gov> Co-authored-by: Michael Richard Mckinsey <mckinsey@quartz1922.llnl.gov> Co-authored-by: Michael Richard Mckinsey <mckinsey@quartz1154.llnl.gov> Co-authored-by: Michael Richard Mckinsey <mckinsey@quartz2300.llnl.gov>
I have came across the need to filter the Thicket based on profiles, and I have been using a roundabout way:
So I designed an explicit function for this filtering
filter_profile.