esuls 0.1.8__py3-none-any.whl → 0.1.9__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.
esuls/utils.py CHANGED
@@ -8,22 +8,21 @@ T = TypeVar("T")
8
8
 
9
9
 
10
10
  async def run_parallel(
11
- *functions: Callable[[], Awaitable[T]],
11
+ *coroutines: Awaitable[T],
12
12
  limit: int = 20
13
13
  ) -> List[T]:
14
- """
15
- run parallel multiple functions
16
- """
14
+ """Run parallel coroutines with semaphore limit"""
15
+
17
16
  semaphore = asyncio.Semaphore(limit)
18
-
19
- async def limited_function(func: Callable[[], Awaitable[T]]) -> T:
17
+
18
+ async def limited_coroutine(coro: Awaitable[T]) -> T:
20
19
  async with semaphore:
21
- return await func()
22
-
23
- tasks = [asyncio.create_task(limited_function(func)) for func in functions]
24
-
20
+ return await coro
21
+
22
+ tasks = [asyncio.create_task(limited_coroutine(coro)) for coro in coroutines]
23
+
25
24
  results = []
26
25
  for fut in asyncio.as_completed(tasks):
27
26
  results.append(await fut)
28
-
27
+
29
28
  return results
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: esuls
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Utility library for async database operations, HTTP requests, and parallel execution
5
5
  Author-email: IperGiove <ipergiove@gmail.com>
6
6
  License: MIT
@@ -0,0 +1,10 @@
1
+ esuls/__init__.py,sha256=dtZtmjZZ8jNspOd17BWsE9D9ofeg3vZF0vIpSgKaZqk,529
2
+ esuls/db_cli.py,sha256=F1XwkuzCc69ldnDv0-X4kl4VZ9zI6oJnqmQAOe2d8jE,17931
3
+ esuls/download_icon.py,sha256=w-bWbyPSbWvonzq43aDDtdxIvdKSa7OSyZ7LaN0uudg,3623
4
+ esuls/request_cli.py,sha256=Lfxl0fwSq0npQb_qzWj7tTeqXR6tuZKpOYkjtpWjxHQ,15084
5
+ esuls/utils.py,sha256=PjdxbcolJEiab9d5r6f8cLz2bE-S-vuCImcYUoMyTAQ,675
6
+ esuls-0.1.9.dist-info/licenses/LICENSE,sha256=AY0N01ARt0kbKB7CkByYLqqNQU-yalb-rpv-eXITEWA,1066
7
+ esuls-0.1.9.dist-info/METADATA,sha256=GV2GIJSCNBfBFGUt189fHJAWNCCOFMdJziWfZZm_ScA,6994
8
+ esuls-0.1.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ esuls-0.1.9.dist-info/top_level.txt,sha256=WWBDHRhQ0DQLBZKD7Un8uFN93GvVQnP4WvJKkvbACVA,6
10
+ esuls-0.1.9.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- esuls/__init__.py,sha256=dtZtmjZZ8jNspOd17BWsE9D9ofeg3vZF0vIpSgKaZqk,529
2
- esuls/db_cli.py,sha256=F1XwkuzCc69ldnDv0-X4kl4VZ9zI6oJnqmQAOe2d8jE,17931
3
- esuls/download_icon.py,sha256=w-bWbyPSbWvonzq43aDDtdxIvdKSa7OSyZ7LaN0uudg,3623
4
- esuls/request_cli.py,sha256=Lfxl0fwSq0npQb_qzWj7tTeqXR6tuZKpOYkjtpWjxHQ,15084
5
- esuls/utils.py,sha256=R0peIanodvDrKYFWWdLZ9weIPAUZX787XIjZH40qNo0,677
6
- esuls-0.1.8.dist-info/licenses/LICENSE,sha256=AY0N01ARt0kbKB7CkByYLqqNQU-yalb-rpv-eXITEWA,1066
7
- esuls-0.1.8.dist-info/METADATA,sha256=FaOZdJlusRJ7eFKetj3bfWaQgHoe0rb7F7Za4RLGEHg,6994
8
- esuls-0.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
- esuls-0.1.8.dist-info/top_level.txt,sha256=WWBDHRhQ0DQLBZKD7Un8uFN93GvVQnP4WvJKkvbACVA,6
10
- esuls-0.1.8.dist-info/RECORD,,
File without changes