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: widen input support for ak.type() #2009

Merged
merged 2 commits into from
Dec 15, 2022
Merged

fix: widen input support for ak.type() #2009

merged 2 commits into from
Dec 15, 2022

Conversation

agoose77
Copy link
Collaborator

Fixes #2008

@codecov
Copy link

codecov bot commented Dec 15, 2022

Codecov Report

Merging #2009 (01373f9) into main (9d7d6b4) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
Impacted Files Coverage Δ
src/awkward/operations/ak_type.py 77.08% <100.00%> (+2.61%) ⬆️

@agoose77 agoose77 temporarily deployed to docs-preview December 15, 2022 11:20 — with GitHub Actions Inactive
@agoose77 agoose77 requested review from jpivarski and removed request for ioanaif December 15, 2022 16:05


def test_simple():
assert re.match(r"3 \* u?int\d+", str(ak.type([1, 2, 3])))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is overkill because the int type is not platform specific, as I had feared. (ArrayBuilder always returns int64)

Suggested change
assert re.match(r"3 \* u?int\d+", str(ak.type([1, 2, 3])))
assert re.match(r"3 \* u?int\d+", str(ak.type([1, 2, 3])))

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.

This is good! Testing the type with a regular expression is more than you needed to do (we don't plan to change the Datashape string format). But it works.

@jpivarski jpivarski merged commit 050768f into main Dec 15, 2022
@jpivarski jpivarski deleted the agoose77/fix-ax-type branch December 15, 2022 17:09
agoose77 added a commit that referenced this pull request Dec 15, 2022
* test: check `ak.type([...])`

test: check `ak.type([...])`

* fix: convert unknown types to layouts in `ak.Array`
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.

ak.type does not accept "anything ak.to_layout recognizes"
2 participants