python-iterutils 0.0.2.1__tar.gz → 0.0.2.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-iterutils
3
- Version: 0.0.2.1
3
+ Version: 0.0.2.3
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: Programming Language :: Python :: 3 :: Only
21
21
  Classifier: Topic :: Software Development
22
22
  Classifier: Topic :: Software Development :: Libraries
23
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Requires-Dist: python-asynctools
24
25
  Project-URL: Repository, https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-iterutils
25
26
  Description-Content-Type: text/markdown
26
27
 
@@ -76,10 +76,16 @@ def wrap_iter(
76
76
  callnext = None
77
77
  for e in it:
78
78
  if callprev:
79
- callprev(e)
79
+ try:
80
+ callprev(e)
81
+ except (StopIteration, GeneratorExit):
82
+ break
80
83
  yield e
81
84
  if callnext:
82
- callnext(e)
85
+ try:
86
+ callnext(e)
87
+ except (StopIteration, GeneratorExit):
88
+ break
83
89
 
84
90
 
85
91
  async def wrap_aiter(
@@ -93,10 +99,16 @@ async def wrap_aiter(
93
99
  callnext = ensure_async(callnext) if callable(callnext) else None
94
100
  async for e in ensure_aiter(it, threaded=threaded):
95
101
  if callprev:
96
- await callprev(e)
102
+ try:
103
+ await callprev(e)
104
+ except (StopAsyncIteration, GeneratorExit):
105
+ break
97
106
  yield e
98
107
  if callnext:
99
- await callnext(e)
108
+ try:
109
+ await callnext(e)
110
+ except (StopAsyncIteration, GeneratorExit):
111
+ break
100
112
 
101
113
 
102
114
  def acc_step(
@@ -124,9 +136,3 @@ def cut_iter(
124
136
  if start != stop:
125
137
  yield stop, stop - start
126
138
 
127
-
128
- async def iter_to_aiter():
129
- for i in it:
130
- yield i
131
-
132
-
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-iterutils"
3
- version = "0.0.2.1"
3
+ version = "0.0.2.3"
4
4
  description = "Python another itertools."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"
@@ -27,6 +27,7 @@ include = [
27
27
 
28
28
  [tool.poetry.dependencies]
29
29
  python = "^3.10"
30
+ python-asynctools = "*"
30
31
 
31
32
  [build-system]
32
33
  requires = ["poetry-core"]