Skip to content

Commit 2d1ee48

Browse files
apronchenkovcopybara-github
authored andcommitted
Deprecate the kd.map_py_on_present operator
PiperOrigin-RevId: 715043659 Change-Id: I145924c618c5d545df93f56b7c8f53bd3ce19530
1 parent ad75603 commit 2d1ee48

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

py/koladata/operators/py.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import functools
1919
import itertools
2020
from typing import Any, Callable, Iterable
21+
import warnings
2122

2223
from arolla import arolla
2324
from koladata.expr import py_expr_eval_py_ext
@@ -822,6 +823,11 @@ def map_py_on_present(
822823
Returns:
823824
Result DataSlice.
824825
"""
826+
warnings.warn(
827+
'`kd.map_py_on_present` is deprecated and will be removed, please use'
828+
' `kd.map_py` instead',
829+
DeprecationWarning,
830+
)
825831
if not args and not kwargs:
826832
raise TypeError('expected at least one input DataSlice, got none')
827833
cond = functools.reduce(

py/koladata/operators/tests/py_map_py_on_present_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@
2828
kde = kde_operators.kde
2929

3030

31-
class PyMapPyOnSelectedTest(parameterized.TestCase):
31+
class PyMapPyOnPresentTest(parameterized.TestCase):
3232

3333
# Note: This operator is assembled from the same building blocks as
3434
# the operator `kde.py.map_py`, and these are tested together with that
3535
# operator.
3636

37+
def test_deprecated(self):
38+
with self.assertWarns(DeprecationWarning):
39+
_ = expr_eval.eval(kde.py.map_py_on_present(lambda x: x, ds([])))
40+
3741
def test_args_kwargs(self):
3842
x = ds([1, 2, None])
3943
y = ds([3, None, 4])

0 commit comments

Comments
 (0)