relib 1.3.12__tar.gz → 1.3.13__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.
- {relib-1.3.12 → relib-1.3.13}/PKG-INFO +1 -1
- {relib-1.3.12 → relib-1.3.13}/pyproject.toml +1 -1
- {relib-1.3.12 → relib-1.3.13}/relib/iter_utils.py +3 -2
- {relib-1.3.12 → relib-1.3.13}/relib/runtime_tools.py +3 -3
- {relib-1.3.12 → relib-1.3.13}/uv.lock +1 -1
- {relib-1.3.12 → relib-1.3.13}/.gitignore +0 -0
- {relib-1.3.12 → relib-1.3.13}/.python-version +0 -0
- {relib-1.3.12 → relib-1.3.13}/LICENSE +0 -0
- {relib-1.3.12 → relib-1.3.13}/README.md +0 -0
- {relib-1.3.12 → relib-1.3.13}/relib/__init__.py +0 -0
- {relib-1.3.12 → relib-1.3.13}/relib/class_utils.py +0 -0
- {relib-1.3.12 → relib-1.3.13}/relib/dict_utils.py +0 -0
- {relib-1.3.12 → relib-1.3.13}/relib/io_utils.py +0 -0
- {relib-1.3.12 → relib-1.3.13}/relib/processing_utils.py +0 -0
- {relib-1.3.12 → relib-1.3.13}/relib/type_utils.py +0 -0
- {relib-1.3.12 → relib-1.3.13}/relib/types.py +0 -0
@@ -100,9 +100,10 @@ class seekable(Generic[T]):
|
|
100
100
|
def __bool__(self):
|
101
101
|
return bool(self[:1])
|
102
102
|
|
103
|
-
def clear(self):
|
103
|
+
def clear(self) -> seekable[T]:
|
104
104
|
self.sink[:self.index] = []
|
105
105
|
self.index = 0
|
106
|
+
return self
|
106
107
|
|
107
108
|
def seek(self, index: int) -> seekable[T]:
|
108
109
|
index = max(0, index)
|
@@ -208,6 +209,6 @@ def unzip_iterable(iterable: Iterable[tuple[T1, T2, T3]], n: Literal[3]) -> tupl
|
|
208
209
|
def unzip_iterable(iterable: Iterable[tuple[T1, T2, T3, T4]], n: Literal[4]) -> tuple[Iterable[T1], Iterable[T2], Iterable[T3], Iterable[T4]]: ...
|
209
210
|
@overload
|
210
211
|
def unzip_iterable(iterable: Iterable[tuple[T1, T2, T3, T4, T5]], n: Literal[5]) -> tuple[Iterable[T1], Iterable[T2], Iterable[T3], Iterable[T4], Iterable[T5]]: ...
|
211
|
-
def unzip_iterable(iterable: Iterable[tuple], n: int) -> tuple:
|
212
|
+
def unzip_iterable(iterable: Iterable[tuple], n: int) -> tuple[Iterable, ...]:
|
212
213
|
iters = tee(iterable, n)
|
213
214
|
return tuple(map(lambda i, iter: (x[i] for x in iter), range(n), iters))
|
@@ -5,7 +5,7 @@ import sys
|
|
5
5
|
from concurrent.futures import ThreadPoolExecutor
|
6
6
|
from functools import partial, wraps
|
7
7
|
from time import time
|
8
|
-
from typing import Callable, Coroutine, Iterable, ParamSpec, TypeVar
|
8
|
+
from typing import Awaitable, Callable, Coroutine, Iterable, ParamSpec, TypeVar
|
9
9
|
from .iter_utils import as_list
|
10
10
|
from .processing_utils import noop
|
11
11
|
from .types import T
|
@@ -35,13 +35,13 @@ def clear_console() -> None:
|
|
35
35
|
def console_link(text: str, url: str) -> str:
|
36
36
|
return f"\033]8;;{url}\033\\{text}\033]8;;\033\\"
|
37
37
|
|
38
|
-
async def worker(task: Coro[T], semaphore: asyncio.Semaphore, update=noop) -> T:
|
38
|
+
async def worker(task: Coro[T] | Awaitable[T], semaphore: asyncio.Semaphore, update=noop) -> T:
|
39
39
|
async with semaphore:
|
40
40
|
result = await task
|
41
41
|
update()
|
42
42
|
return result
|
43
43
|
|
44
|
-
async def roll_tasks(tasks: Iterable[Coro[T]], workers=default_workers, progress=False) -> list[T]:
|
44
|
+
async def roll_tasks(tasks: Iterable[Coro[T] | Awaitable[T]], workers=default_workers, progress=False) -> list[T]:
|
45
45
|
semaphore = asyncio.Semaphore(workers)
|
46
46
|
if not progress:
|
47
47
|
return await asyncio.gather(*[worker(task, semaphore) for task in tasks])
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|