Skip to content

Commit e1d57e3

Browse files
committed
fix mistakes making tests fail
1 parent 5cd1077 commit e1d57e3

File tree

2 files changed

+10
-28
lines changed

2 files changed

+10
-28
lines changed

src/pydiverse/transform/_internal/backend/polars.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -583,24 +583,24 @@ def _dt_day_of_week(x):
583583
def _dt_day_of_year(x):
584584
return x.dt.ordinal_day().cast(pl.Int64)
585585

586-
@impl(ops.dt_days)
587-
def _dt_days(x):
586+
@impl(ops.dur_days)
587+
def _dur_days(x):
588588
return x.dt.total_days()
589589

590-
@impl(ops.dt_hours)
591-
def _dt_hours(x):
590+
@impl(ops.dur_hours)
591+
def _dur_hours(x):
592592
return x.dt.total_hours()
593593

594-
@impl(ops.dt_minutes)
595-
def _dt_minutes(x):
594+
@impl(ops.dur_minutes)
595+
def _dur_minutes(x):
596596
return x.dt.total_minutes()
597597

598-
@impl(ops.dt_seconds)
599-
def _dt_seconds(x):
598+
@impl(ops.dur_seconds)
599+
def _dur_seconds(x):
600600
return x.dt.total_seconds()
601601

602-
@impl(ops.dt_milliseconds)
603-
def _dt_milliseconds(x):
602+
@impl(ops.dur_milliseconds)
603+
def _dur_milliseconds(x):
604604
return x.dt.total_milliseconds()
605605

606606
@impl(ops.row_number)

src/pydiverse/transform/_internal/tree/col_expr.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ def func(accessor):
6464

6565

6666
class ColExpr(Generic[T]):
67-
__slots__ = ["_dtype", "_ftype"]
68-
6967
__contains__ = None
7068
__iter__ = None
7169

@@ -79,10 +77,6 @@ def __bool__(self):
7977
"converted to a boolean or used with the and, or, not keywords"
8078
)
8179

82-
def __setstate__(self, d): # to avoid very annoying AttributeErrors
83-
for slot, val in d[1].items():
84-
setattr(self, slot, val)
85-
8680
def _repr_html_(self) -> str:
8781
return f"<pre>{html.escape(repr(self))}</pre>"
8882

@@ -1064,8 +1058,6 @@ def seconds(self: ColExpr[Duration]) -> ColExpr[Int]:
10641058

10651059

10661060
class Col(ColExpr):
1067-
__slots__ = ["name", "_ast", "_uuid"]
1068-
10691061
def __init__(
10701062
self, name: str, _ast: AstNode, _uuid: UUID, _dtype: Dtype, _ftype: Ftype
10711063
):
@@ -1097,8 +1089,6 @@ def __hash__(self) -> int:
10971089

10981090

10991091
class ColName(ColExpr):
1100-
__slots__ = ["name"]
1101-
11021092
def __init__(
11031093
self, name: str, dtype: Dtype | None = None, ftype: Ftype | None = None
11041094
):
@@ -1111,8 +1101,6 @@ def __repr__(self) -> str:
11111101

11121102

11131103
class LiteralCol(ColExpr):
1114-
__slots__ = ["val"]
1115-
11161104
def __init__(self, val: Any, dtype: types.Dtype | None = None):
11171105
self.val = val
11181106
if dtype is None:
@@ -1125,8 +1113,6 @@ def __repr__(self):
11251113

11261114

11271115
class ColFn(ColExpr):
1128-
__slots__ = ("op", "args", "context_kwargs")
1129-
11301116
def __init__(self, op: Operator, *args: ColExpr, **kwargs: list[ColExpr | Order]):
11311117
self.op = op
11321118
# While building the expression tree, we have to allow markers.
@@ -1265,8 +1251,6 @@ def __repr__(self) -> str:
12651251

12661252

12671253
class CaseExpr(ColExpr):
1268-
__slots__ = ["cases", "default_val"]
1269-
12701254
def __init__(
12711255
self,
12721256
cases: Iterable[tuple[ColExpr, ColExpr]],
@@ -1409,8 +1393,6 @@ def otherwise(self, value: ColExpr) -> CaseExpr:
14091393

14101394

14111395
class Cast(ColExpr):
1412-
__slots__ = ["val", "target_type"]
1413-
14141396
def __init__(self, val: ColExpr, target_type: Dtype):
14151397
if target_type.const:
14161398
raise TypeError("cannot cast to `const` type")

0 commit comments

Comments
 (0)