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: support non-hashable values in parameters_union #2651

Merged
merged 5 commits into from
Aug 16, 2023

Conversation

agoose77
Copy link
Collaborator

@agoose77 agoose77 commented Aug 16, 2023

@agoose77 agoose77 marked this pull request as ready for review August 16, 2023 13:09
@codecov
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Merging #2651 (332777d) into main (a960a56) will decrease coverage by 0.05%.
Report is 3 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files
Files Changed Coverage Δ
src/awkward/contents/indexedarray.py 78.99% <ø> (ø)
src/awkward/_parameters.py 82.22% <100.00%> (ø)

... and 18 files with indirect coverage changes

@ikrommyd
Copy link

ikrommyd commented Aug 16, 2023

@agoose77 I pip installed from this branch and my reproducer on dask-contrib/dask-awkward#340 and my code on https://github.com/iasonkrom/egamma-tnp work fine now. Looks good from my perspective but that's up to you to judge. Thanks!

@agoose77 agoose77 temporarily deployed to docs-preview August 16, 2023 20:51 — with GitHub Actions Inactive
Copy link
Member

@jpivarski jpivarski left a comment

Choose a reason for hiding this comment

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

It looks great! Merge it whenever you're ready.

src/awkward/_parameters.py Outdated Show resolved Hide resolved
has_no_exclusions = len(exclude) == 0
has_exclusions = bool(exclude)
Copy link
Member

Choose a reason for hiding this comment

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

bool(x) is a rather brief way to say len(x) != 0. It works through Python's truthiness, but I would prefer it if Python required us to be more explicit. Nevertheless, this does look like something a flake8-style linter would suggest. :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hehe, I wondered if you'd mind this given that linters generally prefer it. Here, I want to mean both x is not None or len(x) != 0

Copy link
Member

Choose a reason for hiding this comment

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

I prefer x is not None and also len(x) != 0 over bool(x), but now that we're talking

x is not None and len(x) != 0

Well, that is a lot more characters than

bool(x)

I guess it's okay. You know, the fact that I didn't realize that x might be None by reading the code is an argument in favor of the long expression. I know that what type hints are for, but the type hint is far away and long-time Python users have gotten used to looking for clues about a variable's type from nearby context. So I still kinda prefer the long expression, as long as black doesn't split it up onto multiple lines. (I don't think it would.)

src/awkward/_parameters.py Outdated Show resolved Hide resolved
@agoose77 agoose77 enabled auto-merge (squash) August 16, 2023 22:31
@agoose77 agoose77 temporarily deployed to docs-preview August 16, 2023 23:16 — with GitHub Actions Inactive
@agoose77 agoose77 merged commit 735a377 into main Aug 16, 2023
33 checks passed
@agoose77 agoose77 deleted the agoose77/fix-parameter-merge-hashable branch August 16, 2023 23:21
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.

events[boolean mask] computes fail with scheduler="processes" or a distributed Client
3 participants