aidentity

This commit is contained in:
AF 2022-07-15 21:35:58 +03:00
parent 8a9d4485ae
commit 5420a475e6
2 changed files with 7 additions and 3 deletions

View File

@ -1,7 +1,7 @@
__all__ = ( __all__ = (
'assert_true', 'assert_trues', 'assert_false', 'assert_none', 'assert_none_strict', 'assert_eq', 'assert_true', 'assert_trues', 'assert_false', 'assert_none', 'assert_none_strict', 'assert_eq',
'ExtendableResolver', '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', 'hash_point_format', 'tabulate', 'enable_newline', 'disable_newline',
'HashPoint', 'HashPoint',
'HashResolver', 'HashResolver',
@ -19,7 +19,7 @@ __all__ = (
from .asserts import assert_eq, assert_false, assert_none, assert_none_strict, assert_true, assert_trues from .asserts import assert_eq, assert_false, assert_none, assert_none_strict, assert_true, assert_trues
from .extendableresolver import ExtendableResolver 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 .hashpoint import HashPoint
from .hashpointformat import disable_newline, enable_newline, hash_point_format, tabulate from .hashpointformat import disable_newline, enable_newline, hash_point_format, tabulate
from .hashresolver import HashResolver from .hashresolver import HashResolver

View File

@ -1,7 +1,7 @@
import asyncio import asyncio
from typing import Any, AsyncIterable, Awaitable, Coroutine, TypeVar, overload 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 _gather = asyncio.gather
@ -74,3 +74,7 @@ T = TypeVar('T')
async def alist(aiterable: AsyncIterable[T]) -> list[T]: async def alist(aiterable: AsyncIterable[T]) -> list[T]:
return [x async for x in aiterable] return [x async for x in aiterable]
async def aidentity(value: T) -> Coroutine[Any, Any, T]:
return value