python-iterutils 0.2.7__tar.gz → 0.2.9__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.2.7 → python_iterutils-0.2.9}/PKG-INFO +3 -3
- {python_iterutils-0.2.7 → python_iterutils-0.2.9}/iterutils/__init__.py +29 -26
- {python_iterutils-0.2.7 → python_iterutils-0.2.9}/pyproject.toml +3 -3
- {python_iterutils-0.2.7 → python_iterutils-0.2.9}/LICENSE +0 -0
- {python_iterutils-0.2.7 → python_iterutils-0.2.9}/iterutils/py.typed +0 -0
- {python_iterutils-0.2.7 → python_iterutils-0.2.9}/readme.md +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-iterutils
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.9
|
|
4
4
|
Summary: Python another itertools.
|
|
5
|
-
Home-page: https://github.com/ChenyangGao/
|
|
5
|
+
Home-page: https://github.com/ChenyangGao/python-modules/tree/main/python-iterutils
|
|
6
6
|
License: MIT
|
|
7
7
|
Keywords: iterable,iterutils
|
|
8
8
|
Author: ChenyangGao
|
|
@@ -23,7 +23,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
23
23
|
Requires-Dist: python-asynctools (>=0.1.3.4)
|
|
24
24
|
Requires-Dist: python-texttools (>=0.0.3)
|
|
25
25
|
Requires-Dist: python-undefined (>=0.0.3)
|
|
26
|
-
Project-URL: Repository, https://github.com/ChenyangGao/
|
|
26
|
+
Project-URL: Repository, https://github.com/ChenyangGao/python-modules/tree/main/python-iterutils
|
|
27
27
|
Description-Content-Type: text/markdown
|
|
28
28
|
|
|
29
29
|
# Python another itertools.
|
|
@@ -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, 9)
|
|
6
6
|
__all__ = [
|
|
7
7
|
"Yield", "YieldFrom", "GenStep", "GenStepIter", "iterable",
|
|
8
8
|
"async_iterable", "run_gen_step", "run_gen_step_iter",
|
|
@@ -211,16 +211,17 @@ def _run_gen_step_iter(
|
|
|
211
211
|
val_type = type(value)
|
|
212
212
|
if issubclass(val_type, (Yield, YieldFrom)):
|
|
213
213
|
value = value.value
|
|
214
|
-
|
|
214
|
+
if isinstance(value, GenStepIter):
|
|
215
215
|
yield from _run_gen_step_iter(value.value, value.max_depth)
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
216
|
+
else:
|
|
217
|
+
if isinstance(value, GenStep):
|
|
218
|
+
value = _run_gen_step(value.value, value.max_depth)
|
|
219
|
+
elif drive_generator and isinstance(value, Generator):
|
|
220
|
+
value = _run_gen_step(value, dgen)
|
|
221
|
+
if val_type is Yield:
|
|
222
|
+
yield value
|
|
223
|
+
elif val_type is YieldFrom:
|
|
224
|
+
yield from value
|
|
224
225
|
except BaseException as e:
|
|
225
226
|
value = throw(e)
|
|
226
227
|
else:
|
|
@@ -288,22 +289,23 @@ async def _run_gen_step_async_iter(
|
|
|
288
289
|
value = value.value
|
|
289
290
|
if isawaitable(value):
|
|
290
291
|
value = await value
|
|
291
|
-
|
|
292
|
+
if isinstance(value, GenStepIter):
|
|
292
293
|
async for el in _run_gen_step_async_iter(value.value, value.max_depth):
|
|
293
294
|
yield el
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
295
|
+
else:
|
|
296
|
+
if isinstance(value, GenStep):
|
|
297
|
+
value = await _run_gen_step_async(value.value, value.max_depth)
|
|
298
|
+
elif drive_generator and isinstance(value, Generator):
|
|
299
|
+
value = await _run_gen_step_async(value, dgen)
|
|
300
|
+
if val_type is Yield:
|
|
301
|
+
yield value
|
|
302
|
+
elif val_type is YieldFrom:
|
|
303
|
+
if isinstance(value, AsyncIterable):
|
|
304
|
+
async for el in value:
|
|
305
|
+
yield el
|
|
306
|
+
else:
|
|
307
|
+
for el in value:
|
|
308
|
+
yield el
|
|
307
309
|
finally:
|
|
308
310
|
gen.close()
|
|
309
311
|
|
|
@@ -698,7 +700,8 @@ def foreach(
|
|
|
698
700
|
else:
|
|
699
701
|
for arg in iterable:
|
|
700
702
|
value(arg)
|
|
701
|
-
|
|
703
|
+
else:
|
|
704
|
+
return async_foreach(value, iterable, *iterables, threaded=threaded)
|
|
702
705
|
|
|
703
706
|
|
|
704
707
|
async def async_foreach(
|
|
@@ -729,7 +732,7 @@ def through(
|
|
|
729
732
|
"""
|
|
730
733
|
if threaded or not isinstance(iterable, Iterable):
|
|
731
734
|
return async_through(iterable, take_while, threaded=threaded)
|
|
732
|
-
|
|
735
|
+
elif take_while is None:
|
|
733
736
|
for _ in iterable:
|
|
734
737
|
pass
|
|
735
738
|
else:
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "python-iterutils"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.9"
|
|
4
4
|
description = "Python another itertools."
|
|
5
5
|
authors = ["ChenyangGao <wosiwujm@gmail.com>"]
|
|
6
6
|
license = "MIT"
|
|
7
7
|
readme = "readme.md"
|
|
8
|
-
homepage = "https://github.com/ChenyangGao/
|
|
9
|
-
repository = "https://github.com/ChenyangGao/
|
|
8
|
+
homepage = "https://github.com/ChenyangGao/python-modules/tree/main/python-iterutils"
|
|
9
|
+
repository = "https://github.com/ChenyangGao/python-modules/tree/main/python-iterutils"
|
|
10
10
|
keywords = ["iterable", "iterutils"]
|
|
11
11
|
classifiers = [
|
|
12
12
|
"License :: OSI Approved :: MIT License",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|