This commit is contained in:
lz_db
2025-11-16 12:31:03 +08:00
commit 0fab423a18
1451 changed files with 743213 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
from typing import Iterable, TypeVar, Union
T = TypeVar("T")
# pyright: reportGeneralTypeIssues=false
def ensure_iterable(value: Union[T, Iterable[T]]) -> Iterable[T]:
try:
iter(value)
# Now we now it is iterable
return value
except TypeError:
return [value]