a5714116ac
+feat: configuration, progress bar, OSV
15 lines
381 B
Python
15 lines
381 B
Python
from __future__ import annotations
|
|
|
|
from typing import Iterable, Iterator, Optional, TypeVar
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
def progress(iterable: Iterable[T], *, total: Optional[int] = None, desc: str = "") -> Iterator[T]:
|
|
try:
|
|
from tqdm import tqdm # type: ignore
|
|
|
|
return iter(tqdm(iterable, total=total, desc=desc))
|
|
except Exception:
|
|
return iter(iterable)
|