python-iterutils 0.0.4.4__py3-none-any.whl → 0.0.4.5__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
@@ -168,7 +168,7 @@ def cut_iter(
168
168
 
169
169
 
170
170
  def run_gen_step(
171
- gen_step: Generator[Callable, Any, T] | Callable[[], Generator[Callable, Any, T]],
171
+ gen_step: Generator[Any, Any, T] | Callable[[], Generator[Any, Any, T]],
172
172
  *,
173
173
  async_: bool = False,
174
174
  threaded: bool = False,
@@ -191,9 +191,14 @@ def run_gen_step(
191
191
  func = send(None)
192
192
  while True:
193
193
  try:
194
- ret = func()
195
- if isawaitable(ret):
196
- ret = await ret
194
+ if isawaitable(func):
195
+ ret = await func
196
+ elif callable(func):
197
+ ret = func()
198
+ if isawaitable(ret):
199
+ ret = await ret
200
+ else:
201
+ ret = func
197
202
  except BaseException as e:
198
203
  if threaded:
199
204
  func = await to_thread(throw, e)
@@ -233,7 +238,7 @@ def run_gen_step(
233
238
  func = send(None)
234
239
  while True:
235
240
  try:
236
- ret = func()
241
+ ret = func() if callable(func) else ret
237
242
  except BaseException as e:
238
243
  func = throw(e)
239
244
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-iterutils
3
- Version: 0.0.4.4
3
+ Version: 0.0.4.5
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
@@ -0,0 +1,7 @@
1
+ LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
2
+ iterutils/__init__.py,sha256=aUoT5_AkcRUYDM5M9WHckr_URTA01jKhbPDcufH90Ko,7381
3
+ iterutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ python_iterutils-0.0.4.5.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
5
+ python_iterutils-0.0.4.5.dist-info/METADATA,sha256=feKv9AWPu1xSoVXmPjJN86CY3xUzMLjaUEPbPpW79LY,1384
6
+ python_iterutils-0.0.4.5.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
7
+ python_iterutils-0.0.4.5.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
2
- iterutils/__init__.py,sha256=BpH6U5MymFEO9kwT05a_XN7DNECo1G1C_BwJR8mZouY,7147
3
- iterutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- python_iterutils-0.0.4.4.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
5
- python_iterutils-0.0.4.4.dist-info/METADATA,sha256=2nPz84gTeuBw1gJATvtxdJAEkTZ6it0D4qvu8yUQQpk,1384
6
- python_iterutils-0.0.4.4.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
7
- python_iterutils-0.0.4.4.dist-info/RECORD,,