From e7caa7a9ba0202c44ad02ea9fd37c27bd4336c26 Mon Sep 17 00:00:00 2001 From: nea Date: Sat, 12 Mar 2022 01:57:57 +0100 Subject: Initial commit --- sbdata/util.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 sbdata/util.py (limited to 'sbdata/util.py') diff --git a/sbdata/util.py b/sbdata/util.py new file mode 100644 index 0000000..87a3098 --- /dev/null +++ b/sbdata/util.py @@ -0,0 +1,13 @@ +import functools +from typing import TypeVar, Generator, ParamSpec, Callable + +_Param = ParamSpec('_Param') +_RetType = TypeVar('_RetType') + + +def no_generator(func: Callable[_Param, Generator[_RetType, None, None]]) -> Callable[_Param, list[_RetType]]: + @functools.wraps(func) + def wrapper(*args, **kwargs) -> list[_RetType]: + return list(func(*args, **kwargs)) + + return wrapper -- cgit