From f3daf91852abb59f99f83604246c70602d7bee79 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Tue, 17 Sep 2024 14:49:20 +0300 Subject: [PATCH] fix flake errors --- multiversx_sdk_cli/cli_config.py | 2 +- multiversx_sdk_cli/docker.py | 2 +- .../ledger/ledger_app_handler.py | 2 +- multiversx_sdk_cli/localnet/config_part.py | 4 ++-- multiversx_sdk_cli/simulation.py | 2 ++ .../tests/local_verify_server.py | 4 ++-- multiversx_sdk_cli/validators/__init__.py | 21 +++++++------------ multiversx_sdk_cli/version.py | 2 +- 8 files changed, 18 insertions(+), 21 deletions(-) diff --git a/multiversx_sdk_cli/cli_config.py b/multiversx_sdk_cli/cli_config.py index d1439ac2..4e03879d 100644 --- a/multiversx_sdk_cli/cli_config.py +++ b/multiversx_sdk_cli/cli_config.py @@ -103,7 +103,7 @@ def list_configs(args: Any): def delete_config(args: Any): config_file = config.resolve_config_path() if not config_file.is_file(): - logger.info(f"Config file not found. Aborting...") + logger.info("Config file not found. Aborting...") return confirm_continuation(f"The file `{str(config_file)}` will be deleted. Do you want to continue? (y/n)") diff --git a/multiversx_sdk_cli/docker.py b/multiversx_sdk_cli/docker.py index b14e9ef2..02deb8bb 100644 --- a/multiversx_sdk_cli/docker.py +++ b/multiversx_sdk_cli/docker.py @@ -18,7 +18,7 @@ def is_docker_installed(): return True else: return False - except: + except Exception: logger.error("Something went wrong when checking if docker is installed!") diff --git a/multiversx_sdk_cli/ledger/ledger_app_handler.py b/multiversx_sdk_cli/ledger/ledger_app_handler.py index dde814ec..2ec9e955 100644 --- a/multiversx_sdk_cli/ledger/ledger_app_handler.py +++ b/multiversx_sdk_cli/ledger/ledger_app_handler.py @@ -30,7 +30,7 @@ class LedgerApp: def __init__(self): try: self.transport = Transport(interface="hid", debug=False) # Nano S/X using HID interface - except: + except Exception: raise LedgerError(CONNECTION_ERROR_MSG) def close(self): diff --git a/multiversx_sdk_cli/localnet/config_part.py b/multiversx_sdk_cli/localnet/config_part.py index e2df004f..cccdd17f 100644 --- a/multiversx_sdk_cli/localnet/config_part.py +++ b/multiversx_sdk_cli/localnet/config_part.py @@ -24,8 +24,8 @@ def _validate_overriding_entries(self, overriding: Dict[str, Any]) -> None: if unknown_entries: logger.error(f"""\ -Unknown localnet configuration entries: {unknown_entries}. -Please check the configuration of the localnet. +Unknown localnet configuration entries: {unknown_entries}. +Please check the configuration of the localnet. For "{self.get_name()}", the allowed entries are: {allowed_entries}.""") raise UnknownConfigurationError(f"Unknown localnet configuration entries: {unknown_entries}") diff --git a/multiversx_sdk_cli/simulation.py b/multiversx_sdk_cli/simulation.py index a6b1bbd4..bd5c41c6 100644 --- a/multiversx_sdk_cli/simulation.py +++ b/multiversx_sdk_cli/simulation.py @@ -1,5 +1,6 @@ from collections import OrderedDict from typing import Any, Dict, Protocol + from multiversx_sdk_cli.interfaces import ISimulateResponse, ITransaction from multiversx_sdk_cli.utils import ISerializable @@ -19,6 +20,7 @@ def to_dictionary(self) -> Dict[str, Any]: return dictionary + class Simulator(): def __init__(self, proxy: INetworkProvider) -> None: self.proxy = proxy diff --git a/multiversx_sdk_cli/tests/local_verify_server.py b/multiversx_sdk_cli/tests/local_verify_server.py index 010177c3..dbc989ab 100644 --- a/multiversx_sdk_cli/tests/local_verify_server.py +++ b/multiversx_sdk_cli/tests/local_verify_server.py @@ -1,5 +1,5 @@ -from http.server import HTTPServer, BaseHTTPRequestHandler import json +from http.server import BaseHTTPRequestHandler, HTTPServer HOST = 'localhost' PORT = 7777 @@ -14,7 +14,7 @@ def do_POST(self): if self.path == "/initialise": response = {'token': 7890} self.wfile.write(bytes(json.dumps(response), 'utf-8')) - + if self.path == "/verify": response = {'status': 'sent to verification'} self.wfile.write(bytes(json.dumps(response), 'utf-8')) diff --git a/multiversx_sdk_cli/validators/__init__.py b/multiversx_sdk_cli/validators/__init__.py index c66ffcba..74a11e54 100644 --- a/multiversx_sdk_cli/validators/__init__.py +++ b/multiversx_sdk_cli/validators/__init__.py @@ -1,16 +1,11 @@ -from multiversx_sdk_cli.validators.core import (prepare_args_for_change_reward_address, - prepare_args_for_claim, - prepare_args_for_stake, - prepare_args_for_unbond, - prepare_args_for_unjail, - prepare_args_for_unstake, - prepare_args_for_unstake_nodes, - prepare_args_for_unstake_tokens, - prepare_args_for_unbond_tokens, - prepare_args_for_unbond_nodes, - prepare_args_for_clean_registered_data, - prepare_args_for_restake_unstaked_nodes) - +from multiversx_sdk_cli.validators.core import ( + prepare_args_for_change_reward_address, prepare_args_for_claim, + prepare_args_for_clean_registered_data, + prepare_args_for_restake_unstaked_nodes, prepare_args_for_stake, + prepare_args_for_unbond, prepare_args_for_unbond_nodes, + prepare_args_for_unbond_tokens, prepare_args_for_unjail, + prepare_args_for_unstake, prepare_args_for_unstake_nodes, + prepare_args_for_unstake_tokens) from multiversx_sdk_cli.validators.validators_file import ValidatorsFile __all__ = ["prepare_args_for_stake", diff --git a/multiversx_sdk_cli/version.py b/multiversx_sdk_cli/version.py index fa7c33f3..df09e4ce 100644 --- a/multiversx_sdk_cli/version.py +++ b/multiversx_sdk_cli/version.py @@ -9,7 +9,7 @@ def get_version() -> str: try: # Works for local development return _get_version_from_pyproject() - except Exception as error: + except Exception: try: # Works for the installed package return _get_version_from_metadata()