Skip to content

Commit e68a7fa

Browse files
opportunity356Islam Alibekov
andauthored
feat(CLOUDAPI-1046): Improve client method typing with TypeVar (#148)
Co-authored-by: Islam Alibekov <[email protected]>
1 parent cd1632f commit e68a7fa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

yandexcloud/_sdk.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import inspect
2-
from typing import TYPE_CHECKING, Any, Dict, Optional, Type, Union
2+
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Type, TypeVar, Union
33

44
import grpc
55

66
from yandexcloud import _channels, _helpers, _operation_waiter, _retry_policy
77
from yandexcloud._wrappers import Wrappers
88

9+
Client = TypeVar("Client")
10+
911
if TYPE_CHECKING:
1012
import logging
1113

@@ -70,7 +72,7 @@ def __init__(
7072

7173
def client(
7274
self,
73-
stub_ctor: Type,
75+
stub_ctor: Callable[[Any], Client],
7476
interceptor: Union[
7577
grpc.UnaryUnaryClientInterceptor,
7678
grpc.UnaryStreamClientInterceptor,
@@ -80,7 +82,7 @@ def client(
8082
] = None,
8183
endpoint: Optional[str] = None,
8284
insecure: bool = False,
83-
) -> Any:
85+
) -> Client:
8486
service = _service_for_ctor(stub_ctor)
8587
channel = self._channels.channel(service, endpoint, insecure)
8688
if interceptor is not None:

0 commit comments

Comments
 (0)