This is an automated email from the ASF dual-hosted git repository.
paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git
The following commit(s) were added to refs/heads/main by this push:
new e8af2936 chore: bump black from 22.3.0 to 26.10.1 in /python (#1028)
e8af2936 is described below
commit e8af29367337f7598b912d62b002755a6355597c
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
AuthorDate: Wed Nov 25 09:58:51 2026 -0500
chore: bump black from 22.3.0 to 26.10.1 in /python (#1028)
Bumps [black](https://github.com/psf/black) from 22.3.0 to 26.10.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/psf/black/releases">black's
releases</a>.</em></p>
<blockquote>
<h2>26.10.1</h2>
<h3>Highlights</h3>
<p>This release fixes a security issue in Black's bundled GitHub Action.
Repositories that
use the action are encouraged to update to the latest version of Black
immediately. This
update is received automatically when using
<code>psf/black@stable</code>, and is independent of
the version of Black installed by the action.</p>
<p>When the GitHub Action reads version specifiers from
<code>tool.black.required-version</code>, it
now only accepts released versions of Black, as it already did for
<code>black</code> requirements
in dependency lists. Other values, such as URL references, are now
rejected. This issue
has been registered as <code>GHSA-cg8m-r9f2-5wm2</code>; a CVE
identifier is pending.</p>
<h3>Stable style</h3>
<ul>
<li>Fix a long Jupyter notebook assignment magic (for example <code>x =
!ls -la</code>) being wrapped
in parentheses, which IPython can no longer run; such cells are now left
unchanged
(<a
href="https://redirect.github.com/psf/black/issues/5481">#5481</a>)</li>
<li>Keep repeated lines outside the selected <code>--line-ranges</code>
unchanged (<a
href="https://redirect.github.com/psf/black/issues/5436">#5436</a>)</li>
<li>Fix <code>--line-ranges</code> formatting lines that follow a
statement when formatting joins or
re-indents that statement (<a
href="https://redirect.github.com/psf/black/issues/5484">#5484</a>)</li>
<li>Fix <code>--line-ranges</code> crashing with an internal error when
an unselected statement has a
<code># fmt: skip</code> comment on the last line before a closing
bracket (<a
href="https://redirect.github.com/psf/black/issues/5477">#5477</a>)</li>
<li>Prevent moving an encoding declaration (for example <code># -*-
coding: latin-1 -*-</code>) onto
the first two lines of a file (<a
href="https://redirect.github.com/psf/black/issues/5487">#5487</a>)</li>
<li>Fix adding an extra trailing blank line inside a multi-line module
docstring when its
last line is near the line length limit (<a
href="https://redirect.github.com/psf/black/issues/5494">#5494</a>)</li>
</ul>
<h3>Preview style</h3>
<ul>
<li>Do not split short expressions on delimiters (such as binary
operators, comparisons,
or comprehensions) inside brackets when preceded by a standalone comment
(<a
href="https://redirect.github.com/psf/black/issues/5455">#5455</a>)</li>
<li>Fix the unstable <code>string_processing</code> feature removing
backslash-newline sequences from
raw strings, which changed their value (<a
href="https://redirect.github.com/psf/black/issues/5482">#5482</a>)</li>
<li>Avoid adding unnecessary parentheses around unbreakable right-hand
side expressions in
assignments (such as annotated assignments or subscript targets) (<a
href="https://redirect.github.com/psf/black/issues/5473">#5473</a>)</li>
<li>Parenthesize expressions with parameter comments when they exceed
the line length
under <code>--preview</code> (<a
href="https://redirect.github.com/psf/black/issues/5442">#5442</a>)</li>
<li>Fix <code>wrap_long_dict_values_in_parens</code> dropping the
parentheses around a right-hand
side that contains a dictionary, leaving a line over the length limit
(<a
href="https://redirect.github.com/psf/black/issues/5492">#5492</a>)</li>
<li>Fix the unstable <code>string_processing</code> feature adding a
space after <code>*</code> or <code>**</code> in a PEP
695 type parameter (<code>* Ts = ...</code>) when it splits a string in
the parameter's default
(<a
href="https://redirect.github.com/psf/black/issues/5504">#5504</a>)</li>
<li>Avoid unnecessary line splits of trailers (such as
indexing/subscripts) when an
earlier bracket split exceeds the line length only due to a trailing
comment (<a
href="https://redirect.github.com/psf/black/issues/5498">#5498</a>)</li>
</ul>
<h3>Configuration</h3>
<ul>
<li>Add <code>--cache-dir</code> to configure the cache directory from
the command line (<a
href="https://redirect.github.com/psf/black/issues/5433">#5433</a>)</li>
<li>Don't cache a file as formatted after formatting or checking it with
<code>--line-ranges</code>,</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/psf/black/blob/main/CHANGES.md">black's
changelog</a>.</em></p>
<blockquote>
<h2>Version 26.10.1</h2>
<h3>Highlights</h3>
<p>This release fixes a security issue in Black's bundled GitHub Action.
Repositories that
use the action are encouraged to update to the latest version of Black
immediately. This
update is received automatically when using
<code>psf/black@stable</code>, and is independent of
the version of Black installed by the action.</p>
<p>When the GitHub Action reads version specifiers from
<code>tool.black.required-version</code>, it
now only accepts released versions of Black, as it already did for
<code>black</code> requirements
in dependency lists. Other values, such as URL references, are now
rejected. This issue
has been registered as <code>GHSA-cg8m-r9f2-5wm2</code>; a CVE
identifier is pending.</p>
<h3>Stable style</h3>
<ul>
<li>Fix a long Jupyter notebook assignment magic (for example <code>x =
!ls -la</code>) being wrapped
in parentheses, which IPython can no longer run; such cells are now left
unchanged
(<a
href="https://redirect.github.com/psf/black/issues/5481">#5481</a>)</li>
<li>Keep repeated lines outside the selected <code>--line-ranges</code>
unchanged (<a
href="https://redirect.github.com/psf/black/issues/5436">#5436</a>)</li>
<li>Fix <code>--line-ranges</code> formatting lines that follow a
statement when formatting joins or
re-indents that statement (<a
href="https://redirect.github.com/psf/black/issues/5484">#5484</a>)</li>
<li>Fix <code>--line-ranges</code> crashing with an internal error when
an unselected statement has a
<code># fmt: skip</code> comment on the last line before a closing
bracket (<a
href="https://redirect.github.com/psf/black/issues/5477">#5477</a>)</li>
<li>Prevent moving an encoding declaration (for example <code># -*-
coding: latin-1 -*-</code>) onto
the first two lines of a file (<a
href="https://redirect.github.com/psf/black/issues/5487">#5487</a>)</li>
<li>Fix adding an extra trailing blank line inside a multi-line module
docstring when its
last line is near the line length limit (<a
href="https://redirect.github.com/psf/black/issues/5494">#5494</a>)</li>
<li>Preserve blank lines between imports and unselected statements when
using
<code>--line-ranges</code>, and ensure a blank line is added between an
unselected import and a
newly formatted statement (<a
href="https://redirect.github.com/psf/black/issues/5493">#5493</a>, <a
href="https://redirect.github.com/psf/black/issues/5649">#5649</a>)</li>
<li>Keep the parentheses around a walrus that is the only item in a set
(for example
<code>{(x := f())}</code>) when targeting Python 3.9 or older, since
Python 3.8 and 3.9.0 can't
parse it without them (<a
href="https://redirect.github.com/psf/black/issues/5502">#5502</a>)</li>
</ul>
<h3>Preview style</h3>
<ul>
<li>Do not split short expressions on delimiters (such as binary
operators, comparisons,
or comprehensions) inside brackets when preceded by a standalone comment
(<a
href="https://redirect.github.com/psf/black/issues/5455">#5455</a>)</li>
<li>Fix the unstable <code>string_processing</code> feature removing
backslash-newline sequences from
raw strings, which changed their value (<a
href="https://redirect.github.com/psf/black/issues/5482">#5482</a>)</li>
<li>Avoid adding unnecessary parentheses around unbreakable right-hand
side expressions in
assignments (such as annotated assignments or subscript targets) (<a
href="https://redirect.github.com/psf/black/issues/5473">#5473</a>)</li>
<li>Parenthesize expressions with parameter comments when they exceed
the line length
under <code>--preview</code> (<a
href="https://redirect.github.com/psf/black/issues/5442">#5442</a>)</li>
<li>Fix <code>wrap_long_dict_values_in_parens</code> dropping the
parentheses around a right-hand
side that contains a dictionary, leaving a line over the length limit
(<a
href="https://redirect.github.com/psf/black/issues/5492">#5492</a>)</li>
<li>Fix the unstable <code>string_processing</code> feature adding a
space after <code>*</code> or <code>**</code> in a PEP
695 type parameter (<code>* Ts = ...</code>) when it splits a string in
the parameter's default
(<a
href="https://redirect.github.com/psf/black/issues/5504">#5504</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/psf/black/commit/258e7dbf348bc23cb70b8cdf693481c04634ebcc"><code>258e7db</code></a>
Prepare release 26.10.1 (<a
href="https://redirect.github.com/psf/black/issues/5511">#5511</a>)</li>
<li><a
href="https://github.com/psf/black/commit/ac1f71563aeccf73cf13ece00f231d9d6c66a514"><code>ac1f715</code></a>
Action: validate required-version better (<a
href="https://redirect.github.com/psf/black/issues/5510">#5510</a>)</li>
<li><a
href="https://github.com/psf/black/commit/fe241ccc443acbabbd75c8240d2fbc06ba4e52d6"><code>fe241cc</code></a>
Avoid splitting trailers when earlier bracket split exceeds length due
to com...</li>
<li><a
href="https://github.com/psf/black/commit/4fb2897a7ac539cc14d993e3697469e2529a265e"><code>4fb2897</code></a>
Bump actions/upload-artifact from 7.0.1 to 7.0.2 (<a
href="https://redirect.github.com/psf/black/issues/5500">#5500</a>)</li>
<li><a
href="https://github.com/psf/black/commit/6d0f5575575dfc5d51e88a3b114816640e933388"><code>6d0f557</code></a>
Bump actions/download-artifact from 8.0.1 to 8.0.2 (<a
href="https://redirect.github.com/psf/black/issues/5501">#5501</a>)</li>
<li><a
href="https://github.com/psf/black/commit/c45f21d0399747189eedcc6c9a1614b3cf49dc0f"><code>c45f21d</code></a>
Handle PEP 695 type parameter whitespace in whitespace() (<a
href="https://redirect.github.com/psf/black/issues/5504">#5504</a>)</li>
<li><a
href="https://github.com/psf/black/commit/8ec61a7fb6f1961377afd28bbe71f8a2095916ac"><code>8ec61a7</code></a>
Skip UTF-8 BOM when reading .gitignore (<a
href="https://redirect.github.com/psf/black/issues/5497">#5497</a>)</li>
<li><a
href="https://github.com/psf/black/commit/c9b1148b5b8799758756cbec7c0d1ac187d37f1a"><code>c9b1148</code></a>
Fix module docstring last_line_length when docstring ends with newline
(<a
href="https://redirect.github.com/psf/black/issues/5494">#5494</a>)</li>
<li><a
href="https://github.com/psf/black/commit/eb8835829969f82c2567119f528b188769f3ac6d"><code>eb88358</code></a>
Parenthesize expressions with parameter comments in preview (<a
href="https://redirect.github.com/psf/black/issues/3113">#3113</a>) (<a
href="https://redirect.github.com/psf/black/issues/5442">#5442</a>)</li>
<li><a
href="https://github.com/psf/black/commit/939fa93a1327d2a5f2829e6c1d7e4bd25a17b0f7"><code>939fa93</code></a>
Keep the parentheses around a right-hand side when a dict value's
parentheses...</li>
<li>Additional commits viewable in <a
href="https://github.com/psf/black/compare/22.3.0...26.10.1">compare
view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/apache/arrow-nanoarrow/network/alerts).
</details>
---------
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot]
<49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dewey Dunnington <[email protected]>
---
.pre-commit-config.yaml | 2 +-
python/bootstrap.py | 10 ++--------
python/requirements-stubs.txt | 2 +-
python/src/nanoarrow/_array.pyi | 19 +++++++++++++++++++
python/src/nanoarrow/_array_stream.pyi | 16 ++++++++++++++++
python/src/nanoarrow/_buffer.pyi | 30 ++++++++++++++++++++++++++++++
python/src/nanoarrow/_device.pyi | 8 ++++++++
python/src/nanoarrow/_ipc_lib.pyi | 6 ++++++
python/src/nanoarrow/_schema.pyi | 20 ++++++++++++++++++++
python/src/nanoarrow/_utils.pyi | 1 +
python/src/nanoarrow/c_schema.py | 1 -
11 files changed, 104 insertions(+), 11 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 116bac10..27e5cc76 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -41,7 +41,7 @@ repos:
- id: cmake-format
args: [--in-place]
- repo: https://github.com/psf/black
- rev: 22.3.0
+ rev: 26.10.1
hooks:
- id: black
types_or: [pyi, python]
diff --git a/python/bootstrap.py b/python/bootstrap.py
index 798070c8..825a5778 100644
--- a/python/bootstrap.py
+++ b/python/bootstrap.py
@@ -179,13 +179,10 @@ class NanoarrowPxdGenerator(PxdGenerator):
return content
def _pxd_header(self):
- return (
- super()._pxd_header()
- + """
+ return super()._pxd_header() + """
from libc.stdint cimport int8_t, uint8_t, int16_t, uint16_t
from libc.stdint cimport int32_t, uint32_t, int64_t, uint64_t
"""
- )
def _write_defs(self, output):
output.write(b"\n")
@@ -206,13 +203,10 @@ class NanoarrowDevicePxdGenerator(PxdGenerator):
return []
def _pxd_header(self):
- return (
- super()._pxd_header()
- + """
+ return super()._pxd_header() + """
from libc.stdint cimport int32_t, int64_t
from nanoarrow_c cimport *
"""
- )
def _write_defs(self, output):
output.write(b"\n")
diff --git a/python/requirements-stubs.txt b/python/requirements-stubs.txt
index ffc9c439..47c3aa89 100644
--- a/python/requirements-stubs.txt
+++ b/python/requirements-stubs.txt
@@ -16,6 +16,6 @@
# under the License.
# Keep Black in sync with .pre-commit-config.yaml.
-black==22.3.0
+black==26.10.1
Cython==3.3.1
mypy==2.4.1
diff --git a/python/src/nanoarrow/_array.pyi b/python/src/nanoarrow/_array.pyi
index 88f57044..4b9b811c 100644
--- a/python/src/nanoarrow/_array.pyi
+++ b/python/src/nanoarrow/_array.pyi
@@ -47,14 +47,18 @@ class CArray:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
@staticmethod
def allocate(schema) -> CArray:
"""Allocate a released ArrowArray"""
+
def child(self, i): ...
def is_valid(self) -> bool:
"""Check for a non-null and non-released underlying ArrowArray"""
+
def view(self) -> CArrayView:
"""Allocate a :class:`CArrayView` to access the buffers of this
array"""
+
def __arrow_c_array__(self, requested_schema=...):
"""
Get a pair of PyCapsules containing a C ArrowArray representation of
the object.
@@ -71,10 +75,13 @@ class CArray:
A pair of PyCapsules containing a C ArrowSchema and ArrowArray,
respectively.
"""
+
def __getitem__(self, index):
"""Return self[key]."""
+
def __len__(self) -> int:
"""Return len(self)."""
+
def __reduce__(self): ...
class CArrayBuilder:
@@ -87,6 +94,7 @@ class CArrayBuilder:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
@staticmethod
def allocate(device=...):
"""Create a CArrayBuilder
@@ -95,6 +103,7 @@ class CArrayBuilder:
ArrowArray private_data/release callback implementation. This should
usually be followed by :meth:`init_from_type` or
:meth:`init_from_schema`.
"""
+
def append_bytes(self, obj: Iterable[object]) -> CArrayBuilder: ...
def append_strings(self, obj: Iterable[str | None]) -> CArrayBuilder: ...
def ensure_buffers(self, n_buffers) -> CArrayBuilder: ...
@@ -112,21 +121,25 @@ class CArrayBuilder:
validation if possible. Validation may not be possible if children
were set that were not created by nanoarrow.
"""
+
def finish_device(self):
"""Finish building this array and export to an ArrowDeviceArray
Calls :meth:`finish`, propagating device information into an
ArrowDeviceArray.
"""
+
def init_from_schema(self, schema) -> CArrayBuilder: ...
def init_from_type(self, type_id) -> CArrayBuilder: ...
def is_empty(self) -> bool:
"""Check if any items have been appended to this builder"""
+
def resolve_null_count(self) -> CArrayBuilder:
"""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, i, buffer, move=...) -> CArrayBuilder:
"""Set an ArrowArray buffer
@@ -138,6 +151,7 @@ class CArrayBuilder:
is False (the default), this function will a make a shallow copy via
another
layer of Python object wrapping.
"""
+
def set_child(self, i, c_array, move=...) -> CArrayBuilder:
"""Set an ArrowArray child
@@ -146,6 +160,7 @@ class CArrayBuilder:
must have been initialized before this call by initializing this
builder with a schema containing the correct number of children.
"""
+
def set_length(self, length) -> CArrayBuilder: ...
def set_null_count(self, null_count) -> CArrayBuilder: ...
def set_offset(self, offset) -> CArrayBuilder: ...
@@ -155,6 +170,7 @@ class CArrayBuilder:
Calling this method is required to produce a valid array prior to
calling
:meth:`append_strings` or `append_bytes`.
"""
+
def __reduce__(self): ...
class CArrayView:
@@ -181,6 +197,7 @@ class CArrayView:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
def buffer(self, i): ...
def buffer_type(self, i): ...
def child(self, i): ...
@@ -190,6 +207,7 @@ class CArrayView:
def from_schema(schema): ...
def __len__(self) -> int:
"""Return len(self)."""
+
def __reduce__(self): ...
class CDeviceArray:
@@ -210,6 +228,7 @@ class CDeviceArray:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
def view(self) -> CArrayView: ...
def __arrow_c_array__(self, requested_schema=...): ...
def __arrow_c_device_array__(self, requested_schema=...): ...
diff --git a/python/src/nanoarrow/_array_stream.pyi
b/python/src/nanoarrow/_array_stream.pyi
index 78a66870..73a1e3cb 100644
--- a/python/src/nanoarrow/_array_stream.pyi
+++ b/python/src/nanoarrow/_array_stream.pyi
@@ -33,9 +33,11 @@ class CArrayStream:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
@staticmethod
def allocate() -> CArrayStream:
"""Allocate a released ArrowArrayStream"""
+
@staticmethod
def from_c_arrays(
arrays: list[CArray], schema, move=..., validate=...
@@ -61,21 +63,26 @@ class CArrayStream:
If True, enforce type equality between the provided schema and the
schema
of each array.
"""
+
def get_next(self) -> CArray:
"""Get the next Array from this stream
Raises StopIteration when there are no more arrays in this stream.
"""
+
def get_schema(self) -> CSchema:
"""Get the schema associated with this stream
Calling this method will always issue a call to the underlying stream's
get_schema callback.
"""
+
def is_valid(self) -> bool:
"""Check for a non-null and non-released underlying ArrowArrayStream"""
+
def release(self):
"""Explicitly call the release callback of this stream"""
+
def __arrow_c_stream__(self, requested_schema=...):
"""
Export the stream as an Arrow C stream PyCapsule.
@@ -90,10 +97,12 @@ class CArrayStream:
-------
PyCapsule
"""
+
def __enter__(self): ...
def __exit__(self, *args, **kwargs): ...
def __iter__(self):
"""Implement iter(self)."""
+
def __next__(self): ...
def __reduce__(self): ...
@@ -112,14 +121,17 @@ class CMaterializedArrayStream:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
def array(self, i) -> CArray: ...
def child(self, i) -> CMaterializedArrayStream: ...
@staticmethod
def from_c_array(array) -> CMaterializedArrayStream:
""" "Create a materialized array stream from a single array"""
+
@staticmethod
def from_c_array_stream(stream) -> CMaterializedArrayStream:
""" "Create a materialized array stream from an unmaterialized
ArrowArrayStream"""
+
@staticmethod
def from_c_arrays(arrays: Iterable[CArray], schema, validate=...):
""" "Create a materialized array stream from an existing iterable of
arrays
@@ -127,11 +139,15 @@ class CMaterializedArrayStream:
This is slightly more efficient than creating a stream and then
consuming it
because the implementation can avoid a shallow copy of each array.
"""
+
def __arrow_c_stream__(self, requested_schema=...): ...
def __getitem__(self, index):
"""Return self[key]."""
+
def __iter__(self):
"""Implement iter(self)."""
+
def __len__(self) -> int:
"""Return len(self)."""
+
def __reduce__(self): ...
diff --git a/python/src/nanoarrow/_buffer.pyi b/python/src/nanoarrow/_buffer.pyi
index 9872eee3..cde21d68 100644
--- a/python/src/nanoarrow/_buffer.pyi
+++ b/python/src/nanoarrow/_buffer.pyi
@@ -41,11 +41,13 @@ class CBuffer:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
def element(self, i): ...
def elements(self, offset=..., length=...): ...
@staticmethod
def empty():
"""Create an empty CBuffer"""
+
@staticmethod
def from_dlpack(obj, stream=...) -> CBuffer:
"""Create a CBuffer using the DLPack protocol
@@ -64,6 +66,7 @@ class CBuffer:
the caller is responsible for creating a sync event after creating
one
or more buffers in this way).
"""
+
@staticmethod
def from_pybuffer(obj) -> CBuffer:
"""Create a CBuffer using the Python buffer protocol
@@ -76,6 +79,7 @@ class CBuffer:
obj : buffer-like
The object on which to invoke the Python buffer protocol
"""
+
def view(self):
"""Export this buffer as a CBufferView
@@ -85,14 +89,19 @@ class CBuffer:
(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):
"""Return self[key]."""
+
def __iter__(self):
"""Implement iter(self)."""
+
def __len__(self) -> int:
"""Return len(self)."""
+
def __reduce__(self): ...
def __release_buffer__(self, *args, **kwargs):
"""Release the buffer object that exposes the underlying memory of the
object."""
@@ -116,6 +125,7 @@ class CBufferBuilder:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
def advance(self, additional_bytes):
"""Manually increase :attr:`size_bytes` by ``additional_bytes``
@@ -123,6 +133,7 @@ class CBufferBuilder:
to ensure that :attr:`size_bytes` accurately reflects the number of
bytes written to the buffer.
"""
+
def finish(self):
"""Finish building this buffer
@@ -131,15 +142,19 @@ class CBufferBuilder:
on this object after it has been finished is not currently
defined (but should not crash).
"""
+
def reserve_bytes(self, additional_bytes):
"""Ensure that the underlying buffer has space for ``additional_bytes``
more bytes to be written"""
+
def set_data_type(self, type_id, element_size_bits=...):
"""Set the data type used to interpret elements in
:meth:`write_elements`."""
+
def set_format(self, format):
"""Set the Python buffer format used to interpret elements in
:meth:`write_elements`.
"""
+
def write(self, content):
"""Write bytes to this buffer
@@ -148,6 +163,7 @@ class CBufferBuilder:
This method returns the number of bytes that were written.
"""
+
def write_elements(self, obj):
""" "Write an iterable of elements to this buffer
@@ -158,15 +174,19 @@ class CBufferBuilder:
This method returns the number of elements that were written.
"""
+
def write_fill(self, value, size_bytes):
"""Write fill bytes to this buffer
Appends the byte ``value`` to this buffer ``size_bytes`` times.
"""
+
def __buffer__(self, *args, **kwargs):
"""Return a buffer object that exposes the underlying memory of the
object."""
+
def __len__(self) -> int:
"""Return len(self)."""
+
def __reduce__(self): ...
def __release_buffer__(self, *args, **kwargs):
"""Release the buffer object that exposes the underlying memory of the
object."""
@@ -191,6 +211,7 @@ class CBufferView:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
def copy(self, offset=..., length=...): ...
def copy_into(self, dest, offset=..., length=..., dest_offset=...): ...
def element(self, i): ...
@@ -199,6 +220,7 @@ class CBufferView:
def unpack_bits_into(self, dest, offset=..., length=..., dest_offset=...):
...
def __buffer__(self, *args, **kwargs):
"""Return a buffer object that exposes the underlying memory of the
object."""
+
def __dlpack__(self, stream=...):
"""
Export CBufferView as a DLPack capsule.
@@ -215,6 +237,7 @@ class CBufferView:
capsule : PyCapsule
A DLPack capsule for the array, pointing to a DLManagedTensor.
"""
+
def __dlpack_device__(self):
"""
Return the DLPack device tuple this CBufferView resides on.
@@ -226,12 +249,16 @@ class CBufferView:
CPU = 1, see python/src/nanoarrow/dpack_abi.h) and index of the
device which is 0 by default for CPU.
"""
+
def __getitem__(self, index):
"""Return self[key]."""
+
def __iter__(self):
"""Implement iter(self)."""
+
def __len__(self) -> int:
"""Return len(self)."""
+
def __reduce__(self): ...
def __release_buffer__(self, *args, **kwargs):
"""Release the buffer object that exposes the underlying memory of the
object."""
@@ -250,10 +277,13 @@ class NoneAwareWrapperIterator:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
def finish(self):
"""Obtain the total count, null count, and validity bitmap after
consuming this iterable."""
+
def reserve(self, additional_elements): ...
def __iter__(self):
"""Implement iter(self)."""
+
def __reduce__(self): ...
diff --git a/python/src/nanoarrow/_device.pyi b/python/src/nanoarrow/_device.pyi
index 8016219c..990932dc 100644
--- a/python/src/nanoarrow/_device.pyi
+++ b/python/src/nanoarrow/_device.pyi
@@ -24,6 +24,7 @@ class CSharedSyncEvent:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
def __reduce__(self): ...
class Device:
@@ -41,20 +42,27 @@ class Device:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
@staticmethod
def resolve(device_type, device_id): ...
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):
diff --git a/python/src/nanoarrow/_ipc_lib.pyi
b/python/src/nanoarrow/_ipc_lib.pyi
index ee42b3e1..39a855c9 100644
--- a/python/src/nanoarrow/_ipc_lib.pyi
+++ b/python/src/nanoarrow/_ipc_lib.pyi
@@ -21,6 +21,7 @@ class CIpcInputStream:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
@staticmethod
def from_readable(obj, close_obj=...): ...
def is_valid(self): ...
@@ -31,6 +32,7 @@ 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(obj, close_obj=...): ...
def is_valid(self): ...
@@ -41,6 +43,7 @@ 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): ...
def release(self): ...
def write_array_stream(self, stream_addr): ...
@@ -55,11 +58,14 @@ class PyStreamPrivate:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
def set_buffer(self, addr, size_bytes): ...
def __buffer__(self, *args, **kwargs):
"""Return a buffer object that exposes the underlying memory of the
object."""
+
def __len__(self) -> int:
"""Return len(self)."""
+
def __reduce__(self): ...
def __release_buffer__(self, *args, **kwargs):
"""Release the buffer object that exposes the underlying memory of the
object."""
diff --git a/python/src/nanoarrow/_schema.pyi b/python/src/nanoarrow/_schema.pyi
index fd8f08ff..d4cefe7e 100644
--- a/python/src/nanoarrow/_schema.pyi
+++ b/python/src/nanoarrow/_schema.pyi
@@ -31,6 +31,7 @@ class CArrowTimeUnit:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
def __reduce__(self): ...
class CLayout:
@@ -46,6 +47,7 @@ class CLayout:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
def __reduce__(self): ...
class CSchema:
@@ -68,12 +70,15 @@ class CSchema:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
@staticmethod
def allocate() -> CSchema:
"""Allocate a released CSchema"""
+
def child(self, i): ...
def is_valid(self) -> bool:
"""Check for a non-null and non-released underlying ArrowSchema"""
+
def modify(
self,
*,
@@ -102,10 +107,12 @@ class CSchema:
If True, actual and expected will be considered equal if their
data type information and marked nullability are identical.
"""
+
def __arrow_c_schema__(self):
"""
Export to a ArrowSchema PyCapsule
"""
+
def __deepcopy__(self, memo=...) -> CSchema: ...
def __reduce__(self): ...
@@ -119,6 +126,7 @@ class CSchemaBuilder:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
@staticmethod
def allocate() -> CSchemaBuilder:
"""Create a CSchemaBuilder
@@ -127,9 +135,11 @@ class CSchemaBuilder:
ArrowSchema private_data/release callback implementation. This should
usually be followed by :meth:`set_type` or :meth:`set_format`.
"""
+
def allocate_children(self, n) -> CSchemaBuilder: ...
def append_metadata(self, metadata: Mapping[bytes, bytes]) ->
CSchemaBuilder:
"""Append key/value metadata"""
+
def child(self, i) -> CSchemaBuilder: ...
def finish(self) -> CSchema: ...
def set_child(self, i, name, child_src) -> CSchemaBuilder: ...
@@ -181,6 +191,7 @@ class CSchemaView:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
def __reduce__(self): ...
class SchemaMetadata:
@@ -196,32 +207,41 @@ class SchemaMetadata:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
@staticmethod
def empty():
"""Create an empty SchemaMetadata with no keys or values"""
+
def items(self) -> Iterable[tuple[bytes, bytes]]:
"""Iterate over key/value pairs
The result may contain duplicate keys if they exist in the metadata."""
+
def keys(self) -> list[bytes]:
"""List meadata keys
The result may contain duplicate keys if they exist in the metadata.
"""
+
def values(self) -> list[bytes]:
"""List metadata values"""
+
def __contains__(self, other) -> bool:
"""Return bool(key in self)."""
+
def __getitem__(self, index):
"""Get the value associated with a unique key
Retrieves the unique value associated with k. Raises KeyError if
k does not point to exactly one value in the metadata.
"""
+
def __iter__(self):
"""Implement iter(self)."""
+
def __len__(self) -> int:
"""Return len(self)."""
+
def __reduce__(self): ...
def assert_type_equal(actual, expected, check_nullability):
diff --git a/python/src/nanoarrow/_utils.pyi b/python/src/nanoarrow/_utils.pyi
index 9506eed2..e0e2eb8a 100644
--- a/python/src/nanoarrow/_utils.pyi
+++ b/python/src/nanoarrow/_utils.pyi
@@ -27,6 +27,7 @@ class Error:
@classmethod
def __init__(cls, *args, **kwargs) -> None:
"""Create and return a new object. See help(type) for accurate
signature."""
+
def __reduce__(self): ...
class NanoarrowException(RuntimeError):
diff --git a/python/src/nanoarrow/c_schema.py b/python/src/nanoarrow/c_schema.py
index 94712c61..fe73e2b2 100644
--- a/python/src/nanoarrow/c_schema.py
+++ b/python/src/nanoarrow/c_schema.py
@@ -25,7 +25,6 @@ in Cython and their scope is limited to lifecycle management
and member access a
Python objects.
"""
-
from nanoarrow._schema import CSchema, CSchemaView
from nanoarrow._utils import obj_is_capsule