Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
elewis2 committed Jul 18, 2024
1 parent a44ec03 commit aabd8bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
12 changes: 3 additions & 9 deletions pori_python/ipr/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ def upload_report(
def check_status_result(result):
if result.get("report", False):
return "upload complete"
if result.get("jobStatus", False) and result["jobStatus"].get(
"state", False
):
if result.get("jobStatus", False) and result["jobStatus"].get("state", False):
return result["jobStatus"]["state"]
raise Exception(
f"async report get returned with no report or jobStatus, or unexpected jobStatus type"
Expand Down Expand Up @@ -157,9 +155,7 @@ def set_analyst_comments(self, report_id: str, data: Dict) -> Dict:
data=zlib.compress(json.dumps(data, allow_nan=False).encode("utf-8")),
)

def post_images(
self, report_id: str, files: Dict[str, str], data: Dict[str, str] = {}
) -> None:
def post_images(self, report_id: str, files: Dict[str, str], data: Dict[str, str] = {}) -> None:
"""
Post images to the report
"""
Expand Down Expand Up @@ -190,9 +186,7 @@ def post_images(
handler.close()
start_index += IMAGE_MAX
if image_errors:
raise ValueError(
f'Error uploading images ({", ".join(sorted(list(image_errors)))})'
)
raise ValueError(f'Error uploading images ({", ".join(sorted(list(image_errors)))})')

def get_spec(self) -> Dict:
"""
Expand Down
26 changes: 11 additions & 15 deletions tests/test_ipr/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,23 @@ def loaded_report(tmp_path_factory) -> Dict:
"patientId": patient_id,
"project": "TEST",
"expressionVariants": json.loads(
pd.read_csv(
get_test_file("expression.short.tab"), sep="\t"
).to_json(orient="records")
pd.read_csv(get_test_file("expression.short.tab"), sep="\t").to_json(
orient="records"
)
),
"smallMutations": json.loads(
pd.read_csv(
get_test_file("small_mutations.short.tab"), sep="\t"
).to_json(orient="records")
pd.read_csv(get_test_file("small_mutations.short.tab"), sep="\t").to_json(
orient="records"
)
),
"copyVariants": json.loads(
pd.read_csv(
get_test_file("copy_variants.short.tab"), sep="\t"
).to_json(orient="records")
),
"structuralVariants": json.loads(
pd.read_csv(get_test_file("fusions.tab"), sep="\t").to_json(
pd.read_csv(get_test_file("copy_variants.short.tab"), sep="\t").to_json(
orient="records"
)
),
"structuralVariants": json.loads(
pd.read_csv(get_test_file("fusions.tab"), sep="\t").to_json(orient="records")
),
"kbDiseaseMatch": "colorectal cancer",
},
allow_nan=False,
Expand Down Expand Up @@ -117,9 +115,7 @@ def get_section(loaded_report, section_name):
@pytest.mark.skipif(
not INCLUDE_UPLOAD_TESTS, reason="excluding tests of upload to live ipr instance"
)
@pytest.mark.skipif(
EXCLUDE_INTEGRATION_TESTS, reason="excluding long running integration tests"
)
@pytest.mark.skipif(EXCLUDE_INTEGRATION_TESTS, reason="excluding long running integration tests")
class TestCreateReport:
def test_patient_id_loaded_once(self, loaded_report: Tuple) -> None:
patient_id = loaded_report[0]
Expand Down

0 comments on commit aabd8bb

Please sign in to comment.