Skip to content

Commit

Permalink
Improved numpy ffi (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron authored Feb 27, 2024
1 parent 99b7cfe commit adf2a85
Show file tree
Hide file tree
Showing 6 changed files with 206 additions and 70 deletions.
85 changes: 81 additions & 4 deletions python/core/python/geoarrow/rust/core/_rust.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -466,59 +466,80 @@ class BooleanArray:
) -> Tuple[object, object]: ...

# class Float16Array:
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def __array__(self) -> NDArray[np.float16]: ...
# def __arrow_c_array__(
# self, requested_schema: object | None = None
# ) -> Tuple[object, object]: ...

# class Float32Array:
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.float16]) -> Self: ...

# class Float32Array:
# def __array__(self) -> NDArray[np.float32]: ...
# def __arrow_c_array__(
# self, requested_schema: object | None = None
# ) -> Tuple[object, object]: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def to_numpy(self) -> NDArray[np.float32]: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.float32]) -> Self: ...

class Float64Array:
def __array__(self) -> NDArray[np.float64]: ...
def __eq__(self, other: Self) -> bool: ...
def __len__(self) -> int: ...
def __arrow_c_array__(
self, requested_schema: object | None = None
) -> Tuple[object, object]: ...
def to_numpy(self) -> NDArray[np.float64]: ...
@classmethod
def from_numpy(cls, arr: NDArray[np.float64]) -> Self: ...

# class Int16Array:
# def __array__(self) -> NDArray[np.int16]: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def __arrow_c_array__(
# self, requested_schema: object | None = None
# ) -> Tuple[object, object]: ...
# def to_numpy(self) -> NDArray[np.int16]: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.int16]) -> Self: ...

# class Int32Array:
# def __array__(self) -> NDArray[np.int32]: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def __arrow_c_array__(
# self, requested_schema: object | None = None
# ) -> Tuple[object, object]: ...
# def to_numpy(self) -> NDArray[np.int32]: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.int32]) -> Self: ...

# class Int64Array:
# def __array__(self) -> NDArray[np.int64]: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def __arrow_c_array__(
# self, requested_schema: object | None = None
# ) -> Tuple[object, object]: ...
# def to_numpy(self) -> NDArray[np.int64]: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.int64]) -> Self: ...

# class Int8Array:
# def __array__(self) -> NDArray[np.int8]: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def __arrow_c_array__(
# self, requested_schema: object | None = None
# ) -> Tuple[object, object]: ...
# def to_numpy(self) -> NDArray[np.int8]: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.int8]) -> Self: ...

# class LargeStringArray:
# def __eq__(self, other: Self) -> bool: ...
Expand All @@ -535,36 +556,48 @@ class Float64Array:
# ) -> Tuple[object, object]: ...

# class UInt16Array:
# def __array__(self) -> NDArray[np.uint16]: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def __arrow_c_array__(
# self, requested_schema: object | None = None
# ) -> Tuple[object, object]: ...
# def to_numpy(self) -> NDArray[np.uint16]: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.uint16]) -> Self: ...

# class UInt32Array:
# def __array__(self) -> NDArray[np.uint32]: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def __arrow_c_array__(
# self, requested_schema: object | None = None
# ) -> Tuple[object, object]: ...
# def to_numpy(self) -> NDArray[np.uint32]: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.uint32]) -> Self: ...

# class UInt64Array:
# def __array__(self) -> NDArray[np.uint64]: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def __arrow_c_array__(
# self, requested_schema: object | None = None
# ) -> Tuple[object, object]: ...
# def to_numpy(self) -> NDArray[np.uint64]: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.uint64]) -> Self: ...

# class UInt8Array:
# def __array__(self) -> NDArray[np.uint8]: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def __arrow_c_array__(
# self, requested_schema: object | None = None
# ) -> Tuple[object, object]: ...
# def to_numpy(self) -> NDArray[np.uint8]: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.uint8]) -> Self: ...

class ChunkedPointArray:
def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
Expand Down Expand Up @@ -876,60 +909,88 @@ class ChunkedBooleanArray:
def num_chunks(self) -> int: ...

# class ChunkedFloat16Array:
# def __array__(self) -> NDArray[np.float16]: ...
# def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def chunk(self, i: int) -> Float16Array: ...
# def chunks(self) -> List[Float16Array]: ...
# def num_chunks(self) -> int: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.float16], lengths: List[int]) -> Self: ...
# def to_numpy(self) -> NDArray[np.float16]: ...

