aboutsummaryrefslogtreecommitdiff
path: root/gn3/db/traits.py
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2021-08-31 11:16:29 +0300
committerMuriithi Frederick Muriuki2021-08-31 11:16:29 +0300
commitb5e1d1176f1bf4f7c0b68b27beb15e99418f1650 (patch)
treef158a54b262214ca65394a7dc65a64590533cc0c /gn3/db/traits.py
parente441509a59c20a051fd5ab94710513f1968a5e02 (diff)
downloadgenenetwork3-b5e1d1176f1bf4f7c0b68b27beb15e99418f1650.tar.gz
Fix linting errors, minor bugs and reorganise code
* Fix some linting errors and some minor bugs caught by the linter. Move the `random_string` function to separate module for use in multiple places in the code.
Diffstat (limited to 'gn3/db/traits.py')
-rw-r--r--gn3/db/traits.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/gn3/db/traits.py b/gn3/db/traits.py
index ccb101a..bfe887e 100644
--- a/gn3/db/traits.py
+++ b/gn3/db/traits.py
@@ -1,6 +1,8 @@
"""This class contains functions relating to trait data manipulation"""
-from gn3.settings import TMPDIR
+import os
from typing import Any, Dict, Union, Sequence
+from gn3.settings import TMPDIR
+from gn3.random import random_string
from gn3.function_helpers import compose
from gn3.db.datasets import retrieve_trait_dataset
@@ -669,5 +671,6 @@ def retrieve_trait_data(trait: dict, conn: Any, strainlist: Sequence[str] = tupl
return {}
def generate_traits_filename(base_path: str = TMPDIR):
+ """Generate a unique filename for use with generated traits files."""
return "{}/traits_test_file_{}.txt".format(
os.path.abspath(base_path), random_string(10))