You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Python][Annotations] Consider narrowing return types in pyarrow-stubs with generic private base classes #55767
#55264 (issue #55263, under umbrella issue #32609) intentionally avoids generics to keep the first stage simpler. As a result, some methods inherited from private base classes return unions on every subclass:
_PandasConvertible.to_pandas() in python/pyarrow-stubs/__lib/array.pyi returns pd.Series | pd.DataFrame for arrays and tables (post-GH-55263: [Python][Annotations] Add internal types and core data structures #55264)
Consider making _PandasConvertible generic over its return type to narrow it without duplicated signatures or per-class overloads.
_Tabular column access in python/pyarrow-stubs/__lib/table.pyi
(__getitem__, column, columns, itercolumns) returns Array | ChunkedArray variants on both RecordBatch and Table.
Consider a _Tabular[_ColumnT] with _ColumnT = TypeVar("_ColumnT", Array, ChunkedArray) to narrow these.
Review the rest of python/pyarrow-stubs/ for similar private base classes where an internal Generic[...] would narrow inherited return types.
Note: public classes preferably remain non-generic.
Also consider adding assert_type tests in python/pyarrow-stubs-tests/
Activity