python-iterutils 0.2.2__py3-none-any.whl → 0.2.3.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 +41 -34
- {python_iterutils-0.2.2.dist-info → python_iterutils-0.2.3.1.dist-info}/METADATA +1 -1
- python_iterutils-0.2.3.1.dist-info/RECORD +7 -0
- python_iterutils-0.2.2.dist-info/RECORD +0 -7
- {python_iterutils-0.2.2.dist-info → python_iterutils-0.2.3.1.dist-info}/LICENSE +0 -0
- {python_iterutils-0.2.2.dist-info → python_iterutils-0.2.3.1.dist-info}/WHEEL +0 -0
iterutils/__init__.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# encoding: utf-8
|
|
3
3
|
|
|
4
4
|
__author__ = "ChenyangGao <https://chenyanggao.github.io>"
|
|
5
|
-
__version__ = (0, 2,
|
|
5
|
+
__version__ = (0, 2, 3)
|
|
6
6
|
__all__ = [
|
|
7
7
|
"Return", "Yield", "YieldFrom", "iterable", "async_iterable",
|
|
8
8
|
"foreach", "async_foreach", "through", "async_through", "flatten",
|
|
@@ -11,8 +11,8 @@ __all__ = [
|
|
|
11
11
|
"iter_unique", "async_iter_unique", "wrap_iter", "wrap_aiter",
|
|
12
12
|
"acc_step", "cut_iter", "iter_gen_step", "iter_gen_step_async",
|
|
13
13
|
"run_gen_step", "run_gen_step_sync_iter", "run_gen_step_async_iter",
|
|
14
|
-
"run_gen_step_iter", "as_gen_step", "
|
|
15
|
-
"backgroud_loop",
|
|
14
|
+
"run_gen_step_iter", "as_gen_step", "as_gen_step_iter", "bfs_gen",
|
|
15
|
+
"with_iter_next", "backgroud_loop",
|
|
16
16
|
]
|
|
17
17
|
|
|
18
18
|
from abc import ABC, abstractmethod
|
|
@@ -820,7 +820,7 @@ def run_gen_step(
|
|
|
820
820
|
threaded: bool = False,
|
|
821
821
|
running_flag: None | SupportsBool | Callable[[], SupportsBool] | Callable[[], Awaitable[SupportsBool]] = None,
|
|
822
822
|
*,
|
|
823
|
-
async_: None |
|
|
823
|
+
async_: None | Literal[False, True] = None,
|
|
824
824
|
):
|
|
825
825
|
"""
|
|
826
826
|
"""
|
|
@@ -1013,6 +1013,7 @@ def run_gen_step_iter(
|
|
|
1013
1013
|
may_await: bool | Literal[1] = True,
|
|
1014
1014
|
may_call: bool | Literal[1] = True,
|
|
1015
1015
|
threaded: bool = False,
|
|
1016
|
+
running_flag: None | SupportsBool | Callable[[], SupportsBool] | Callable[[], Awaitable[SupportsBool]] = None,
|
|
1016
1017
|
*,
|
|
1017
1018
|
async_: None = None,
|
|
1018
1019
|
) -> Iterator | AsyncIterator:
|
|
@@ -1023,6 +1024,7 @@ def run_gen_step_iter(
|
|
|
1023
1024
|
may_await: bool | Literal[1] = True,
|
|
1024
1025
|
may_call: bool | Literal[1] = True,
|
|
1025
1026
|
threaded: bool = False,
|
|
1027
|
+
running_flag: None | SupportsBool | Callable[[], SupportsBool] | Callable[[], Awaitable[SupportsBool]] = None,
|
|
1026
1028
|
*,
|
|
1027
1029
|
async_: Literal[False],
|
|
1028
1030
|
) -> Iterator:
|
|
@@ -1033,6 +1035,7 @@ def run_gen_step_iter(
|
|
|
1033
1035
|
may_await: bool | Literal[1] = True,
|
|
1034
1036
|
may_call: bool | Literal[1] = True,
|
|
1035
1037
|
threaded: bool = False,
|
|
1038
|
+
running_flag: None | SupportsBool | Callable[[], SupportsBool] | Callable[[], Awaitable[SupportsBool]] = None,
|
|
1036
1039
|
*,
|
|
1037
1040
|
async_: Literal[True],
|
|
1038
1041
|
) -> AsyncIterator:
|
|
@@ -1042,8 +1045,9 @@ def run_gen_step_iter(
|
|
|
1042
1045
|
may_await: bool | Literal[1] = True,
|
|
1043
1046
|
may_call: bool | Literal[1] = True,
|
|
1044
1047
|
threaded: bool = False,
|
|
1048
|
+
running_flag: None | SupportsBool | Callable[[], SupportsBool] | Callable[[], Awaitable[SupportsBool]] = None,
|
|
1045
1049
|
*,
|
|
1046
|
-
async_: None |
|
|
1050
|
+
async_: None | Literal[False, True] = None,
|
|
1047
1051
|
) -> Iterator | AsyncIterator:
|
|
1048
1052
|
"""
|
|
1049
1053
|
"""
|
|
@@ -1062,38 +1066,41 @@ def run_gen_step_iter(
|
|
|
1062
1066
|
|
|
1063
1067
|
@optional
|
|
1064
1068
|
def as_gen_step(
|
|
1065
|
-
func: Callable,
|
|
1069
|
+
func: Callable[..., Generator],
|
|
1066
1070
|
/,
|
|
1071
|
+
*deco_args,
|
|
1067
1072
|
iter: bool = False,
|
|
1068
|
-
|
|
1069
|
-
may_call: bool | Literal[1] = True,
|
|
1070
|
-
threaded: bool = False,
|
|
1071
|
-
running_flag: None | SupportsBool | Callable[[], SupportsBool] | Callable[[], Awaitable[SupportsBool]] = None,
|
|
1072
|
-
*,
|
|
1073
|
-
async_: None | bool = None,
|
|
1073
|
+
**deco_kwds,
|
|
1074
1074
|
) -> Callable:
|
|
1075
|
-
"""
|
|
1076
|
-
"""
|
|
1077
|
-
if
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1075
|
+
"""装饰器,把生成器封装成 gen_step 函数
|
|
1076
|
+
"""
|
|
1077
|
+
call = run_gen_step_iter if iter else run_gen_step
|
|
1078
|
+
def wrapper(*args, async_: Literal[False, True] = False, **kwds):
|
|
1079
|
+
return call(
|
|
1080
|
+
func(*args, async_=async_, **kwds),
|
|
1081
|
+
*deco_args,
|
|
1082
|
+
async_=async_,
|
|
1083
|
+
**deco_kwds,
|
|
1084
|
+
)
|
|
1085
|
+
return wrapper
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
@optional
|
|
1089
|
+
def as_gen_step_iter(
|
|
1090
|
+
func: Callable[..., Generator],
|
|
1091
|
+
/,
|
|
1092
|
+
*deco_args,
|
|
1093
|
+
**deco_kwds,
|
|
1094
|
+
) -> Callable:
|
|
1095
|
+
"""装饰器,把生成器封装成 gen_step 函数
|
|
1096
|
+
"""
|
|
1097
|
+
def wrapper(*args, async_: Literal[False, True] = False, **kwds):
|
|
1098
|
+
return run_gen_step_iter(
|
|
1099
|
+
func(*args, async_=async_, **kwds),
|
|
1100
|
+
*deco_args,
|
|
1101
|
+
async_=async_,
|
|
1102
|
+
**deco_kwds,
|
|
1103
|
+
)
|
|
1097
1104
|
return wrapper
|
|
1098
1105
|
|
|
1099
1106
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
|
2
|
+
iterutils/__init__.py,sha256=YfF1KgDwO1-35LWZ7eY8ppTD9EbmDEzRsOGzB6jkzco,38379
|
|
3
|
+
iterutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
python_iterutils-0.2.3.1.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
|
5
|
+
python_iterutils-0.2.3.1.dist-info/METADATA,sha256=Si7DMibcH8kd1tQ-0PrzpBsJOtOU_Dvdk8GcfGrY5kM,1469
|
|
6
|
+
python_iterutils-0.2.3.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
7
|
+
python_iterutils-0.2.3.1.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
|
2
|
-
iterutils/__init__.py,sha256=yCkEoGSY0n4E-_BvLRuoi50j4Kwuu-banqxIf-QloX4,37966
|
|
3
|
-
iterutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
python_iterutils-0.2.2.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
|
5
|
-
python_iterutils-0.2.2.dist-info/METADATA,sha256=xWgHLL5Q8knQfbWJkn9nijnp14koK8cvm8lw-JGGGrE,1467
|
|
6
|
-
python_iterutils-0.2.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
7
|
-
python_iterutils-0.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|