python-iterutils 0.2.5.3__py3-none-any.whl → 0.2.5.4__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
@@ -480,9 +480,12 @@ def zip(
480
480
  ):
481
481
  """
482
482
  """
483
- if threaded or isinstance(iterable, AsyncIterable) or any(isinstance(i, AsyncIterable) for i in iterables):
484
- return async_zip(iterable, *iterables, threaded=threaded)
485
- return _zip(iterable, *iterables)
483
+ if (not threaded and
484
+ isinstance(iterable, Iterable) and
485
+ all(isinstance(it, Iterable) for it in iterables)
486
+ ):
487
+ return _zip(iterable, *iterables)
488
+ return async_zip(iterable, *iterables, threaded=threaded)
486
489
 
487
490
 
488
491
  @overload
@@ -507,9 +510,12 @@ def chain[T](
507
510
  *iterables: Iterable[T] | AsyncIterable[T],
508
511
  threaded: bool = False,
509
512
  ) -> Iterator[T] | AsyncIterator[T]:
510
- if threaded or not isinstance(iterable, Iterable):
511
- return async_chain(iterable, *iterables, threaded=threaded)
512
- return _chain(iterable, *iterables) # type: ignore
513
+ if (not threaded and
514
+ isinstance(iterable, Iterable) and
515
+ all(isinstance(it, Iterable) for it in iterables)
516
+ ):
517
+ return _chain(iterable, *iterables) # type: ignore
518
+ return async_chain(iterable, *iterables, threaded=threaded)
513
519
 
514
520
 
515
521
  @overload
@@ -589,14 +595,17 @@ def foreach(
589
595
  ):
590
596
  """
591
597
  """
592
- if threaded or not (isinstance(iterable, Iterable) and all(isinstance(it, Iterable) for it in iterables)):
593
- return async_foreach(value, iterable, *iterables, threaded=threaded)
594
- if iterables:
595
- for args in _zip(iterable, *iterables):
596
- value(*args)
597
- else:
598
- for arg in iterable:
599
- value(arg)
598
+ if (not threaded and
599
+ isinstance(iterable, Iterable) and
600
+ all(isinstance(it, Iterable) for it in iterables)
601
+ ):
602
+ if iterables:
603
+ for args in _zip(iterable, *iterables):
604
+ value(*args)
605
+ else:
606
+ for arg in iterable:
607
+ value(arg)
608
+ return async_foreach(value, iterable, *iterables, threaded=threaded)
600
609
 
601
610
 
602
611
  async def async_foreach(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-iterutils
3
- Version: 0.2.5.3
3
+ Version: 0.2.5.4
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=RdMUsfkgNEg9_5Lf4YNfCP8oB_PXJSdd_EHxeitP0Bk,33740
3
+ iterutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ python_iterutils-0.2.5.4.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
5
+ python_iterutils-0.2.5.4.dist-info/METADATA,sha256=fpaQOW9phx56FoA1NE19KlnqaJgYBrwhQGxeZHfxazs,1429
6
+ python_iterutils-0.2.5.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
7
+ python_iterutils-0.2.5.4.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
2
- iterutils/__init__.py,sha256=EVELTMkPih-vJsPKQNA21GJz_NlDIDLrZyhOA4muVTQ,33593
3
- iterutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- python_iterutils-0.2.5.3.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
5
- python_iterutils-0.2.5.3.dist-info/METADATA,sha256=ZE7kllJMWnKNk0hHV_2i26nhrrphLPccEeaAPhJ1Dyo,1429
6
- python_iterutils-0.2.5.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
7
- python_iterutils-0.2.5.3.dist-info/RECORD,,