Skip to content

Commit

Permalink
add missing deps, fix liniting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
akotlar committed Aug 15, 2023
1 parent a389303 commit 205dcb5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
15 changes: 7 additions & 8 deletions python/python/bystro/api/cli.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/usr/bin/env python3

import argparse
import json
from multiprocessing import Value
import os

import requests
Expand Down Expand Up @@ -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")

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

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

Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion python/python/bystro/api/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions python/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 205dcb5

Please sign in to comment.