python-iterutils 0.2.7__py3-none-any.whl → 0.2.8__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 +26 -24
- {python_iterutils-0.2.7.dist-info → python_iterutils-0.2.8.dist-info}/METADATA +3 -3
- python_iterutils-0.2.8.dist-info/RECORD +7 -0
- python_iterutils-0.2.7.dist-info/RECORD +0 -7
- {python_iterutils-0.2.7.dist-info → python_iterutils-0.2.8.dist-info}/LICENSE +0 -0
- {python_iterutils-0.2.7.dist-info → python_iterutils-0.2.8.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, 8)
|
|
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
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-iterutils
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
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.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
|
2
|
+
iterutils/__init__.py,sha256=8EH6wqHA7ogI_VxHRBb68ZeheD0WOTdYOIbWLtrdqBc,37777
|
|
3
|
+
iterutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
python_iterutils-0.2.8.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
|
5
|
+
python_iterutils-0.2.8.dist-info/METADATA,sha256=DF5tmR35s_jxzz46D6P9wmAKOp_GuTJoAAhX8slWSKo,1397
|
|
6
|
+
python_iterutils-0.2.8.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
7
|
+
python_iterutils-0.2.8.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
|
2
|
-
iterutils/__init__.py,sha256=44RZPpEkjbhfDwb9cmUcStPJTPfyixaoMifj9iHme2s,37665
|
|
3
|
-
iterutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
python_iterutils-0.2.7.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
|
5
|
-
python_iterutils-0.2.7.dist-info/METADATA,sha256=VjYnPSbvmJBEe8CV8Ba2C5NN3La6vqrrAqLsJeb3q8Q,1427
|
|
6
|
-
python_iterutils-0.2.7.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
7
|
-
python_iterutils-0.2.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|