python-iterutils 0.1.5__py3-none-any.whl → 0.1.6.1__py3-none-any.whl

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.
iterutils/__init__.py CHANGED
@@ -2,12 +2,13 @@
2
2
  # encoding: utf-8
3
3
 
4
4
  __author__ = "ChenyangGao <https://chenyanggao.github.io>"
5
- __version__ = (0, 1, 5)
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", "bfs_gen", "with_iter_next", "backgroud_loop",
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,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-iterutils
3
- Version: 0.1.5
3
+ Version: 0.1.6.1
4
4
  Summary: Python another itertools.
5
5
  Home-page: https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-iterutils
6
6
  License: MIT
@@ -21,6 +21,7 @@ Classifier: Topic :: Software Development
21
21
  Classifier: Topic :: Software Development :: Libraries
22
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
23
  Requires-Dist: python-asynctools (>=0.0.10)
24
+ Requires-Dist: python-decotools (>=0.0.1.2)
24
25
  Requires-Dist: python-texttools (>=0.0.3)
25
26
  Requires-Dist: python-undefined (>=0.0.3)
26
27
  Project-URL: Repository, https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-iterutils
@@ -0,0 +1,7 @@
1
+ LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
2
+ iterutils/__init__.py,sha256=q5UPgJ2fSDIMQIRFyKlgLqWDiy-b_G8Ft6BSFz_lH3Y,26588
3
+ iterutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ python_iterutils-0.1.6.1.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
5
+ python_iterutils-0.1.6.1.dist-info/METADATA,sha256=k7dUrZEwrlFiXjqon1V7-1KxPeoh0a5UcAcy502VAR4,1472
6
+ python_iterutils-0.1.6.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
7
+ python_iterutils-0.1.6.1.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
2
- iterutils/__init__.py,sha256=VRL_byJ8rSDBFDYPZFnxmG7AzDJ7EXC_i1AjYi_9RZM,26174
3
- iterutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- python_iterutils-0.1.5.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
5
- python_iterutils-0.1.5.dist-info/METADATA,sha256=tLN1tAcz_WipgczszAbxMcKFImyyiBehvVnjwY_8_sk,1426
6
- python_iterutils-0.1.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
7
- python_iterutils-0.1.5.dist-info/RECORD,,