python-iterutils 0.1.5__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_iterutils-0.1.5 → python_iterutils-0.1.6}/PKG-INFO +1 -1
- {python_iterutils-0.1.5 → python_iterutils-0.1.6}/iterutils/__init__.py +19 -2
- {python_iterutils-0.1.5 → python_iterutils-0.1.6}/pyproject.toml +1 -1
- {python_iterutils-0.1.5 → python_iterutils-0.1.6}/LICENSE +0 -0
- {python_iterutils-0.1.5 → python_iterutils-0.1.6}/iterutils/py.typed +0 -0
- {python_iterutils-0.1.5 → python_iterutils-0.1.6}/readme.md +0 -0
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
# encoding: utf-8
|
|
3
3
|
|
|
4
4
|
__author__ = "ChenyangGao <https://chenyanggao.github.io>"
|
|
5
|
-
__version__ = (0, 1,
|
|
5
|
+
__version__ = (0, 1, 6)
|
|
6
6
|
__all__ = [
|
|
7
7
|
"Return", "Yield", "YieldFrom", "iterable", "async_iterable", "foreach", "async_foreach",
|
|
8
8
|
"through", "async_through", "flatten", "async_flatten", "map", "filter", "reduce", "zip",
|
|
9
9
|
"chunked", "iter_unique", "async_iter_unique", "wrap_iter", "wrap_aiter", "acc_step",
|
|
10
|
-
"cut_iter", "run_gen_step", "run_gen_step_iter", "
|
|
10
|
+
"cut_iter", "run_gen_step", "run_gen_step_iter", "as_gen_step", "bfs_gen", "with_iter_next",
|
|
11
|
+
"backgroud_loop",
|
|
11
12
|
]
|
|
12
13
|
|
|
13
14
|
from abc import ABC, abstractmethod
|
|
@@ -29,6 +30,7 @@ from typing import overload, Any, AsyncContextManager, ContextManager, Literal
|
|
|
29
30
|
from asynctools import (
|
|
30
31
|
async_filter, async_map, async_reduce, async_zip, async_batched, ensure_async, ensure_aiter,
|
|
31
32
|
)
|
|
33
|
+
from decotools import optional
|
|
32
34
|
from texttools import format_time
|
|
33
35
|
from undefined import undefined, Undefined
|
|
34
36
|
|
|
@@ -681,6 +683,21 @@ def run_gen_step_iter(
|
|
|
681
683
|
return process()
|
|
682
684
|
|
|
683
685
|
|
|
686
|
+
@optional
|
|
687
|
+
def as_gen_step(
|
|
688
|
+
func: Callable,
|
|
689
|
+
/,
|
|
690
|
+
async_: bool = False,
|
|
691
|
+
iter: bool = False,
|
|
692
|
+
) -> Callable:
|
|
693
|
+
def wrapper(*args, **kwds):
|
|
694
|
+
if iter:
|
|
695
|
+
return run_gen_step_iter(func(*args, **kwds), async_=async_) # type: ignore
|
|
696
|
+
else:
|
|
697
|
+
return run_gen_step(func(*args, **kwds), async_=async_)
|
|
698
|
+
return wrapper
|
|
699
|
+
|
|
700
|
+
|
|
684
701
|
@overload
|
|
685
702
|
def bfs_gen[T](
|
|
686
703
|
initial: T,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|