From c3bbbec5415f9f0d9e1671691ba296a8fb1f5339 Mon Sep 17 00:00:00 2001 From: Martin Kourim Date: Thu, 13 Jan 2022 21:45:22 +0100 Subject: [PATCH] Implicit split by any whitespace --- cardano_node_tests/cardano_cli_coverage.py | 4 ++-- cardano_node_tests/tests/test_metrics.py | 2 +- cardano_node_tests/utils/cluster_management.py | 2 +- cardano_node_tests/utils/clusterlib_utils.py | 6 +++--- cardano_node_tests/utils/helpers.py | 2 +- cardano_node_tests/utils/versions.py | 8 ++++---- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cardano_node_tests/cardano_cli_coverage.py b/cardano_node_tests/cardano_cli_coverage.py index bb5ee652e..cb0e88f20 100755 --- a/cardano_node_tests/cardano_cli_coverage.py +++ b/cardano_node_tests/cardano_cli_coverage.py @@ -125,7 +125,7 @@ def parse_cmd_output(output: str) -> List[str]: line = line.strip() if not line: continue - item = line.split(" ")[0] + item = line.split()[0] cli_args.append(item) return cli_args @@ -154,7 +154,7 @@ def get_log_coverage(log_file: Path) -> dict: for line in infile: if not line.startswith("cardano-cli"): continue - clusterlib.record_cli_coverage(cli_args=line.split(" "), coverage_dict=coverage_dict) + clusterlib.record_cli_coverage(cli_args=line.split(), coverage_dict=coverage_dict) return coverage_dict diff --git a/cardano_node_tests/tests/test_metrics.py b/cardano_node_tests/tests/test_metrics.py index b690975b8..c0e111536 100644 --- a/cardano_node_tests/tests/test_metrics.py +++ b/cardano_node_tests/tests/test_metrics.py @@ -141,7 +141,7 @@ def test_available_metrics( response = get_prometheus_metrics(prometheus_port) metrics = response.text.strip().split("\n") - metrics_keys = sorted(m.split(" ")[0] for m in metrics) + metrics_keys = sorted(m.split()[0] for m in metrics) assert metrics_keys == self.EXPECTED_METRICS, "Metrics differ" diff --git a/cardano_node_tests/utils/cluster_management.py b/cardano_node_tests/utils/cluster_management.py index 2fc2bcf34..1c1a85662 100644 --- a/cardano_node_tests/utils/cluster_management.py +++ b/cardano_node_tests/utils/cluster_management.py @@ -89,7 +89,7 @@ def _kill_supervisor(instance_num: int) -> None: if port_str not in line: continue line = line.replace(" ", " ").strip() - pid = line.split(" ")[-1].split("/")[0] + pid = line.split()[-1].split("/")[0] os.kill(int(pid), 15) return diff --git a/cardano_node_tests/utils/clusterlib_utils.py b/cardano_node_tests/utils/clusterlib_utils.py index 00b282d2d..6c22654b7 100644 --- a/cardano_node_tests/utils/clusterlib_utils.py +++ b/cardano_node_tests/utils/clusterlib_utils.py @@ -894,7 +894,7 @@ def _load_coins_data(coins_data: Union[dict, str]) -> List[Tuple[int, str]]: amount_lovelace = coins_data.get(clusterlib.DEFAULT_COIN) # type: ignore policies_data: dict = coins_data # type: ignore except AttributeError: - amount_lovelace = int(coins_data.split(" ")[0] or 0) # type: ignore + amount_lovelace = int(coins_data.split()[0] or 0) # type: ignore policies_data = {} loaded_data = [] @@ -936,7 +936,7 @@ def check_tx_view( # noqa: C901 raise AssertionError(f"txouts: {tx_raw_txouts} not in {loaded_txouts}") # check fee - fee = int(tx_loaded.get("fee", "").split(" ")[0] or 0) + fee = int(tx_loaded.get("fee", "").split()[0] or 0) # pylint: disable=consider-using-in if ( tx_raw_output.fee != -1 and tx_raw_output.fee != fee @@ -973,7 +973,7 @@ def check_tx_view( # noqa: C901 if tx_loaded_withdrawals: for withdrawal in tx_loaded_withdrawals: withdrawal_key = withdrawal["credential"]["key hash"] - withdrawal_amount = int(withdrawal["amount"].split(" ")[0] or 0) + withdrawal_amount = int(withdrawal["amount"].split()[0] or 0) loaded_withdrawals.add((withdrawal_key, withdrawal_amount)) tx_raw_withdrawals = { diff --git a/cardano_node_tests/utils/helpers.py b/cardano_node_tests/utils/helpers.py index 2e81b871d..91d87f031 100644 --- a/cardano_node_tests/utils/helpers.py +++ b/cardano_node_tests/utils/helpers.py @@ -91,7 +91,7 @@ def run_command(command: Union[str, list], workdir: FileType = "", shell: bool = """Run command.""" cmd: Union[str, list] if isinstance(command, str): - cmd = command if shell else command.split(" ") + cmd = command if shell else command.split() else: cmd = command diff --git a/cardano_node_tests/utils/versions.py b/cardano_node_tests/utils/versions.py index abd97e3ca..d0f0025ef 100644 --- a/cardano_node_tests/utils/versions.py +++ b/cardano_node_tests/utils/versions.py @@ -45,10 +45,10 @@ def get_cardano_version(self) -> dict: env_info, git_info, *__ = out.splitlines() node, platform, ghc, *__ = env_info.split(" - ") version_db = { - "version": node.split(" ")[-1], + "version": node.split()[-1], "platform": platform, "ghc": ghc, - "git_rev": git_info.split(" ")[-1], + "git_rev": git_info.split()[-1], } return version_db @@ -58,10 +58,10 @@ def get_dbsync_version(self) -> dict: env_info, git_info, *__ = out.splitlines() dbsync, platform, ghc, *__ = env_info.split(" - ") version_db = { - "version": dbsync.split(" ")[-1], + "version": dbsync.split()[-1], "platform": platform, "ghc": ghc, - "git_rev": git_info.split(" ")[-1], + "git_rev": git_info.split()[-1], } return version_db