Skip to content
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

Fixes several bugs in reader_dispatch #108

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

ilumsden
Copy link
Collaborator

@ilumsden ilumsden commented Nov 1, 2023

This PR fixes two bugs in Thicket.reader_dispatch.

First, it fixes type checking in the function. Currently, reader_dispatch uses type(var) = expected_type. This syntax may work in some cases. However, there is no guarantee it will work for all types, and the Python Software Foundation has reserved the right to completely invalidate this syntax in the future. This PR fixes this type checking by switching it to the more correct isinstance(var, expected_type) syntax.

Additionally, this PR fixes a bug in Thicket.reader_dispatch that would cause extra positional and keyword arguments to not be forwarded to the corresponding Hatchet function if the user passed in a list or tuple of filenames. This is particularly problematic for Thicket.from_caliper because it means the query argument is not forwarded to Hatchet, causing Thicket.from_caliper to fail in all cases.

@ilumsden ilumsden added area-thicket Issues and PRs involving Thicket's core Thicket datastructure and associated classes priority-high High priority issues and PRs status-ready-for-review This PR is ready to be reviewed by assigned reviewers type-bug Identifies bugs in issues and identifies bug fixes in PRs labels Nov 1, 2023
@ilumsden ilumsden requested a review from slabasan November 1, 2023 15:29
@ilumsden ilumsden self-assigned this Nov 1, 2023
@ilumsden ilumsden force-pushed the improve_reader_dispatch branch from b0908e9 to 9c10e19 Compare November 1, 2023 15:32
@michaelmckinsey1
Copy link
Collaborator

In regards to type checking, I found this reference that enforces the new solution implemented here. Most importantly, isinstance supports inheritance, whereas type does not. Using type to check types is an anti-pattern.

@slabasan slabasan merged commit 4d0b892 into LLNL:develop Nov 8, 2023
4 checks passed
Yejashi pushed a commit to TauferLab/thicket that referenced this pull request Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-thicket Issues and PRs involving Thicket's core Thicket datastructure and associated classes priority-high High priority issues and PRs status-ready-for-review This PR is ready to be reviewed by assigned reviewers type-bug Identifies bugs in issues and identifies bug fixes in PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants