diff --git a/python/python/bystro/api/cli.py b/python/python/bystro/api/cli.py index 3c8c1b45d..b078a5060 100644 --- a/python/python/bystro/api/cli.py +++ b/python/python/bystro/api/cli.py @@ -1,8 +1,5 @@ -#!/usr/bin/env python3 - import argparse import json -from multiprocessing import Value import os import requests @@ -160,7 +157,7 @@ def get_jobs(args: argparse.Namespace, print_result=True): jobs["config"] = json.loads(jobs["config"]) if print_result: - print(f"\nJob(s) fetched successfully: \n") + print("\nJob(s) fetched successfully: \n") print(json.dumps(jobs, indent=4)) print("\n") @@ -185,7 +182,7 @@ def create_job(args: argparse.Namespace, print_result=True): files.append( ( "file", - (os.path.basename(file), open(file, "rb"), "application/octet-stream"), + (os.path.basename(file), open(file, "rb"), "application/octet-stream"), # noqa: SIM115 ) ) @@ -196,11 +193,12 @@ def create_job(args: argparse.Namespace, print_result=True): if response.status_code != 200: raise RuntimeError( - f"Job creation failed with response status: {response.status_code}. Error: \n{response.text}\n" + f"Job creation failed with response status: {response.status_code}.\ + Error: \n{response.text}\n" ) if print_result: - print(f"\nJob creation successful:\n") + print("\nJob creation successful:\n") print(json.dumps(response.json(), indent=4)) print("\n") @@ -219,7 +217,8 @@ def get_user(args, print_result=True): if response.status_code != 200: raise RuntimeError( - f"Fetching profile failed with response status: {response.status_code}. Error: \n{response.text}\n" + f"Fetching profile failed with response status: {response.status_code}.\ + Error: \n{response.text}\n" ) if print_result: diff --git a/python/python/bystro/api/tests/test_cli.py b/python/python/bystro/api/tests/test_cli.py index 4cf0008f4..4a9ad5182 100644 --- a/python/python/bystro/api/tests/test_cli.py +++ b/python/python/bystro/api/tests/test_cli.py @@ -176,7 +176,7 @@ def test_get_job_list(mocker): ), ) mocker.patch( - "requests.get", return_value=mocker.Mock(status_code=200, json=lambda: []) + "requests.get", return_value=mocker.Mock(status_code=200, json=lambda: []) # noqa: PIE807 ) args = SimpleNamespace(dir="./", type="completed", id=None) diff --git a/python/requirements-dev.txt b/python/requirements-dev.txt index ad72d66f7..691868af7 100644 --- a/python/requirements-dev.txt +++ b/python/requirements-dev.txt @@ -4,5 +4,7 @@ mypy==1.3.0 pandas-stubs==2.0.2.230605 pytest==7.3.1 pytest-cov==4.1.0 +pytest-mock==3.11.1 ruff==0.0.270 types-tqdm==4.65.0.1 +types-requests==2.31.0.2 \ No newline at end of file