esuls 0.1.8__tar.gz → 0.1.10__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.4
2
2
  Name: esuls
3
- Version: 0.1.8
3
+ Version: 0.1.10
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "esuls"
7
- version = "0.1.8"
7
+ version = "0.1.10"
8
8
  description = "Utility library for async database operations, HTTP requests, and parallel execution"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.14"
@@ -0,0 +1,23 @@
1
+ """
2
+ General utilities - no external dependencies required
3
+ """
4
+ import asyncio
5
+ from typing import Awaitable, Callable, List, TypeVar
6
+
7
+ T = TypeVar("T")
8
+
9
+
10
+ async def run_parallel(
11
+ *coroutines: Awaitable[T],
12
+ limit: int = 20
13
+ ) -> List[T]:
14
+ """Run parallel coroutines with semaphore limit, preserving order"""
15
+
16
+ semaphore = asyncio.Semaphore(limit)
17
+
18
+ async def limited_coroutine(coro: Awaitable[T]) -> T:
19
+ async with semaphore:
20
+ return await coro
21
+
22
+ return await asyncio.gather(*[limited_coroutine(coro) for coro in coroutines])
23
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: esuls
3
- Version: 0.1.8
3
+ Version: 0.1.10
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
@@ -1,29 +0,0 @@
1
- """
2
- General utilities - no external dependencies required
3
- """
4
- import asyncio
5
- from typing import Awaitable, Callable, List, TypeVar
6
-
7
- T = TypeVar("T")
8
-
9
-
10
- async def run_parallel(
11
- *functions: Callable[[], Awaitable[T]],
12
- limit: int = 20
13
- ) -> List[T]:
14
- """
15
- run parallel multiple functions
16
- """
17
- semaphore = asyncio.Semaphore(limit)
18
-
19
- async def limited_function(func: Callable[[], Awaitable[T]]) -> T:
20
- async with semaphore:
21
- return await func()
22
-
23
- tasks = [asyncio.create_task(limited_function(func)) for func in functions]
24
-
25
- results = []
26
- for fut in asyncio.as_completed(tasks):
27
- results.append(await fut)
28
-
29
- return results
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes