-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Zero-copy buffer protocol data import (#204)
* Zero-copy buffer protocol * Update README * Automatically convert buffer protocol to PyArray * reorder doc * Fix type hints to allow buffer protocol objects * Add test for operations * Update reamde * better docstring * Test that datetime array fails
- Loading branch information
1 parent
e78cd54
commit 9a01c80
Showing
17 changed files
with
515 additions
and
364 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
from arro3.core import Scalar | ||
from arro3.core.types import ArrowArrayExportable, ArrowStreamExportable | ||
from arro3.core.types import ArrayInput, ArrowStreamExportable | ||
|
||
def max(input: ArrowArrayExportable | ArrowStreamExportable) -> Scalar: | ||
def max(input: ArrayInput | ArrowStreamExportable) -> Scalar: | ||
""" | ||
Returns the max of values in the array. | ||
""" | ||
|
||
def min(input: ArrowArrayExportable | ArrowStreamExportable) -> Scalar: | ||
def min(input: ArrayInput | ArrowStreamExportable) -> Scalar: | ||
""" | ||
Returns the min of values in the array. | ||
""" | ||
|
||
def sum(input: ArrowArrayExportable | ArrowStreamExportable) -> Scalar: | ||
def sum(input: ArrayInput | ArrowStreamExportable) -> Scalar: | ||
""" | ||
Returns the sum of values in the array. | ||
""" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
from arro3.core import Array | ||
from arro3.core.types import ArrowArrayExportable | ||
from arro3.core.types import ArrayInput | ||
|
||
def add(lhs: ArrowArrayExportable, rhs: ArrowArrayExportable) -> Array: | ||
def add(lhs: ArrayInput, rhs: ArrayInput) -> Array: | ||
"""Perform `lhs + rhs`, returning an error on overflow""" | ||
|
||
def add_wrapping(lhs: ArrowArrayExportable, rhs: ArrowArrayExportable) -> Array: | ||
def add_wrapping(lhs: ArrayInput, rhs: ArrayInput) -> Array: | ||
"""Perform `lhs + rhs`, wrapping on overflow for integer data types.""" | ||
|
||
def div(lhs: ArrowArrayExportable, rhs: ArrowArrayExportable) -> Array: | ||
def div(lhs: ArrayInput, rhs: ArrayInput) -> Array: | ||
"""Perform `lhs / rhs`""" | ||
|
||
def mul(lhs: ArrowArrayExportable, rhs: ArrowArrayExportable) -> Array: | ||
def mul(lhs: ArrayInput, rhs: ArrayInput) -> Array: | ||
"""Perform `lhs * rhs`, returning an error on overflow""" | ||
|
||
def mul_wrapping(lhs: ArrowArrayExportable, rhs: ArrowArrayExportable) -> Array: | ||
def mul_wrapping(lhs: ArrayInput, rhs: ArrayInput) -> Array: | ||
"""Perform `lhs * rhs`, wrapping on overflow for integer data types.""" | ||
|
||
def neg(array: ArrowArrayExportable) -> Array: | ||
def neg(array: ArrayInput) -> Array: | ||
"""Negates each element of array, returning an error on overflow""" | ||
|
||
def neg_wrapping(array: ArrowArrayExportable) -> Array: | ||
def neg_wrapping(array: ArrayInput) -> Array: | ||
"""Negates each element of array, wrapping on overflow for integer data types.""" | ||
|
||
def rem(lhs: ArrowArrayExportable, rhs: ArrowArrayExportable) -> Array: | ||
def rem(lhs: ArrayInput, rhs: ArrayInput) -> Array: | ||
"""Perform `lhs % rhs`""" | ||
|
||
def sub(lhs: ArrowArrayExportable, rhs: ArrowArrayExportable) -> Array: | ||
def sub(lhs: ArrayInput, rhs: ArrayInput) -> Array: | ||
"""Perform `lhs - rhs`, returning an error on overflow""" | ||
|
||
def sub_wrapping(lhs: ArrowArrayExportable, rhs: ArrowArrayExportable) -> Array: | ||
def sub_wrapping(lhs: ArrayInput, rhs: ArrayInput) -> Array: | ||
"""Perform `lhs - rhs`, wrapping on overflow for integer data types.""" |
This file contains 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 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 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 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 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.