diff --git a/src/snakia/utils/__init__.py b/src/snakia/utils/__init__.py index 70ae023..ad6100d 100644 --- a/src/snakia/utils/__init__.py +++ b/src/snakia/utils/__init__.py @@ -1,7 +1,7 @@ from .attrs import get_attrs, get_or_set_attr -from .funcs import call, caller, side, side_func from .exceptions import catch, throw from .frames import frame +from .funcs import call, caller, ret, side, side_func from .gil import GIL_ENABLED, nolock from .inherit import inherit from .this import this @@ -16,6 +16,7 @@ __all__ = [ "frame", "inherit", "nolock", + "ret", "side", "side_func", "this", diff --git a/src/snakia/utils/funcs.py b/src/snakia/utils/funcs.py index 528cf1e..94cdad4 100644 --- a/src/snakia/utils/funcs.py +++ b/src/snakia/utils/funcs.py @@ -18,3 +18,7 @@ def side(value: T, *_: Any, **__: Any) -> T: def side_func(value: T, *_: Any, **__: Any) -> Callable[..., T]: return lambda *_, **__: value + + +def ret() -> Callable[[T], T]: + return lambda x: x