# class ChunkedFloat32Array:
# def __array__(self) -> NDArray[np.float32]: ...
# def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def chunk(self, i: int) -> Float32Array: ...
# def chunks(self) -> List[Float32Array]: ...
# def num_chunks(self) -> int: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.float32], lengths: List[int]) -> Self: ...
# def to_numpy(self) -> NDArray[np.float32]: ...

class ChunkedFloat64Array:
def __array__(self) -> NDArray[np.float64]: ...
def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
def __eq__(self, other: Self) -> bool: ...
def __len__(self) -> int: ...
def chunk(self, i: int) -> Float64Array: ...
def chunks(self) -> List[Float64Array]: ...
def num_chunks(self) -> int: ...
@classmethod
def from_numpy(cls, arr: NDArray[np.float64], lengths: List[int]) -> Self: ...
def to_numpy(self) -> NDArray[np.float64]: ...

# class ChunkedInt16Array:
# def __array__(self) -> NDArray[np.int16]: ...
# def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def chunk(self, i: int) -> Int16Array: ...
# def chunks(self) -> List[Int16Array]: ...
# def num_chunks(self) -> int: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.int16], lengths: List[int]) -> Self: ...
# def to_numpy(self) -> NDArray[np.int16]: ...

# class ChunkedInt32Array:
# def __array__(self) -> NDArray[np.int32]: ...
# def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def chunk(self, i: int) -> Int32Array: ...
# def chunks(self) -> List[Int32Array]: ...
# def num_chunks(self) -> int: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.int32], lengths: List[int]) -> Self: ...
# def to_numpy(self) -> NDArray[np.int32]: ...

# class ChunkedInt64Array:
# def __array__(self) -> NDArray[np.int64]: ...
# def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def chunk(self, i: int) -> Int64Array: ...
# def chunks(self) -> List[Int64Array]: ...
# def num_chunks(self) -> int: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.int64], lengths: List[int]) -> Self: ...
# def to_numpy(self) -> NDArray[np.int64]: ...

# class ChunkedInt8Array:
# def __array__(self) -> NDArray[np.int8]: ...
# def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def chunk(self, i: int) -> Int8Array: ...
# def chunks(self) -> List[Int8Array]: ...
# def num_chunks(self) -> int: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.int8], lengths: List[int]) -> Self: ...
# def to_numpy(self) -> NDArray[np.int8]: ...

# class ChunkedLargeStringArray:
# def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
Expand All @@ -948,36 +1009,52 @@ class ChunkedFloat64Array:
# def num_chunks(self) -> int: ...

# class ChunkedUInt16Array:
# def __array__(self) -> NDArray[np.uint16]: ...
# def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def chunk(self, i: int) -> UInt16Array: ...
# def chunks(self) -> List[UInt16Array]: ...
# def num_chunks(self) -> int: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.uint16], lengths: List[int]) -> Self: ...
# def to_numpy(self) -> NDArray[np.uint16]: ...

# class ChunkedUInt32Array:
# def __array__(self) -> NDArray[np.uint32]: ...
# def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def chunk(self, i: int) -> UInt32Array: ...
# def chunks(self) -> List[UInt32Array]: ...
# def num_chunks(self) -> int: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.uint32], lengths: List[int]) -> Self: ...
# def to_numpy(self) -> NDArray[np.uint32]: ...

# class ChunkedUInt64Array:
# def __array__(self) -> NDArray[np.uint64]: ...
# def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def chunk(self, i: int) -> UInt64Array: ...
# def chunks(self) -> List[UInt64Array]: ...
# def num_chunks(self) -> int: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.uint64], lengths: List[int]) -> Self: ...
# def to_numpy(self) -> NDArray[np.uint64]: ...

# class ChunkedUInt8Array:
# def __array__(self) -> NDArray[np.uint8]: ...
# def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
# def __eq__(self, other: Self) -> bool: ...
# def __len__(self) -> int: ...
# def chunk(self, i: int) -> UInt8Array: ...
# def chunks(self) -> List[UInt8Array]: ...
# def num_chunks(self) -> int: ...
# @classmethod
# def from_numpy(cls, arr: NDArray[np.uint8], lengths: List[int]) -> Self: ...
# def to_numpy(self) -> NDArray[np.uint8]: ...

class GeoTable:
def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
Expand Down
33 changes: 0 additions & 33 deletions python/core/src/algorithm/geo/todo/affine_ops.rs

This file was deleted.

22 changes: 0 additions & 22 deletions python/core/src/algorithm/geo/todo/mod.rs

This file was deleted.

Loading

0 comments on commit adf2a85

Please sign in to comment.