From 2cc15bf2508c95f49a4c92b125acc7ac093419d9 Mon Sep 17 00:00:00 2001 From: rus07tam Date: Wed, 26 Nov 2025 13:48:31 +0000 Subject: [PATCH] feat: add ret() --- src/snakia/utils/__init__.py | 3 ++- src/snakia/utils/funcs.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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