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

fix: use duck-typing check in place of isinstance(..., np.ndarray) #402

Merged

Conversation

douglasdavis
Copy link
Collaborator

Followup to #401

@codecov-commenter
Copy link

codecov-commenter commented Nov 2, 2023

Codecov Report

Merging #402 (c353ac6) into main (17dc9f6) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@           Coverage Diff           @@
##             main     #402   +/-   ##
=======================================
  Coverage   94.02%   94.03%           
=======================================
  Files          23       23           
  Lines        3063     3066    +3     
=======================================
+ Hits         2880     2883    +3     
  Misses        183      183           
Files Coverage Δ
src/dask_awkward/lib/core.py 93.23% <100.00%> (+0.02%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

def _finalize_array(results: Sequence[Any]) -> Any:
# special cases for length 1 results
if len(results) == 1:
if isinstance(results[0], (int, ak.Array, np.ndarray)):
np_like = _is_numpy_or_cupy_like(results[0])
if isinstance(results[0], (int, ak.Array)) or np_like: # type: ignore[unreachable]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea why mypy is complaining that the second half of this or is unreachable. It's absolutely reachable! results[0] is an Any.

@douglasdavis douglasdavis merged commit bde300c into dask-contrib:main Nov 2, 2023
23 checks passed
@douglasdavis douglasdavis deleted the make-check-duck-typing-check branch November 2, 2023 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants