Skip to content

Commit 127e741

Browse files
committed
adding some ignores to pass more checks
1 parent d8d5269 commit 127e741

Some content is hidden

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

48 files changed

+167
-98
lines changed

.github/workflows/python.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,11 @@ jobs:
140140

141141
- name: Type check with mypy and pyright
142142
run: |-
143-
python -m pip install mypy pyright griffe libcst scipy-stubs pandas-stubs types-python-dateutil types-psutil types-requests griffe libcst types-cffi
143+
python -m pip install mypy pyright griffe libcst pytest hypothesis fsspec scipy-stubs pandas-stubs types-python-dateutil types-psutil types-requests griffe libcst types-cffi
144144
pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple pyarrow
145145
cd python
146-
mypy ./pyarrow-stubs ./pyarrow/tests/test_array.py ./pyarrow/tests/test_io.py
146+
# mypy pyarrow-stubs/ pyarrow/tests/interchange pyarrow/tests/parquet pyarrow/tests/test_array.py pyarrow/tests/test_io.py
147+
mypy --ignore-missing-imports pyarrow-stubs/ pyarrow/tests
147148
pyright ./pyarrow-stubs
148149
cd ..
149150
python ./dev/update_stub_docstrings.py -f ./python/pyarrow-stubs

python/pyarrow-stubs/_compute.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class DictionaryEncodeOptions(FunctionOptions):
176176

177177
class RunEndEncodeOptions(FunctionOptions):
178178
# TODO: default is DataType(int32)
179-
def __init__(self, run_end_type: lib.DataType = ...) -> None: ...
179+
def __init__(self, run_end_type: lib.DataType | str = ...) -> None: ...
180180

181181

182182
class ElementWiseAggregateOptions(FunctionOptions):
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
function_doc_additions: dict[str, str]

python/pyarrow-stubs/_types.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,8 @@ def type_for_alias(name: Any) -> DataType: ...
864864

865865
def schema(
866866
fields: Iterable[Field[Any]]
867-
| Iterable[tuple[str, DataType]]
868-
| Mapping[str, DataType],
867+
| Iterable[tuple[str, DataType | str]]
868+
| Mapping[str, DataType | str],
869869
metadata: dict[bytes | str, bytes | str] | None = None,
870870
) -> Schema: ...
871871

python/pyarrow-stubs/acero.pyi

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ from typing import Literal
2929

3030
from . import lib
3131
from .compute import Expression, FunctionOptions
32+
from .dataset import InMemoryDataset, Dataset
3233

3334
_StrOrExpr: TypeAlias = str | Expression
3435

@@ -111,3 +112,23 @@ class AsofJoinNodeOptions(ExecNodeOptions):
111112
right_by: _StrOrExpr | list[_StrOrExpr],
112113
tolerance: int,
113114
) -> None: ...
115+
116+
117+
def _perform_join(
118+
join_type: str,
119+
left_operand: lib.Table | Dataset,
120+
left_keys: str | list[str],
121+
right_operand: lib.Table | Dataset,
122+
right_keys: str | list[str],
123+
left_suffix: str,
124+
right_suffix: str,
125+
use_threads: bool,
126+
coalesce_keys: bool,
127+
output_type: type[lib.Table | InMemoryDataset] = lib.Table,
128+
filter_expression: Expression | None = None,
129+
) -> lib.Table | InMemoryDataset: ...
130+
131+
132+
def _filter_table(
133+
table: lib.Table | lib.RecordBatch, filter_expression: Expression,
134+
use_threads: bool = True) -> lib.Table | lib.RecordBatch: ...

python/pyarrow-stubs/compute.pyi

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ from pyarrow._compute import RoundBinaryOptions as RoundBinaryOptions
5252
from pyarrow._compute import RoundOptions as RoundOptions
5353
from pyarrow._compute import RoundTemporalOptions as RoundTemporalOptions
5454
from pyarrow._compute import RoundToMultipleOptions as RoundToMultipleOptions
55+
from pyarrow._compute import RunEndEncodeOptions as RunEndEncodeOptions
5556
from pyarrow._compute import ScalarAggregateOptions as ScalarAggregateOptions
5657
from pyarrow._compute import SelectKOptions as SelectKOptions
5758
from pyarrow._compute import SetLookupOptions as SetLookupOptions
@@ -73,6 +74,7 @@ from pyarrow._compute import WeekOptions as WeekOptions
7374

7475
from pyarrow._compute import _Order, _Placement
7576
from pyarrow._stubs_typing import ArrayLike, ScalarLike
77+
from pyarrow._types import _RunEndType
7678
from . import lib
7779

7880
_P = ParamSpec("_P")
@@ -645,8 +647,8 @@ def atan2(
645647

646648
# ========================= 2.5 Comparisons functions =========================
647649
def equal(
648-
x: lib.Scalar | lib.Array | lib.ChunkedArray | Expression,
649-
y: lib.Scalar | lib.Array | lib.ChunkedArray | Expression,
650+
x: lib.Scalar | lib.Array | lib.ChunkedArray | Expression | Any,
651+
y: lib.Scalar | lib.Array | lib.ChunkedArray | Expression | Any,
650652
/, *, memory_pool: lib.MemoryPool | None = None
651653
) -> lib.BooleanScalar | lib.BooleanArray | Expression: ...
652654

@@ -1634,4 +1636,11 @@ def pairwise_diff(
16341636
) -> _NumericOrTemporalArrayT | Expression: ...
16351637

16361638

1639+
def run_end_encode(
1640+
input: _NumericOrTemporalArrayT | Expression, /, *, run_end_type: _RunEndType,
1641+
value_type: _DataTypeT, options: RunEndEncodeOptions | None = None,
1642+
memory_pool: lib.MemoryPool | None = None
1643+
) -> _NumericOrTemporalArrayT | Expression: ...
1644+
1645+
16371646
pairwise_diff_checked = _clone_signature(pairwise_diff)

python/pyarrow-stubs/interchange/from_dataframe.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ ColumnObject: TypeAlias = Any
3838
def from_dataframe(df: DataFrameObject, allow_copy=True) -> Table: ...
3939

4040

41+
def _from_dataframe(df: DataFrameObject, allow_copy=True) -> Table: ...
42+
43+
4144
def protocol_df_chunk_to_pyarrow(
4245
df: DataFrameObject, allow_copy: bool = True) -> RecordBatch: ...
4346

python/pyarrow-stubs/pandas_compat.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import pandas as pd
2222

2323
from pandas import DatetimeTZDtype
2424

25-
from .lib import Array, DataType, Schema, Table
25+
from .lib import Array, DataType, Schema, Table, _pandas_api
2626

2727
_T = TypeVar("_T")
2828

@@ -85,3 +85,8 @@ def table_to_dataframe(
8585

8686

8787
def make_tz_aware(series: pd.Series, tz: str) -> pd.Series: ...
88+
89+
90+
__all__ = [
91+
"_pandas_api",
92+
]

python/pyarrow-stubs/scalar.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ class FixedShapeTensorScalar(ExtensionScalar):
399399

400400
def scalar(
401401
value: Any,
402-
type: _DataTypeT,
402+
type: _DataTypeT | None = None,
403403
*,
404404
from_pandas: bool | None = None,
405405
memory_pool: MemoryPool | None = None,

python/pyarrow-stubs/table.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class ChunkedArray(_PandasConvertible[pd.Series], Generic[_Scalar_co]):
249249
def chunked_array(
250250
arrays: Iterable[NullableCollection[Any]]
251251
| Iterable[Iterable[Any] | SupportArrowStream | SupportArrowArray]
252-
| Iterable[Array[_ScalarT]],
252+
| Iterable[Array[_ScalarT]] | Array[_ScalarT],
253253
type: DataType | str | None = None,
254254
) -> ChunkedArray[Scalar[Any]] | ChunkedArray[_ScalarT]: ...
255255

@@ -586,8 +586,8 @@ class Table(_Tabular[ChunkedArray[Any]]):
586586

587587

588588
def record_batch(
589-
data: dict[str, list[Any] | Array[Any]]
590-
| Collection[Array[Any]]
589+
data: Mapping[str, list[Any] | Array[Any]]
590+
| Collection[Array[Any] | ChunkedArray[Any]]
591591
| pd.DataFrame
592592
| SupportArrowArray
593593
| SupportArrowDeviceArray,
@@ -598,7 +598,7 @@ def record_batch(
598598

599599

600600
def table(
601-
data: dict[str, list[Any] | Array[Any]]
601+
data: Mapping[str, list[Any] | Array[Any]]
602602
| Collection[ArrayOrChunkedArray[Any]]
603603
| pd.DataFrame
604604
| SupportArrowArray

0 commit comments

Comments
 (0)