From c879b22f43ef1a4ba3a5e2116e52529a6b4e7901 Mon Sep 17 00:00:00 2001 From: rus07tam Date: Sun, 23 Nov 2025 10:14:46 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20add=20side=20and=20side=5Ffunc=20?= =?UTF-8?q?=E2=80=93=20clean=20alternative=20to=20"or=20print()"=20in=20la?= =?UTF-8?q?mbdas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/snakia/utils/__init__.py | 3 +++ src/snakia/utils/side.py | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 src/snakia/utils/side.py diff --git a/src/snakia/utils/__init__.py b/src/snakia/utils/__init__.py index 6b52dbc..7fee463 100644 --- a/src/snakia/utils/__init__.py +++ b/src/snakia/utils/__init__.py @@ -2,6 +2,7 @@ from .attr import get_attrs, get_or_set_attr from .frame import frame from .inherit import inherit from .nolock import nolock +from .side import side, side_func from .this import this from .throw import throw from .to_async import to_async @@ -12,6 +13,8 @@ __all__ = [ "frame", "inherit", "nolock", + "side", + "side_func", "this", "throw", "to_async", diff --git a/src/snakia/utils/side.py b/src/snakia/utils/side.py new file mode 100644 index 0000000..985e919 --- /dev/null +++ b/src/snakia/utils/side.py @@ -0,0 +1,11 @@ +from typing import Any, Callable, TypeVar + +T = TypeVar("T") + + +def side(value: T, *_: Any, **__: Any) -> T: + return value + + +def side_func(value: T, *_: Any, **__: Any) -> Callable[..., T]: + return lambda *_, **__: value