aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gn3/api/gemma.py1
-rw-r--r--gn3/api/metadata_api/wiki.py2
-rw-r--r--gn3/api/rqtl.py1
-rw-r--r--gn3/app.py1
-rw-r--r--gn3/computations/gemma.py4
-rw-r--r--gn3/computations/rqtl.py2
-rw-r--r--gn3/debug.py4
-rw-r--r--gn3/fs_helpers.py15
8 files changed, 16 insertions, 14 deletions
diff --git a/gn3/api/gemma.py b/gn3/api/gemma.py
index 2dd53ea..abe772c 100644
--- a/gn3/api/gemma.py
+++ b/gn3/api/gemma.py
@@ -12,7 +12,6 @@ from gn3.commands import run_cmd
from gn3.fs_helpers import cache_ipfs_file
from gn3.fs_helpers import jsonfile_to_dict, assert_paths_exist
from gn3.computations.gemma import generate_gemma_cmd
-from gn3.computations.gemma import assert_paths_exist
gemma = Blueprint("gemma", __name__)
diff --git a/gn3/api/metadata_api/wiki.py b/gn3/api/metadata_api/wiki.py
index 9ea0d53..6436f3d 100644
--- a/gn3/api/metadata_api/wiki.py
+++ b/gn3/api/metadata_api/wiki.py
@@ -5,7 +5,6 @@ from typing import Any, Dict
from flask import Blueprint, request, jsonify, current_app, make_response
from gn3 import db_utils
from gn3.db import wiki
-from gn3.db.rdf import query_frame_and_compact
from gn3.db.rdf.wiki import (get_wiki_entries_by_symbol,
get_comment_history)
@@ -121,6 +120,7 @@ def get_species():
@wiki_blueprint.route("/<int:comment_id>/history", methods=["GET"])
def get_history(comment_id):
+ """Fetch all of a given comment's history given it's comment id"""
status_code = 200
response = get_comment_history(comment_id=comment_id,
sparql_uri=current_app.config["SPARQL_ENDPOINT"])
diff --git a/gn3/api/rqtl.py b/gn3/api/rqtl.py
index 68299d4..c2d988a 100644
--- a/gn3/api/rqtl.py
+++ b/gn3/api/rqtl.py
@@ -6,7 +6,6 @@ from flask import current_app
from flask import jsonify
from flask import request
-from gn3.debug import __pk__
from gn3.computations.rqtl import generate_rqtl_cmd, process_rqtl_mapping, \
process_rqtl_pairscan, process_perm_output
from gn3.fs_helpers import assert_paths_exist, get_tmpdir
diff --git a/gn3/app.py b/gn3/app.py
index d7fcbea..c8f0c5a 100644
--- a/gn3/app.py
+++ b/gn3/app.py
@@ -28,7 +28,6 @@ from gn3.api.sampledata import sampledata
from gn3.api.llm import gnqa
from gn3.auth import oauth2
from gn3.case_attributes import caseattr
-from gn3.fs_helpers import get_tmpdir
def create_app(config: Union[Dict, str, None] = None) -> Flask:
diff --git a/gn3/computations/gemma.py b/gn3/computations/gemma.py
index 577d8e8..6c53ecc 100644
--- a/gn3/computations/gemma.py
+++ b/gn3/computations/gemma.py
@@ -1,14 +1,12 @@
"""Procedures related gemma computations"""
-import errno
import os
from base64 import b64encode
from hashlib import md5
from typing import Optional, Dict
from typing import List
-from typing import ValuesView
from gn3.commands import compose_gemma_cmd
-from gn3.fs_helpers import get_hash_of_files, assert_paths_exist
+from gn3.fs_helpers import get_hash_of_files
def generate_hash_of_string(unhashed_str: str) -> str:
diff --git a/gn3/computations/rqtl.py b/gn3/computations/rqtl.py
index 0b8c23d..16f1398 100644
--- a/gn3/computations/rqtl.py
+++ b/gn3/computations/rqtl.py
@@ -1,7 +1,5 @@
"""Procedures related to R/qtl computations"""
import os
-import sys
-import logging
from bisect import bisect
from typing import Dict, List, Tuple, Union
diff --git a/gn3/debug.py b/gn3/debug.py
index 945e237..8b67a92 100644
--- a/gn3/debug.py
+++ b/gn3/debug.py
@@ -4,13 +4,17 @@ from flask import current_app
__this_module_name__ = __name__
+
+# pylint: disable=invalid-name
def getLogger():
+ """Return a logger"""
return (
logging.getLogger(__this_module_name__)
if not bool(current_app)
else current_app.logger)
def __pk__(*args):
+ """Format log entry"""
value = args[-1]
title_vals = " => ".join(args[0:-1])
logger = getLogger()
diff --git a/gn3/fs_helpers.py b/gn3/fs_helpers.py
index 1b226bc..2ce381e 100644
--- a/gn3/fs_helpers.py
+++ b/gn3/fs_helpers.py
@@ -16,14 +16,20 @@ from werkzeug.utils import secure_filename
from flask import current_app
def get_tmpdir() -> str:
- """Get the temp directory from the FLASK tmpdir setting. If it is not set, set it to /tmp. Note
- that the app should check for environment settings to initialize its TMPDIR.
+ """Get the temp directory from the FLASK tmpdir setting. If it is
+ not set, set it to /tmp. Note that the app should check for
+ environment settings to initialize its TMPDIR.
+
"""
tmpdir = current_app.config.get("TMPDIR")
if not tmpdir:
tmpdir = "/tmp"
if not os.path.isdir(tmpdir):
- raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), f"TMPDIR {tmpdir} is not a valid directory")
+ raise FileNotFoundError(
+ errno.ENOENT,
+ os.strerror(errno.ENOENT),
+ f"TMPDIR {tmpdir} is not a valid directory"
+ )
return tmpdir
@@ -32,8 +38,7 @@ def assert_path_exists(path: str, throw_error: bool = True) -> bool:
if not os.path.isfile(path):
if throw_error:
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), path)
- else:
- return False
+ return False
return True
def assert_paths_exist(paths: ValuesView, throw_error: bool = True) -> bool: