Skip to content

Commit 260118b

Browse files
committed
typing fix
1 parent 33ed888 commit 260118b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

psll/build.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,23 @@
99
# Fix for lru_cache in Python 3.14+
1010
# See: https://github.com/python/cpython/issues/132064
1111
from functools import wraps
12-
from typing import Any, Callable
12+
from typing import Any, Callable, TypeVar
1313

1414
_old_lru_cache = lru_cache
1515

16-
def wrapped_lru_cache[T: Callable](*lru_args, **lru_kwargs) -> Callable[[T], T]:
17-
def decorator(func: T) -> T:
16+
_T = TypeVar("_T", bound=Callable)
17+
18+
def wrapped_lru_cache(*lar: Any, **lkw: Any) -> Callable[[_T], _T]:
19+
def decorator(func: _T) -> _T:
1820
@wraps(func)
19-
def wrapper(*args: Any, **kwargs: Any) -> Any:
20-
return _old_lru_cache(*lru_args, **lru_kwargs)(func)(*args, **kwargs)
21+
def wrapper(*ar: Any, **kw: Any) -> Any:
22+
return _old_lru_cache(*lar, **lkw)(func)(*ar, **kw)
2123

2224
return wrapper # type: ignore
2325

2426
return decorator
2527

26-
lru_cache = wrapped_lru_cache
28+
lru_cache = wrapped_lru_cache # type: ignore
2729

2830

2931
# ===================================================================================

0 commit comments

Comments
 (0)