Skip to content

Commit

Permalink
Merge pull request #873 from mkoura/split_whitespace
Browse files Browse the repository at this point in the history
Implicit split by any whitespace
  • Loading branch information
mkoura committed Jan 14, 2022
2 parents 3dfe9c4 + c3bbbec commit ccbda95
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions cardano_node_tests/cardano_cli_coverage.py
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_metrics.py
Expand Up @@ -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"


Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/utils/cluster_management.py
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions cardano_node_tests/utils/clusterlib_utils.py
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/utils/helpers.py
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions cardano_node_tests/utils/versions.py
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit ccbda95

Please sign in to comment.