Release/v0.5.0 #8
2 changed files with 14 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ from .attr import get_attrs, get_or_set_attr
|
||||||
from .frame import frame
|
from .frame import frame
|
||||||
from .inherit import inherit
|
from .inherit import inherit
|
||||||
from .nolock import nolock
|
from .nolock import nolock
|
||||||
|
from .side import side, side_func
|
||||||
from .this import this
|
from .this import this
|
||||||
from .throw import throw
|
from .throw import throw
|
||||||
from .to_async import to_async
|
from .to_async import to_async
|
||||||
|
|
@ -12,6 +13,8 @@ __all__ = [
|
||||||
"frame",
|
"frame",
|
||||||
"inherit",
|
"inherit",
|
||||||
"nolock",
|
"nolock",
|
||||||
|
"side",
|
||||||
|
"side_func",
|
||||||
"this",
|
"this",
|
||||||
"throw",
|
"throw",
|
||||||
"to_async",
|
"to_async",
|
||||||
|
|
|
||||||
11
src/snakia/utils/side.py
Normal file
11
src/snakia/utils/side.py
Normal file
|
|
@ -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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue