Skip to content

Commit

Permalink
Merge pull request #12 from bcgsc/improvement/lint_typing
Browse files Browse the repository at this point in the history
Improvement/lint typing
  • Loading branch information
elewis2 authored Jul 19, 2024
2 parents 48e151f + 6e41f96 commit b9a1eb5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pori_python/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import graphkb, ipr
from . import graphkb, ipr # noqa: F401
12 changes: 4 additions & 8 deletions pori_python/graphkb/genes.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,9 @@ def get_preferred_gene_name(
def get_cancer_predisposition_info(
conn: GraphKBConnection, source: str = PREFERRED_GENE_SOURCE
) -> Tuple[List[str], Dict[str, str]]:
newval = get_gene_linked_cancer_predisposition_info(conn, source)
genes = newval[0]
allvardata = newval[1]
genes, allvardata = get_gene_linked_cancer_predisposition_info(conn, source)
variants = {key: allvardata[key][0] for key in allvardata.keys()}
return newval[0], variants
return genes, variants


def get_gene_linked_cancer_predisposition_info(
Expand Down Expand Up @@ -322,11 +320,9 @@ def get_gene_linked_cancer_predisposition_info(
def get_pharmacogenomic_info(
conn: GraphKBConnection, source: str = PREFERRED_GENE_SOURCE
) -> Tuple[List[str], Dict[str, str]]:
newval = get_gene_linked_pharmacogenomic_info(conn, source)
genes = newval[0]
allvardata = newval[1]
genes, allvardata = get_gene_linked_pharmacogenomic_info(conn, source)
variants = {key: allvardata[key][0] for key in allvardata.keys()}
return newval[0], variants
return genes, variants


def get_gene_linked_pharmacogenomic_info(
Expand Down
2 changes: 1 addition & 1 deletion pori_python/graphkb/util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry

import hashlib
import json
Expand All @@ -9,6 +8,7 @@
import time
from datetime import datetime
from typing import Any, Dict, Iterable, List, Optional, Union, cast
from urllib3.util.retry import Retry

from .constants import DEFAULT_LIMIT, DEFAULT_URL, TYPES_TO_NOTATION, AA_3to1_MAPPING
from .types import OntologyTerm, ParsedVariant, PositionalVariant, Record
Expand Down
2 changes: 1 addition & 1 deletion pori_python/ipr/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def ipr_report(
if ipr_upload:
try:
logger.info(f"Uploading to IPR {ipr_conn.url}")
ipr_result = ipr_conn.upload_report(output, async_upload, mins_to_wait)
ipr_result = ipr_conn.upload_report(output, mins_to_wait, async_upload)
logger.info(ipr_result)
output.update(ipr_result)
except Exception as err:
Expand Down
13 changes: 8 additions & 5 deletions tests/test_graphkb/test_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
import pytest
from unittest.mock import Mock

from pori_python.graphkb import statement

from .test_match import ( # noqa - 'F401 imported but unused' is being fooled by pytest conventions
conn,
)
from pori_python.graphkb import GraphKBConnection, statement

EXCLUDE_INTEGRATION_TESTS = os.environ.get("EXCLUDE_INTEGRATION_TESTS") == "1"


@pytest.fixture(scope="module")
def conn() -> GraphKBConnection:
conn = GraphKBConnection()
conn.login(os.environ["GRAPHKB_USER"], os.environ["GRAPHKB_PASS"])
return conn


@pytest.fixture()
def graphkb_conn():
def make_rid_list(*values):
Expand Down

0 comments on commit b9a1eb5

Please sign in to comment.