diff options
author | nea <romangraef@gmail.com> | 2022-03-12 01:57:57 +0100 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-03-12 01:57:57 +0100 |
commit | e7caa7a9ba0202c44ad02ea9fd37c27bd4336c26 (patch) | |
tree | 03bce4042c47e475a99dfe90bc1e7a31afe25358 /sbdata/util.py | |
download | sbdata-e7caa7a9ba0202c44ad02ea9fd37c27bd4336c26.tar.gz sbdata-e7caa7a9ba0202c44ad02ea9fd37c27bd4336c26.tar.bz2 sbdata-e7caa7a9ba0202c44ad02ea9fd37c27bd4336c26.zip |
Initial commit
Diffstat (limited to 'sbdata/util.py')
-rw-r--r-- | sbdata/util.py | 13 |
1 files changed, 13 insertions, 0 deletions
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 |