From 131e045792ce897a7ef050fe27a1ba8a7a00b00d Mon Sep 17 00:00:00 2001 From: KatHellg Date: Mon, 11 Nov 2024 13:12:19 +0100 Subject: [PATCH] minor code fix --- fedn/cli/model_cmd.py | 7 +++---- fedn/cli/round_cmd.py | 7 +++---- fedn/cli/status_cmd.py | 7 +++---- fedn/cli/validation_cmd.py | 7 +++---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/fedn/cli/model_cmd.py b/fedn/cli/model_cmd.py index a1f2a2343..c3b2d587b 100644 --- a/fedn/cli/model_cmd.py +++ b/fedn/cli/model_cmd.py @@ -67,10 +67,9 @@ def list_models(ctx, protocol: str, host: str, port: str, token: str = None, id: click.echo(f'Error: {json_data["message"]}') else: click.echo(f"Error: {response.status_code}") + elif id: + print_response(response, "model", True, session_id) else: - if id: - print_response(response, "model", True, session_id) - else: - print_response(response, "models", False, session_id) + print_response(response, "models", False, session_id) except requests.exceptions.ConnectionError: click.echo(f"Error: Could not connect to {url}") diff --git a/fedn/cli/round_cmd.py b/fedn/cli/round_cmd.py index dc9b66be5..68364202c 100644 --- a/fedn/cli/round_cmd.py +++ b/fedn/cli/round_cmd.py @@ -66,11 +66,10 @@ def list_rounds(ctx, protocol: str, host: str, port: str, token: str = None, id: click.echo(f'Error: {json_data["message"]}') else: click.echo(f"Error: {response.status_code}") + elif id: + print_response(response, "round", True, session_id) else: - if id: - print_response(response, "round", True, session_id) - else: - print_response(response, "rounds", False, session_id) + print_response(response, "rounds", False, session_id) except requests.exceptions.ConnectionError: diff --git a/fedn/cli/status_cmd.py b/fedn/cli/status_cmd.py index 47acdf940..01f7c497a 100644 --- a/fedn/cli/status_cmd.py +++ b/fedn/cli/status_cmd.py @@ -66,10 +66,9 @@ def list_statuses(ctx, protocol: str, host: str, port: str, token: str = None, i click.echo(f'Error: {json_data["message"]}') else: click.echo(f"Error: {response.status_code}") + elif id: + print_response(response, "status", True) else: - if id: - print_response(response, "status", True) - else: - print_response(response, "statuses", False) + print_response(response, "statuses", False) except requests.exceptions.ConnectionError: click.echo(f"Error: Could not connect to {url}") diff --git a/fedn/cli/validation_cmd.py b/fedn/cli/validation_cmd.py index b8b29b4c4..1dc68c311 100644 --- a/fedn/cli/validation_cmd.py +++ b/fedn/cli/validation_cmd.py @@ -67,10 +67,9 @@ def list_validations(ctx, protocol: str, host: str, port: str, token: str = None click.echo(f'Error: {json_data["message"]}') else: click.echo(f"Error: {response.status_code}") + elif id: + print_response(response, "validation", True) else: - if id: - print_response(response, "validation", True) - else: - print_response(response, "validations", False) + print_response(response, "validations", False) except requests.exceptions.ConnectionError: click.echo(f"Error: Could not connect to {url}")