Skip to content

Commit

Permalink
minor code fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KatHellg committed Nov 11, 2024
1 parent 035f652 commit 131e045
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
7 changes: 3 additions & 4 deletions fedn/cli/model_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
7 changes: 3 additions & 4 deletions fedn/cli/round_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 3 additions & 4 deletions fedn/cli/status_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
7 changes: 3 additions & 4 deletions fedn/cli/validation_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

0 comments on commit 131e045

Please sign in to comment.