Skip to content

Commit

Permalink
Remove the deprecated kd.functor.as_fn alias.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 714074470
Change-Id: Ic90825e3d8e5529b039236c410f73de215519ca1
  • Loading branch information
odimka authored and copybara-github committed Jan 10, 2025
1 parent 15ef095 commit e8b8aa4
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 26 deletions.
1 change: 0 additions & 1 deletion py/koladata/functor/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
trace_py_fn=_functor_factories.trace_py_fn,
py_fn=_functor_factories.py_fn,
bind=_functor_factories.bind,
as_fn=_functor_factories.as_fn,
is_fn=_functor_factories.is_fn,
fstr_fn=_functor_factories.fstr_fn,
map_py_fn=_functor_factories.map_py_fn,
Expand Down
13 changes: 0 additions & 13 deletions py/koladata/functor/functor_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import types as py_types
import typing
from typing import Any, Callable
import warnings

from arolla import arolla
from koladata.expr import input_container
Expand Down Expand Up @@ -430,18 +429,6 @@ def fn(
raise TypeError(f'cannot convert {f} into a functor')


# TODO: Remove this after some time.
def as_fn(
f: Any, *, use_tracing: bool = True, **kwargs: Any
) -> data_slice.DataSlice:
"""A deprecated alias for kd.fn."""
warnings.warn(
'as_fn is deprecated. Use fn instead.',
RuntimeWarning,
)
return fn(f, use_tracing=use_tracing, **kwargs)


def map_py_fn(
f: Callable[..., Any] | arolla.types.PyObject,
*,
Expand Down
12 changes: 0 additions & 12 deletions py/koladata/functor/functor_factories_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# limitations under the License.

import re
from unittest import mock
import warnings

from absl.testing import absltest
from arolla import arolla
Expand Down Expand Up @@ -713,16 +711,6 @@ def test_fn_unknown_type(self):
):
functor_factories.fn(57)

def test_as_fn(self):
with mock.patch.object(warnings, 'warn') as mock_warn:
fn = functor_factories.as_fn(lambda x, y: x + y)
mock_warn.assert_called_once()
testing.assert_equal(fn(1, 2), ds(3))
with mock.patch.object(warnings, 'warn') as mock_warn:
fn = functor_factories.as_fn(I.x + I.y)
mock_warn.assert_called_once()
testing.assert_equal(fn(x=1, y=2), ds(3))

def test_map_py_fn_by_reference(self):
def f(x, y):
return x + y if x < 2 else x
Expand Down

0 comments on commit e8b8aa4

Please sign in to comment.