Skip to content

Commit

Permalink
Fixes argument resolution
Browse files Browse the repository at this point in the history
Signed-off-by: Tao He <[email protected]>
  • Loading branch information
sighingnow committed Dec 13, 2023
1 parent 41dd2d1 commit df719e3
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions python/vineyard/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ class Client:

def __init__(
self,
socket: str = None,
socket_or_host: str = None,
host: str = None,
port: Union[int, str] = None,
endpoint: Tuple[str, Union[str, int]] = None,
session: int = 0,
username: str = "",
password: str = "",
session: int = None,
username: str = None,
password: str = None,
):
"""Connects to the vineyard IPC socket and RPC socket.
Expand All @@ -76,13 +76,21 @@ def __init__(
self._rpc_client: RPCClient = None

kwargs = {}
if session:
if session is not None:
kwargs['session'] = session
if socket:
if username is not None:
kwargs['username'] = username
if password:
if password is not None:
kwargs['password'] = password

if socket_or_host is not None:
if port is not None:
socket, host = None, socket_or_host
else:
socket, host = socket_or_host, None
else:
socket, host = None, None

if not socket:
socket = os.getenv('VINEYARD_IPC_SOCKET', None)
if not endpoint and not (host and port):
Expand Down

0 comments on commit df719e3

Please sign in to comment.