-
Notifications
You must be signed in to change notification settings - Fork 200
Expand file tree
/
Copy pathexpr.pyi
More file actions
122 lines (107 loc) · 4.63 KB
/
Copy pathexpr.pyi
File metadata and controls
122 lines (107 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright the Vortex contributors
from collections.abc import Iterable, Mapping, Sequence
from datetime import date, datetime
from typing import Literal, TypeAlias, final
from typing_extensions import override
from .dtype import DType
from .scalar import ScalarPyType
IntoExpr: TypeAlias = Expr | bool | int | float | str | bytes | date | datetime | None
"""A value accepted anywhere an expression is expected. Non-``Expr`` values become literals."""
VariantPath: TypeAlias = str | int | Sequence[str | int]
@final
class Expr:
@override
def __eq__(self, other: IntoExpr) -> Expr: ... # pyright: ignore[reportIncompatibleMethodOverride]
@override
def __ne__(self, other: IntoExpr) -> Expr: ... # pyright: ignore[reportIncompatibleMethodOverride]
def __lt__(self, other: IntoExpr) -> Expr: ...
def __le__(self, other: IntoExpr) -> Expr: ...
def __gt__(self, other: IntoExpr) -> Expr: ...
def __ge__(self, other: IntoExpr) -> Expr: ...
def __and__(self, other: IntoExpr) -> Expr: ...
def __rand__(self, other: IntoExpr) -> Expr: ...
def __or__(self, other: IntoExpr) -> Expr: ...
def __ror__(self, other: IntoExpr) -> Expr: ...
def __invert__(self) -> Expr: ...
def __add__(self, other: IntoExpr) -> Expr: ...
def __radd__(self, other: IntoExpr) -> Expr: ...
def __sub__(self, other: IntoExpr) -> Expr: ...
def __rsub__(self, other: IntoExpr) -> Expr: ...
def __mul__(self, other: IntoExpr) -> Expr: ...
def __rmul__(self, other: IntoExpr) -> Expr: ...
def __truediv__(self, other: IntoExpr) -> Expr: ...
def __rtruediv__(self, other: IntoExpr) -> Expr: ...
def __getitem__(self, field: str) -> Expr: ...
def serialize(self) -> bytes: ...
@override
def __reduce__(self) -> tuple[object, tuple[bytes]]: ...
# Leaves and scope
def root() -> Expr: ...
def column(name: str) -> Expr: ...
def literal(dtype: DType, value: ScalarPyType) -> Expr: ...
def get_item(field: str, child: IntoExpr | None = None) -> Expr: ...
# Boolean logic
def not_(child: IntoExpr) -> Expr: ...
def and_(left: IntoExpr, right: IntoExpr) -> Expr: ...
def or_(left: IntoExpr, right: IntoExpr) -> Expr: ...
def and_collect(exprs: Iterable[IntoExpr]) -> Expr | None: ...
def or_collect(exprs: Iterable[IntoExpr]) -> Expr | None: ...
# Comparisons and arithmetic
def eq(left: IntoExpr, right: IntoExpr) -> Expr: ...
def not_eq(left: IntoExpr, right: IntoExpr) -> Expr: ...
def gt(left: IntoExpr, right: IntoExpr) -> Expr: ...
def gt_eq(left: IntoExpr, right: IntoExpr) -> Expr: ...
def lt(left: IntoExpr, right: IntoExpr) -> Expr: ...
def lt_eq(left: IntoExpr, right: IntoExpr) -> Expr: ...
def add(left: IntoExpr, right: IntoExpr) -> Expr: ...
def sub(left: IntoExpr, right: IntoExpr) -> Expr: ...
def mul(left: IntoExpr, right: IntoExpr) -> Expr: ...
def div(left: IntoExpr, right: IntoExpr) -> Expr: ...
def between(
child: IntoExpr,
lower: IntoExpr,
upper: IntoExpr,
*,
lower_strict: bool = False,
upper_strict: bool = False,
) -> Expr: ...
# Nullability
def is_null(child: IntoExpr) -> Expr: ...
def is_not_null(child: IntoExpr) -> Expr: ...
def fill_null(child: IntoExpr, fill_value: IntoExpr) -> Expr: ...
# Strings
def like(child: IntoExpr, pattern: IntoExpr) -> Expr: ...
def ilike(child: IntoExpr, pattern: IntoExpr) -> Expr: ...
def not_like(child: IntoExpr, pattern: IntoExpr) -> Expr: ...
def not_ilike(child: IntoExpr, pattern: IntoExpr) -> Expr: ...
def byte_length(child: IntoExpr) -> Expr: ...
# Structs
def select(fields: str | Iterable[str], child: IntoExpr | None = None) -> Expr: ...
def select_exclude(fields: str | Iterable[str], child: IntoExpr | None = None) -> Expr: ...
def pack(
fields: Mapping[str, IntoExpr] | Iterable[tuple[str, IntoExpr]],
*,
nullable: bool = False,
) -> Expr: ...
def merge(
exprs: Iterable[IntoExpr],
*,
duplicate_handling: Literal["error", "rightmost"] = "error",
) -> Expr: ...
# Lists
def list_contains(child: IntoExpr, value: IntoExpr) -> Expr: ...
def list_length(child: IntoExpr) -> Expr: ...
def list_sum(child: IntoExpr, *, skip_nans: bool = True) -> Expr: ...
# Conditionals and misc
def case_when(
when_then: Iterable[tuple[IntoExpr, IntoExpr]],
else_value: IntoExpr | None = None,
) -> Expr: ...
def zip_(mask: IntoExpr, if_true: IntoExpr, if_false: IntoExpr) -> Expr: ...
def mask(child: IntoExpr, mask: IntoExpr) -> Expr: ...
def cast(child: IntoExpr, dtype: DType) -> Expr: ...
def ext_storage(child: IntoExpr) -> Expr: ...
def variant_get(child: IntoExpr, path: VariantPath, dtype: DType | None = None) -> Expr: ...
# Serialization
def deserialize(data: bytes) -> Expr: ...