Skip to content

Commit

Permalink
update stubs for rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot committed Sep 19, 2024
1 parent 5990c04 commit 437942a
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 5 deletions.
11 changes: 10 additions & 1 deletion python/src/nanoarrow/_array.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,21 @@ class CArrayBuilder:
validation if possible. Validation may not be possible if children
were set that were not created by nanoarrow.
"""
def finish_device(self, *args, **kwargs):
"""Finish building this array and export to an ArrowDeviceArray
Calls :meth:`finish`, propagating device information into an ArrowDeviceArray.
"""
def init_from_schema(self, *args, **kwargs): ...
def init_from_type(self, *args, **kwargs): ...
def is_empty(self, *args, **kwargs):
"""Check if any items have been appended to this builder"""
def resolve_null_count(self, *args, **kwargs):
"""Ensure the output null count is synchronized with existing buffers"""
"""Ensure the output null count is synchronized with existing buffers
Note that this will not attempt to access non-CPU buffers such that
:attr:`null_count` might still be -1 after calling this method.
"""
def set_buffer(self, *args, **kwargs):
"""Set an ArrowArray buffer
Expand Down
45 changes: 42 additions & 3 deletions python/src/nanoarrow/_buffer.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class CBuffer:
__pyx_vtable__: ClassVar[PyCapsule] = ...
data_type: Incomplete
data_type_id: Incomplete
device: Incomplete
element_size_bits: Incomplete
format: Incomplete
itemsize: Incomplete
Expand All @@ -40,9 +41,47 @@ class CBuffer:
def element(self, *args, **kwargs): ...
def elements(self, *args, **kwargs): ...
@staticmethod
def empty(*args, **kwargs): ...
def empty(*args, **kwargs):
"""Create an empty CBuffer"""
@staticmethod
def from_dlpack(*args, **kwargs):
"""Create a CBuffer using the DLPack protocol
Wraps a tensor from an external library as a CBuffer that can be used
to create an array.
Parameters
----------
obj : object with a ``__dlpack__`` attribute
The object on which to invoke the DLPack protocol
stream : int, optional
The stream on which the tensor represented by obj should be made
safe for use. This value is passed to the object's ``__dlpack__``
method; however, the CBuffer does not keep any record of this (i.e.,
the caller is responsible for creating a sync event after creating one
or more buffers in this way).
"""
@staticmethod
def from_pybuffer(*args, **kwargs): ...
def from_pybuffer(*args, **kwargs):
"""Create a CBuffer using the Python buffer protocol
Wraps a buffer using the Python buffer protocol as a CBuffer that can be
used to create an array.
Parameters
----------
obj : buffer-like
The object on which to invoke the Python buffer protocol
"""
def view(self, *args, **kwargs):
"""Export this buffer as a CBufferView
Returns a :class:`CBufferView` of this buffer. After calling this
method, the original CBuffer will be invalidated and cannot be used.
In general, the view of the buffer should be used to consume a buffer
(whereas the CBuffer is primarily used to wrap an existing object in
a way that it can be used to build a :class:`CArray`).
"""
def __buffer__(self, *args, **kwargs):
"""Return a buffer object that exposes the underlying memory of the object."""
def __getitem__(self, index):
Expand Down Expand Up @@ -147,7 +186,7 @@ class CBufferView:
Parameters
----------
stream : int, optional
A Python integer representing a pointer to a stream. Currently not supported.
A Python integer representing a pointer to a stream.
Stream is provided by the consumer to the producer to instruct the producer
to ensure that operations can safely be performed on the array.
Expand Down
19 changes: 19 additions & 0 deletions python/src/nanoarrow/_device.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ __reduce_cython__: _cython_3_0_11.cython_function_or_method
__setstate_cython__: _cython_3_0_11.cython_function_or_method
__test__: dict

class CSharedSyncEvent:
__pyx_vtable__: ClassVar[PyCapsule] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate signature."""
def __reduce__(self): ...

class Device:
device_id: Incomplete
device_type: Incomplete
Expand All @@ -34,6 +41,18 @@ class Device:
"""Create and return a new object. See help(type) for accurate signature."""
@staticmethod
def resolve(*args, **kwargs): ...
def __eq__(self, other: object) -> bool:
"""Return self==value."""
def __ge__(self, other: object) -> bool:
"""Return self>=value."""
def __gt__(self, other: object) -> bool:
"""Return self>value."""
def __le__(self, other: object) -> bool:
"""Return self<=value."""
def __lt__(self, other: object) -> bool:
"""Return self<value."""
def __ne__(self, other: object) -> bool:
"""Return self!=value."""
def __reduce__(self): ...

class DeviceType(enum.Enum):
Expand Down
24 changes: 23 additions & 1 deletion python/src/nanoarrow/_ipc_lib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,29 @@ class CIpcInputStream:
def release(self, *args, **kwargs): ...
def __reduce__(self): ...

class PyInputStreamPrivate:
class CIpcOutputStream:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate signature."""
@staticmethod
def from_writable(*args, **kwargs): ...
def is_valid(self, *args, **kwargs): ...
def release(self, *args, **kwargs): ...
def __reduce__(self): ...

class CIpcWriter:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate signature."""
def is_valid(self, *args, **kwargs): ...
def release(self, *args, **kwargs): ...
def write_array_stream(self, *args, **kwargs): ...
def write_array_view(self, *args, **kwargs): ...
def write_end_of_stream(self, *args, **kwargs): ...
def write_schema(self, *args, **kwargs): ...
def __reduce__(self): ...

class PyStreamPrivate:
close_obj: Incomplete
obj: Incomplete
@classmethod
Expand Down

0 comments on commit 437942a

Please sign in to comment.