Skip to content

Commit

Permalink
fix timestamp scalar
Browse files Browse the repository at this point in the history
  • Loading branch information
zen-xu committed Sep 4, 2024
1 parent aa0ef11 commit 91451cc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
13 changes: 12 additions & 1 deletion pyarrow-stubs/__lib_pxi/scalar.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mypy: disable-error-code="overload-overlap,misc"
# mypy: disable-error-code="overload-overlap,misc,type-arg"
import collections.abc
import datetime as dt

Expand Down Expand Up @@ -281,6 +281,10 @@ def scalar(
value: Decimal, *, from_pandas: bool | None = None, memory_pool: MemoryPool | None = None
) -> Decimal128Scalar: ...
@overload
def scalar(
value: dt.datetime, *, from_pandas: bool | None = None, memory_pool: MemoryPool | None = None
) -> TimestampScalar: ...
@overload
def scalar(
value: dt.date, *, from_pandas: bool | None = None, memory_pool: MemoryPool | None = None
) -> Date32Scalar: ...
Expand Down Expand Up @@ -349,6 +353,13 @@ def scalar(
memory_pool: MemoryPool | None = None,
) -> ListScalar[types.ListType[types.Decimal128Type]]: ...
@overload
def scalar(
value: CollectionValue[dt.datetime],
*,
from_pandas: bool | None = None,
memory_pool: MemoryPool | None = None,
) -> ListScalar[types.ListType[types.TimestampType]]: ...
@overload
def scalar(
value: CollectionValue[dt.date],
*,
Expand Down
7 changes: 6 additions & 1 deletion pyarrow-stubs/__lib_pxi/table.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mypy: disable-error-code="overload-overlap"
# mypy: disable-error-code="overload-overlap,type-arg,misc"

import datetime as dt

Expand Down Expand Up @@ -162,6 +162,11 @@ def chunked_array(
type: None = None,
) -> ChunkedArray[scalar.StructScalar]: ...
@overload
def chunked_array(
values: NullableIterable[dt.datetime],
type: None = None,
) -> ChunkedArray[scalar.TimestampScalar]: ...
@overload
def chunked_array(
values: NullableIterable[dt.date],
type: None = None,
Expand Down
2 changes: 2 additions & 0 deletions pyarrow-stubs/compute.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ import typing_extensions
_P = ParamSpec("_P")
_R = TypeVar("_R")

def field(*name_or_index: str | tuple[str, ...] | int) -> Expression: ...
def scalar(value: bool | float | str) -> Expression: ...
def _clone_signature(f: Callable[_P, _R]) -> Callable[_P, _R]: ...

# ============= compute functions =============
Expand Down

0 comments on commit 91451cc

Please sign in to comment.