Skip to content

Commit 3287025

Browse files
🔍 Add ParamSpec and TypeVar for type hints in Client class in squarecloud/client.py
1 parent b872367 commit 3287025

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎squarecloud/client.py‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from functools import wraps
55
from io import BytesIO
6-
from typing import Any, Callable, Literal, TextIO
6+
from typing import Any, Callable, Literal, ParamSpec, TextIO, TypeVar
77

88
from typing_extensions import deprecated
99

@@ -27,6 +27,9 @@
2727
from .listeners.request_listener import RequestListenerManager
2828
from .logging import logger
2929

30+
P = ParamSpec('P')
31+
R = TypeVar('R')
32+
3033

3134
@deprecated(
3235
'create_config_file is deprecated, '
@@ -180,10 +183,12 @@ def _notify_listener(endpoint: Endpoint):
180183
:return: a callable
181184
"""
182185

183-
def wrapper(func: Callable):
186+
def wrapper(func: Callable[P, R]) -> Callable[P, R]:
184187
@wraps(func)
185-
async def decorator(self: Client, *args, **kwargs) -> Response:
186-
result: Any
188+
async def decorator(
189+
self: Client, *args: P.args, **kwargs: P.kwargs
190+
) -> R:
191+
# result: Any
187192
response: Response
188193
result = await func(self, *args, **kwargs)
189194
response = self._http.last_response

0 commit comments

Comments
 (0)