python-asynctools
Advanced tools
+45
-14
@@ -5,7 +5,7 @@ #!/usr/bin/env python3 | ||
| __author__ = "ChenyangGao <https://chenyanggao.github.io>" | ||
| __version__ = (0, 0, 3) | ||
| __version__ = (0, 0, 4) | ||
| __all__ = [ | ||
| "as_thread", "ensure_async", "ensure_await", "ensure_coroutine", "ensure_aiter", | ||
| "async_map", "async_filter", "async_reduce", "async_zip", "async_chain", | ||
| "call_as_aiter", "to_list", | ||
| "async_all", "async_any", "call_as_aiter", "to_list", | ||
| ] | ||
@@ -27,3 +27,8 @@ | ||
| @decorated | ||
| def as_thread(func: Callable[Args, T], /, *args, **kwds) -> Awaitable[T]: | ||
| def as_thread( | ||
| func: Callable[Args, T], | ||
| /, | ||
| *args: Args.args, | ||
| **kwds: Args.kwargs, | ||
| ) -> Awaitable[T]: | ||
| def wrapfunc(*args, **kwds): | ||
@@ -40,3 +45,3 @@ try: | ||
| /, | ||
| threaded: bool = True, | ||
| threaded: bool = False, | ||
| ) -> Callable[Args, Awaitable[T]]: | ||
@@ -87,3 +92,3 @@ if iscoroutinefunction(func): | ||
| /, | ||
| threaded: bool = True, | ||
| threaded: bool = False, | ||
| ) -> AsyncIterator[T]: | ||
@@ -132,3 +137,3 @@ if isinstance(it, AsyncIterable): | ||
| *iterables: Iterable | AsyncIterable, | ||
| threaded: bool = True, | ||
| threaded: bool = False, | ||
| ) -> AsyncIterator[T]: | ||
@@ -148,3 +153,3 @@ fn = ensure_async(func, threaded=threaded) | ||
| /, | ||
| threaded: bool = True | ||
| threaded: bool = False, | ||
| ) -> AsyncIterator[T]: | ||
@@ -162,3 +167,3 @@ fn = ensure_async(func, threaded=threaded) | ||
| /, | ||
| threaded: bool = True, | ||
| threaded: bool = False, | ||
| ) -> AsyncIterator: | ||
@@ -182,3 +187,3 @@ ait = ensure_aiter(iterable, threaded=threaded) | ||
| *iterables, | ||
| threaded: bool = True, | ||
| threaded: bool = False, | ||
| ) -> AsyncIterator: | ||
@@ -200,3 +205,3 @@ iterable = ensure_aiter(iterable, threaded=threaded) | ||
| *iterables, | ||
| threaded: bool = True, | ||
| threaded: bool = False, | ||
| ) -> AsyncIterator: | ||
@@ -211,3 +216,3 @@ for it in iterables: | ||
| /, | ||
| threaded: bool = True, | ||
| threaded: bool = False, | ||
| ) -> AsyncIterator: | ||
@@ -221,2 +226,24 @@ async for it in ensure_aiter(iterable, threaded=False): | ||
| async def async_all( | ||
| iterable, | ||
| /, | ||
| threaded: bool = False, | ||
| ) -> bool: | ||
| async for e in ensure_aiter(iterable, threaded=threaded): | ||
| if not e: | ||
| return False | ||
| return True | ||
| async def async_any( | ||
| iterable, | ||
| /, | ||
| threaded: bool = False, | ||
| ) -> bool: | ||
| async for e in ensure_aiter(iterable, threaded=threaded): | ||
| if e: | ||
| return True | ||
| return False | ||
| async def call_as_aiter( | ||
@@ -226,3 +253,3 @@ func: Callable[[], T] | Callable[[], Awaitable[T]], | ||
| sentinel = undefined, | ||
| threaded: bool = True, | ||
| threaded: bool = False, | ||
| ) -> AsyncIterator[T]: | ||
@@ -246,4 +273,8 @@ func = ensure_async(func, threaded=threaded) | ||
| async def to_list(it: Iterable[T] | AsyncIterable[T], /) -> list[T]: | ||
| return [e async for e in ensure_aiter(it)] | ||
| async def to_list( | ||
| it: Iterable[T] | AsyncIterable[T], | ||
| /, | ||
| threaded: bool = False, | ||
| ) -> list[T]: | ||
| return [e async for e in ensure_aiter(it, threaded=threaded)] | ||
+1
-1
| Metadata-Version: 2.1 | ||
| Name: python-asynctools | ||
| Version: 0.0.3.1 | ||
| Version: 0.0.4 | ||
| Summary: Python asynchronous tools. | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-asynctools |
+1
-1
| [tool.poetry] | ||
| name = "python-asynctools" | ||
| version = "0.0.3.1" | ||
| version = "0.0.4" | ||
| description = "Python asynchronous tools." | ||
@@ -5,0 +5,0 @@ authors = ["ChenyangGao <wosiwujm@gmail.com>"] |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
11017
5.26%230
13.3%