From 5030a2426e2f3676aafecc242648803f32afd74c Mon Sep 17 00:00:00 2001 From: KatHellg Date: Tue, 26 Nov 2024 15:07:36 +0100 Subject: [PATCH] ruff linting fix --- fedn/cli/login_cmd.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/fedn/cli/login_cmd.py b/fedn/cli/login_cmd.py index 8ba406600..e40012eb4 100644 --- a/fedn/cli/login_cmd.py +++ b/fedn/cli/login_cmd.py @@ -1,10 +1,11 @@ import os -import yaml +from getpass import getpass + import click import requests +import yaml from .main import main -from getpass import getpass # Replace this with the platform's actual login endpoint home_dir = os.path.expanduser("~") @@ -22,9 +23,7 @@ def login_cmd(ctx): @login_cmd.command("login") @click.pass_context def login_cmd(ctx): - """Logging into FEDn Studio - - """ + """Logging into FEDn Studio""" # Step 1: Display welcome message click.secho("Welcome to Scaleout FEDn!", fg="green") @@ -41,11 +40,7 @@ def login_cmd(ctx): # Call the authentication API try: - response = requests.post( - URL, - json={"username": username, "password": password}, - headers={"Content-Type": "application/json"} - ) + response = requests.post(URL, json={"username": username, "password": password}, headers={"Content-Type": "application/json"}) response.raise_for_status() # Raise an error for HTTP codes 4xx/5xx except requests.exceptions.RequestException as e: click.secho("Error connecting to the platform. Please try again.", fg="red") @@ -62,7 +57,7 @@ def login_cmd(ctx): os.makedirs(context_path) try: with open(f"{context_path}/context.yaml", "w") as yaml_file: - yaml.dump(data, yaml_file, default_flow_style=False) # Add access and refresh tokens to context yaml file + yaml.dump(data, yaml_file, default_flow_style=False) # Add access and refresh tokens to context yaml file except Exception as e: print(f"Error: Failed to write to YAML file. Details: {e}") else: