From 5420a475e66f39c361f362f4ebc0660c54d358e0 Mon Sep 17 00:00:00 2001 From: timotheyca Date: Fri, 15 Jul 2022 21:35:58 +0300 Subject: [PATCH] aidentity --- rainbowadn/core/__init__.py | 4 ++-- rainbowadn/core/gather.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/rainbowadn/core/__init__.py b/rainbowadn/core/__init__.py index 885a760..cafe8ff 100644 --- a/rainbowadn/core/__init__.py +++ b/rainbowadn/core/__init__.py @@ -1,7 +1,7 @@ __all__ = ( 'assert_true', 'assert_trues', 'assert_false', 'assert_none', 'assert_none_strict', 'assert_eq', 'ExtendableResolver', - 'gather', 'asum', 'alist', 'set_gather_asyncio', 'set_gather_linear', + 'gather', 'asum', 'alist', 'set_gather_asyncio', 'set_gather_linear', 'aidentity', 'hash_point_format', 'tabulate', 'enable_newline', 'disable_newline', 'HashPoint', 'HashResolver', @@ -19,7 +19,7 @@ __all__ = ( from .asserts import assert_eq, assert_false, assert_none, assert_none_strict, assert_true, assert_trues from .extendableresolver import ExtendableResolver -from .gather import alist, asum, gather, set_gather_asyncio, set_gather_linear +from .gather import aidentity, alist, asum, gather, set_gather_asyncio, set_gather_linear from .hashpoint import HashPoint from .hashpointformat import disable_newline, enable_newline, hash_point_format, tabulate from .hashresolver import HashResolver diff --git a/rainbowadn/core/gather.py b/rainbowadn/core/gather.py index 8c08027..6d155af 100644 --- a/rainbowadn/core/gather.py +++ b/rainbowadn/core/gather.py @@ -1,7 +1,7 @@ import asyncio from typing import Any, AsyncIterable, Awaitable, Coroutine, TypeVar, overload -__all__ = ('gather', 'asum', 'alist', 'set_gather_asyncio', 'set_gather_linear',) +__all__ = ('gather', 'asum', 'alist', 'set_gather_asyncio', 'set_gather_linear', 'aidentity',) _gather = asyncio.gather @@ -74,3 +74,7 @@ T = TypeVar('T') async def alist(aiterable: AsyncIterable[T]) -> list[T]: return [x async for x in aiterable] + + +async def aidentity(value: T) -> Coroutine[Any, Any, T]: + return value