Skip to content

Commit c3c1121

Browse files
committed
add doc argument in special operators
1 parent e1d57e3 commit c3c1121

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

src/pydiverse/transform/_internal/ops/ops/datetime.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66

77

88
class DatetimeExtract(Operator):
9-
def __init__(self, name: str):
10-
super().__init__(name, Signature(Datetime(), return_type=Int()))
9+
def __init__(self, name: str, doc: str = ""):
10+
super().__init__(name, Signature(Datetime(), return_type=Int()), doc=doc)
1111

1212

1313
class DateExtract(Operator):
14-
def __init__(self, name: str):
14+
def __init__(self, name: str, doc: str = ""):
1515
super().__init__(
1616
name,
1717
Signature(Date(), return_type=Int()),
1818
Signature(Datetime(), return_type=Int()),
19+
doc=doc,
1920
)
2021

2122

@@ -41,8 +42,8 @@ def __init__(self, name: str):
4142

4243

4344
class DurationToUnit(Operator):
44-
def __init__(self, name: str):
45-
super().__init__(name, Signature(Duration(), return_type=Int()))
45+
def __init__(self, name: str, doc: str = ""):
46+
super().__init__(name, Signature(Duration(), return_type=Int()), doc=doc)
4647

4748

4849
dur_days = DurationToUnit("dur.days")

src/pydiverse/transform/_internal/ops/ops/horizontal.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66

77

88
class Horizontal(Operator):
9-
def __init__(self, name: str, *signatures: Signature):
9+
def __init__(self, name: str, *signatures: Signature, doc: str = ""):
1010
super().__init__(
11-
name, *signatures, param_names=["arg", "args"], generate_expr_method=False
11+
name,
12+
*signatures,
13+
param_names=["arg", "args"],
14+
generate_expr_method=False,
15+
doc=doc,
1216
)
1317

1418

src/pydiverse/transform/_internal/ops/ops/markers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77

88
class Marker(Operator):
9-
def __init__(self, name: str):
10-
super().__init__(name, Signature(D, return_type=D))
9+
def __init__(self, name: str, doc: str = ""):
10+
super().__init__(name, Signature(D, return_type=D), doc=doc)
1111

1212

1313
nulls_first = Marker("nulls_first")

src/pydiverse/transform/_internal/ops/ops/string.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77

88
class StrUnary(Operator):
9-
def __init__(self, name: str):
10-
super().__init__(name, Signature(String(), return_type=String()))
9+
def __init__(self, name: str, doc: str = ""):
10+
super().__init__(name, Signature(String(), return_type=String()), doc=doc)
1111

1212

1313
str_strip = StrUnary("str.strip")

src/pydiverse/transform/_internal/ops/ops/window.py

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def __init__(
1515
param_names: list[str] | None = None,
1616
default_values: list[Any] | None = None,
1717
generate_expr_method=False,
18+
doc: str = "",
1819
):
1920
super().__init__(
2021
name,
@@ -24,6 +25,7 @@ def __init__(
2425
param_names=param_names,
2526
default_values=default_values,
2627
generate_expr_method=generate_expr_method,
28+
doc=doc,
2729
)
2830

2931

0 commit comments

Comments
 (0)