From 3d132251fce8ff938be568cc8e01170a05000d4e Mon Sep 17 00:00:00 2001 From: rus07tam Date: Wed, 26 Nov 2025 13:46:49 +0000 Subject: [PATCH] refactor: merge side.py and calls.py to funcs.py --- src/snakia/utils/__init__.py | 3 +-- src/snakia/utils/{calls.py => funcs.py} | 10 +++++++++- src/snakia/utils/side.py | 11 ----------- 3 files changed, 10 insertions(+), 14 deletions(-) rename src/snakia/utils/{calls.py => funcs.py} (55%) delete mode 100644 src/snakia/utils/side.py diff --git a/src/snakia/utils/__init__.py b/src/snakia/utils/__init__.py index 353803d..70ae023 100644 --- a/src/snakia/utils/__init__.py +++ b/src/snakia/utils/__init__.py @@ -1,10 +1,9 @@ from .attrs import get_attrs, get_or_set_attr -from .calls import call, caller +from .funcs import call, caller, side, side_func from .exceptions import catch, throw from .frames import frame from .gil import GIL_ENABLED, nolock from .inherit import inherit -from .side import side, side_func from .this import this from .to_async import to_async diff --git a/src/snakia/utils/calls.py b/src/snakia/utils/funcs.py similarity index 55% rename from src/snakia/utils/calls.py rename to src/snakia/utils/funcs.py index eeabd5f..528cf1e 100644 --- a/src/snakia/utils/calls.py +++ b/src/snakia/utils/funcs.py @@ -1,4 +1,4 @@ -from typing import Callable, ParamSpec, TypeVar +from typing import Any, Callable, ParamSpec, TypeVar P = ParamSpec("P") T = TypeVar("T") @@ -10,3 +10,11 @@ def call(f: Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> T: def caller(f: Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> Callable[..., T]: return lambda *_, **__: f(*args, **kwargs) + + +def side(value: T, *_: Any, **__: Any) -> T: + return value + + +def side_func(value: T, *_: Any, **__: Any) -> Callable[..., T]: + return lambda *_, **__: value diff --git a/src/snakia/utils/side.py b/src/snakia/utils/side.py deleted file mode 100644 index 985e919..0000000 --- a/src/snakia/utils/side.py +++ /dev/null @@ -1,11 +0,0 @@ -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