Avoid recursions in signatures, fixes #2085
This commit is contained in:
1 parent
e7843ba82c
commit
3fd1c87716
4 files changed
+53
-8
No files matched your search
@@ -2,6 +2,7 @@
|
||||
import functools
|
||||
import re
|
||||
import os
|
||||
from typing import ParamSpec, TypeVar, Callable, Iterable
|
||||
|
||||
|
||||
_sep = os.path.sep
|
||||
@@ -10,8 +11,11 @@ if os.path.altsep is not None:
|
||||
_path_re = re.compile(r'(?:\.[^{0}]+|[{0}]__init__\.py)$'.format(re.escape(_sep)))
|
||||
del _sep
|
||||
|
||||
P = ParamSpec("P")
|
||||
T = TypeVar("T")
|
||||
|
||||
def to_list(func):
|
||||
|
||||
def to_list(func: Callable[P, Iterable[T]]) -> Callable[P, list[T]]:
|
||||
def wrapper(*args, **kwargs):
|
||||
return list(func(*args, **kwargs))
|
||||
return wrapper
|
||||
|
||||
Reference in new issue
Block a user