Skip to content

Commit 9240240

Browse files
committed
Merge remote-tracking branch 'two/tmp' into history
2 parents a759d90 + f385da6 commit 9240240

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+40515
-0
lines changed

python/stubs/__init__.pyi

Lines changed: 656 additions & 0 deletions
Large diffs are not rendered by default.

python/stubs/__lib_pxi/__init__.pyi

Whitespace-only changes.

python/stubs/__lib_pxi/array.pyi

Lines changed: 4274 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def benchmark_PandasObjectIsNull(list) -> None: ... # noqa: N802

python/stubs/__lib_pxi/builder.pyi

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
from typing import Iterable
2+
3+
from pyarrow.lib import MemoryPool, _Weakrefable
4+
5+
from .array import StringArray, StringViewArray
6+
7+
class StringBuilder(_Weakrefable):
8+
"""
9+
Builder class for UTF8 strings.
10+
11+
This class exposes facilities for incrementally adding string values and
12+
building the null bitmap for a pyarrow.Array (type='string').
13+
"""
14+
def __init__(self, memory_pool: MemoryPool | None = None) -> None: ...
15+
def append(self, value: str | bytes | None):
16+
"""
17+
Append a single value to the builder.
18+
19+
The value can either be a string/bytes object or a null value
20+
(np.nan or None).
21+
22+
Parameters
23+
----------
24+
value : string/bytes or np.nan/None
25+
The value to append to the string array builder.
26+
"""
27+
def append_values(self, values: Iterable[str | bytes | None]):
28+
"""
29+
Append all the values from an iterable.
30+
31+
Parameters
32+
----------
33+
values : iterable of string/bytes or np.nan/None values
34+
The values to append to the string array builder.
35+
"""
36+
def finish(self) -> StringArray:
37+
"""
38+
Return result of builder as an Array object; also resets the builder.
39+
40+
Returns
41+
-------
42+
array : pyarrow.Array
43+
"""
44+
@property
45+
def null_count(self) -> int: ...
46+
def __len__(self) -> int: ...
47+
48+
class StringViewBuilder(_Weakrefable):
49+
"""
50+
Builder class for UTF8 string views.
51+
52+
This class exposes facilities for incrementally adding string values and
53+
building the null bitmap for a pyarrow.Array (type='string_view').
54+
"""
55+
def __init__(self, memory_pool: MemoryPool | None = None) -> None: ...
56+
def append(self, value: str | bytes | None):
57+
"""
58+
Append a single value to the builder.
59+
60+
The value can either be a string/bytes object or a null value
61+
(np.nan or None).
62+
63+
Parameters
64+
----------
65+
value : string/bytes or np.nan/None
66+
The value to append to the string array builder.
67+
"""
68+
def append_values(self, values: Iterable[str | bytes | None]):
69+
"""
70+
Append all the values from an iterable.
71+
72+
Parameters
73+
----------
74+
values : iterable of string/bytes or np.nan/None values
75+
The values to append to the string array builder.
76+
"""
77+
def finish(self) -> StringViewArray:
78+
"""
79+
Return result of builder as an Array object; also resets the builder.
80+
81+
Returns
82+
-------
83+
array : pyarrow.Array
84+
"""
85+
@property
86+
def null_count(self) -> int: ...
87+
def __len__(self) -> int: ...
88+
89+
__all__ = ["StringBuilder", "StringViewBuilder"]

python/stubs/__lib_pxi/compat.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def encode_file_path(path: str | bytes) -> bytes: ...
2+
def tobytes(o: str | bytes) -> bytes: ...
3+
def frombytes(o: bytes, *, safe: bool = False): ...
4+
5+
__all__ = ["encode_file_path", "tobytes", "frombytes"]

python/stubs/__lib_pxi/config.pyi

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from typing import NamedTuple
2+
3+
class VersionInfo(NamedTuple):
4+
major: int
5+
minor: int
6+
patch: int
7+
8+
class BuildInfo(NamedTuple):
9+
version: str
10+
version_info: VersionInfo
11+
so_version: str
12+
full_so_version: str
13+
compiler_id: str
14+
compiler_version: str
15+
compiler_flags: str
16+
git_id: str
17+
git_description: str
18+
package_kind: str
19+
build_type: str
20+
21+
class RuntimeInfo(NamedTuple):
22+
simd_level: str
23+
detected_simd_level: str
24+
25+
cpp_build_info: BuildInfo
26+
cpp_version: str
27+
cpp_version_info: VersionInfo
28+
29+
def runtime_info() -> RuntimeInfo: ...
30+
def set_timezone_db_path(path: str) -> None: ...
31+
32+
__all__ = [
33+
"VersionInfo",
34+
"BuildInfo",
35+
"RuntimeInfo",
36+
"cpp_build_info",
37+
"cpp_version",
38+
"cpp_version_info",
39+
"runtime_info",
40+
"set_timezone_db_path",
41+
]

