From c3b6ea9c4d2e0b755dac4d5f74328be27b7c5fc4 Mon Sep 17 00:00:00 2001 From: XaverStiensmeier Date: Mon, 2 Dec 2024 18:45:06 +0100 Subject: [PATCH] pleased linter --- .pylintrc | 4 ++-- bibigrid/core/utility/handler/ssh_handler.py | 24 ++++++++++---------- bibigrid/models/return_threading.py | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.pylintrc b/.pylintrc index 42d86e71..e1995c0d 100644 --- a/.pylintrc +++ b/.pylintrc @@ -562,8 +562,8 @@ min-public-methods=2 [EXCEPTIONS] # Exceptions that will emit a warning when caught. -overgeneral-exceptions=BaseException, - Exception +overgeneral-exceptions=builtins.BaseException, + builtins.Exception [STRING] diff --git a/bibigrid/core/utility/handler/ssh_handler.py b/bibigrid/core/utility/handler/ssh_handler.py index 21bdf1ea..954aff53 100644 --- a/bibigrid/core/utility/handler/ssh_handler.py +++ b/bibigrid/core/utility/handler/ssh_handler.py @@ -116,7 +116,7 @@ def is_active(client, paramiko_key, ssh_data, log): log.info(f"Successfully connected to {ssh_data['floating_ip']}.") except paramiko.ssh_exception.NoValidConnectionsError as exc: if attempts < ssh_data['timeout']: - sleep_time = 2 ** (attempts+2) + sleep_time = 2 ** (attempts + 2) time.sleep(sleep_time) log.info(f"Waiting {sleep_time} before attempting to reconnect.") attempts += 1 @@ -209,14 +209,14 @@ def execute_ssh(ssh_data, log): log.error(f"Couldn't connect to ip {ssh_data['gateway'] or ssh_data['floating_ip']} using private key " f"{ssh_data['private_key']}.") raise exc - else: - log.debug(f"Setting up {ssh_data['floating_ip']}") - if ssh_data['filepaths']: - log.debug(f"Setting up filepaths for {ssh_data['floating_ip']}") - sftp = client.open_sftp() - for local_path, remote_path in ssh_data['filepaths']: - copy_to_server(sftp=sftp, local_path=local_path, remote_path=remote_path, log=log) - log.debug("SFTP: Files %s copied.", ssh_data['filepaths']) - if ssh_data["floating_ip"]: - log.debug(f"Setting up commands for {ssh_data['floating_ip']}") - execute_ssh_cml_commands(client=client, commands=ssh_data["commands"], log=log) + + log.debug(f"Setting up {ssh_data['floating_ip']}") + if ssh_data['filepaths']: + log.debug(f"Setting up filepaths for {ssh_data['floating_ip']}") + sftp = client.open_sftp() + for local_path, remote_path in ssh_data['filepaths']: + copy_to_server(sftp=sftp, local_path=local_path, remote_path=remote_path, log=log) + log.debug("SFTP: Files %s copied.", ssh_data['filepaths']) + if ssh_data["floating_ip"]: + log.debug(f"Setting up commands for {ssh_data['floating_ip']}") + execute_ssh_cml_commands(client=client, commands=ssh_data["commands"], log=log) diff --git a/bibigrid/models/return_threading.py b/bibigrid/models/return_threading.py index 52c8b054..028da822 100644 --- a/bibigrid/models/return_threading.py +++ b/bibigrid/models/return_threading.py @@ -13,7 +13,7 @@ class ReturnThread(threading.Thread): """ # pylint: disable=dangerous-default-value - def __init__(self, group=None, target=None, name=None, args=(), + def __init__(self, *, group=None, target=None, name=None, args=(), kwargs={}): threading.Thread.__init__(self, group, target, name, args, kwargs) self._return = None