-
Notifications
You must be signed in to change notification settings - Fork 9
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
Enable Filtering From List of Profiles #173
Enable Filtering From List of Profiles #173
Conversation
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets change it to void then.
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.
Done in 1758146
7b2fbe6
to
24af602
Compare
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.
I'd still remove the return self
(as I mentioned in the last review), but otherwise this looks good
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.
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
.