-
Notifications
You must be signed in to change notification settings - Fork 3.9k
GH-45653: [Python] Scalar subclasses should implement Python protocols #45818
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
Merged
Merged
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
3d85931
Add __int__ methods
thisisnic 3a12d51
Make changes more compact
thisisnic ad9de3c
Remove redundant docs
thisisnic 60a613b
linter fixes
thisisnic a08a92a
Add test for __int__
thisisnic 690a978
Remove redundant spacing
thisisnic 776c9d7
Add floats and tests
thisisnic c3e3da5
Add bytes()
thisisnic b929e27
Run linter
thisisnic 30af8c0
Implement bool dunder for booleans
thisisnic 376063c
Add tests for boolean input
thisisnic 8b0d08b
Add buffer dunder
thisisnic b42c6ef
Try using __getbuffer__()
thisisnic 80e7822
Rename method __buffer__ to __getbuffer__
thisisnic 7b87ed5
Try passing through params
thisisnic 519eb4b
Try getting buffer first
thisisnic 9af4764
Try with PyObject_GetBuffer
thisisnic 53939b6
Create new buffer properties from scratch
thisisnic 0492dd8
Remove extra whitespace
thisisnic c71fcee
Update python/pyarrow/scalar.pxi
thisisnic 5435c3e
Add more specific tests for memview object
thisisnic 5947541
Implement mapping for Map types
thisisnic 2f4550a
Explicitly test that StructScalars implement sequences
thisisnic b049141
Add test for struct unpacking
thisisnic 7f73e79
Document extracting values from StructScalars and revert test
thisisnic c08ef65
Appease linter, add back in deleted test
thisisnic 390de50
Appease another linter
thisisnic d62ced1
Update docs/source/python/compute.rst
thisisnic 4de77b7
Add failure for rtrieving buffer if none exists, remove duplicated co…
thisisnic e3ff08b
Add tests for if objects are sequence-like or mapping-like
thisisnic 796f1f1
Update python/pyarrow/scalar.pxi
thisisnic 46dbfe1
Parameterise tests for NULL binary objects
thisisnic 1456801
Simplify buffer creation
thisisnic 42e3859
Add test for empty string
thisisnic 20e8add
Use keys to implement __getitem__ for MapScalar
thisisnic 1581930
Inherit from sequence and mapping classes
thisisnic a89815b
Import Sequence and Mapping so can use class names for imports
thisisnic 2312280
Update python/pyarrow/scalar.pxi
thisisnic b59b579
Remove unnecessary parentheses
thisisnic 0727fec
Raise KeyError not ValueError
thisisnic 7cafd65
Check buf is None on empty value test
thisisnic cc89ada
Different code paths for dereferencing MapScalars by index or key
thisisnic 6b5e941
Update mappings to return value when provided a key
thisisnic caa9b23
__int__ -> __index__
thisisnic f5ff26d
Define __int__ for floats
thisisnic f7d9083
use numpy float
thisisnic b6a2f7d
Update halffloat __int__ to account for numpy float
thisisnic 18d3af6
Don't test is numpy float
thisisnic 5d451ad
Update bool method to return False not None if scalar is None
thisisnic 2938a55
Revert changes which overrode rebased content
thisisnic 032dd85
Revert halffloat change that was missed
thisisnic 02872d4
Update python/pyarrow/tests/test_scalars.py
thisisnic c21e7ee
Fix number in test
thisisnic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.