Skip to content

Commit e0460b5

Browse files
committed
refactor(api)!: standardize NumericValue methods
1 parent 64825db commit e0460b5

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

ibis/expr/types/numeric.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __neg__(self) -> NumericValue:
5454
"""
5555
return self.negate()
5656

57-
def round(self, digits: int | IntegerValue = 0) -> NumericValue:
57+
def round(self, digits: int | IntegerValue = 0, /) -> NumericValue:
5858
"""Round values to an indicated number of decimal places.
5959
6060
Parameters
@@ -102,7 +102,7 @@ def round(self, digits: int | IntegerValue = 0) -> NumericValue:
102102
│ 2 │
103103
│ 3 │
104104
└──────────────────┘
105-
>>> t.values.round(digits=1)
105+
>>> t.values.round(1)
106106
┏━━━━━━━━━━━━━━━━━━┓
107107
┃ Round(values, 1) ┃
108108
┡━━━━━━━━━━━━━━━━━━┩
@@ -116,7 +116,7 @@ def round(self, digits: int | IntegerValue = 0) -> NumericValue:
116116
"""
117117
return ops.Round(self, digits).to_expr()
118118

119-
def log(self, base: NumericValue | None = None) -> NumericValue:
119+
def log(self, base: NumericValue | None = None, /) -> NumericValue:
120120
r"""Compute $\log_{\texttt{base}}\left(\texttt{self}\right)$.
121121
122122
Parameters
@@ -150,7 +150,7 @@ def log(self, base: NumericValue | None = None) -> NumericValue:
150150
>>> import ibis
151151
>>> ibis.options.interactive = True
152152
>>> t = ibis.memtable({"values": [10, 100, 1000]})
153-
>>> t.values.log(base=10)
153+
>>> t.values.log(10)
154154
┏━━━━━━━━━━━━━━━━━┓
155155
┃ Log(values, 10) ┃
156156
┡━━━━━━━━━━━━━━━━━┩
@@ -532,7 +532,7 @@ def atan(self) -> NumericValue:
532532
"""
533533
return ops.Atan(self).to_expr()
534534

535-
def atan2(self, other: NumericValue) -> NumericValue:
535+
def atan2(self, other: NumericValue, /) -> NumericValue:
536536
"""Compute the two-argument version of arc tangent.
537537
538538
Examples
@@ -716,7 +716,7 @@ def __rmod__(self, other: NumericValue) -> NumericValue:
716716

717717
rmod = __rmod__
718718

719-
def point(self, right: int | float | NumericValue) -> ir.PointValue:
719+
def point(self, right: int | float | NumericValue, /) -> ir.PointValue:
720720
"""Return a point constructed from the coordinate values.
721721
722722
Constant coordinates result in construction of a `POINT` literal or
@@ -1197,6 +1197,8 @@ def cumsum(self, *, where=None, group_by=None, order_by=None) -> NumericColumn:
11971197
def bucket(
11981198
self,
11991199
buckets: Sequence[int],
1200+
/,
1201+
*,
12001202
closed: Literal["left", "right"] = "left",
12011203
close_extreme: bool = True,
12021204
include_under: bool = False,
@@ -1268,6 +1270,7 @@ def bucket(
12681270

12691271
def histogram(
12701272
self,
1273+
*,
12711274
nbins: int | None = None,
12721275
binwidth: float | None = None,
12731276
base: float | None = None,
@@ -1510,14 +1513,14 @@ def as_interval(
15101513
"""
15111514
return ops.IntervalFromInteger(self, unit).to_expr()
15121515

1513-
@deprecated(as_of="10.0", instead="use as_timestamp() instead")
1516+
@deprecated(as_of="10.0", removed_in="11.0", instead="use as_timestamp() instead")
15141517
def to_timestamp(
15151518
self,
15161519
unit: Literal["s", "ms", "us"] = "s",
15171520
) -> ir.TimestampValue:
15181521
return self.as_timestamp(unit=unit)
15191522

1520-
@deprecated(as_of="10.0", instead="use as_interval() instead")
1523+
@deprecated(as_of="10.0", removed_in="11.0", instead="use as_interval() instead")
15211524
def to_interval(
15221525
self,
15231526
unit: Literal["Y", "M", "W", "D", "h", "m", "s", "ms", "us", "ns"] = "s",

0 commit comments

Comments
 (0)