Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 9b094aa

Browse files
author
Juanjo Alvarez
committed
Allow to create Clients with an instanced grpc channel as suggested by Vadim
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
1 parent a020666 commit 9b094aa

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

bblfsh/client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class BblfshClient:
1818
Babelfish gRPC client.
1919
"""
2020

21-
def __init__(self, endpoint: str) -> None:
21+
def __init__(self, endpoint: Union[str, grpc.Channel]) -> None:
2222
"""
2323
Initializes a new instance of BblfshClient.
2424
@@ -27,7 +27,11 @@ def __init__(self, endpoint: str) -> None:
2727
:type endpoint: str
2828
"""
2929

30-
self._channel = grpc.insecure_channel(endpoint)
30+
if isinstance(endpoint, str):
31+
self._channel = grpc.insecure_channel(endpoint)
32+
else:
33+
self._channel = grpc.endpoint
34+
3135
self._stub_v1 = ProtocolServiceStub(self._channel)
3236
self._stub_v2 = DriverStub(self._channel)
3337

0 commit comments

Comments
 (0)