python/stubs/__lib_pxi/device.pyi

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import enum
2+
3+
from pyarrow.lib import _Weakrefable
4+
5+
class DeviceAllocationType(enum.Flag):
6+
CPU = enum.auto()
7+
CUDA = enum.auto()
8+
CUDA_HOST = enum.auto()
9+
OPENCL = enum.auto()
10+
VULKAN = enum.auto()
11+
METAL = enum.auto()
12+
VPI = enum.auto()
13+
ROCM = enum.auto()
14+
ROCM_HOST = enum.auto()
15+
EXT_DEV = enum.auto()
16+
CUDA_MANAGED = enum.auto()
17+
ONEAPI = enum.auto()
18+
WEBGPU = enum.auto()
19+
HEXAGON = enum.auto()
20+
21+
class Device(_Weakrefable):
22+
"""
23+
Abstract interface for hardware devices
24+
25+
This object represents a device with access to some memory spaces.
26+
When handling a Buffer or raw memory address, it allows deciding in which
27+
context the raw memory address should be interpreted
28+
(e.g. CPU-accessible memory, or embedded memory on some particular GPU).
29+
"""
30+
31+
@property
32+
def type_name(self) -> str:
33+
"""
34+
A shorthand for this device's type.
35+
"""
36+
@property
37+
def device_id(self) -> int:
38+
"""
39+
A device ID to identify this device if there are multiple of this type.
40+
41+
If there is no "device_id" equivalent (such as for the main CPU device on
42+
non-numa systems) returns -1.
43+
"""
44+
@property
45+
def is_cpu(self) -> bool:
46+
"""
47+
Whether this device is the main CPU device.
48+
49+
This shorthand method is very useful when deciding whether a memory address
50+
is CPU-accessible.
51+
"""
52+
@property
53+
def device_type(self) -> DeviceAllocationType:
54+
"""
55+
Return the DeviceAllocationType of this device.
56+
"""
57+
58+
class MemoryManager(_Weakrefable):
59+
"""
60+
An object that provides memory management primitives.
61+
62+
A MemoryManager is always tied to a particular Device instance.
63+
It can also have additional parameters (such as a MemoryPool to
64+
allocate CPU memory).
65+
66+
"""
67+
@property
68+
def device(self) -> Device:
69+
"""
70+
The device this MemoryManager is tied to.
71+
"""
72+
@property
73+
def is_cpu(self) -> bool:
74+
"""
75+
Whether this MemoryManager is tied to the main CPU device.
76+
77+
This shorthand method is very useful when deciding whether a memory
78+
address is CPU-accessible.
79+
"""
80+
81+
def default_cpu_memory_manager() -> MemoryManager:
82+
"""
83+
Return the default CPU MemoryManager instance.
84+
85+
The returned singleton instance uses the default MemoryPool.
86+
"""
87+
88+
__all__ = ["DeviceAllocationType", "Device", "MemoryManager", "default_cpu_memory_manager"]

python/stubs/__lib_pxi/error.pyi

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import sys
2+
3+
if sys.version_info >= (3, 11):
4+
from typing import Self
5+
else:
6+
from typing_extensions import Self
7+
8+
class ArrowException(Exception): ...
9+
class ArrowInvalid(ValueError, ArrowException): ...
10+
class ArrowMemoryError(MemoryError, ArrowException): ...
11+
class ArrowKeyError(KeyError, ArrowException): ...
12+
class ArrowTypeError(TypeError, ArrowException): ...
13+
class ArrowNotImplementedError(NotImplementedError, ArrowException): ...
14+
class ArrowCapacityError(ArrowException): ...
15+
class ArrowIndexError(IndexError, ArrowException): ...
16+
class ArrowSerializationError(ArrowException): ...
17+
18+
class ArrowCancelled(ArrowException):
19+
signum: int | None
20+
def __init__(self, message: str, signum: int | None = None) -> None: ...
21+
22+
ArrowIOError = IOError
23+
24+
class StopToken: ...
25+
26+
def enable_signal_handlers(enable: bool) -> None: ...
27+
28+
have_signal_refcycle: bool
29+
30+
class SignalStopHandler:
31+
def __enter__(self) -> Self: ...
32+
def __exit__(self, exc_type, exc_value, exc_tb) -> None: ...
33+
def __dealloc__(self) -> None: ...
34+
@property
35+
def stop_token(self) -> StopToken: ...
36+
37+
__all__ = [
38+
"ArrowException",
39+
"ArrowInvalid",
40+
"ArrowMemoryError",
41+
"ArrowKeyError",
42+
"ArrowTypeError",
43+
"ArrowNotImplementedError",
44+
"ArrowCapacityError",
45+
"ArrowIndexError",
46+
"ArrowSerializationError",
47+
"ArrowCancelled",
48+
"ArrowIOError",
49+
"StopToken",
50+
"enable_signal_handlers",
51+
"have_signal_refcycle",
52+
"SignalStopHandler",
53+
]

0 commit comments

Comments
 (0)