aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-08-29 22:37:20 +0300
committerBonfaceKilz2024-09-05 16:39:14 +0300
commitdb8fb57d9e1c6962b7653213b44e784c84446c21 (patch)
tree78b3f10781aabae23cdac2941984f155b7e04e97
parentea1880d48734b271172497fc205ba7f28706ba2a (diff)
downloadgenenetwork3-db8fb57d9e1c6962b7653213b44e784c84446c21.tar.gz
Add missing doc-strings to make pylint pass.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r--gn3/db/wiki.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/gn3/db/wiki.py b/gn3/db/wiki.py
index abb1644..7c58459 100644
--- a/gn3/db/wiki.py
+++ b/gn3/db/wiki.py
@@ -36,7 +36,8 @@ def get_latest_comment(connection, comment_id: str) -> int:
def get_species_id(cursor, species_name: str) -> int:
"""Find species id given species `Name`"""
- cursor.execute("SELECT SpeciesID from Species WHERE Name = %s", (species_name,))
+ cursor.execute(
+ "SELECT SpeciesID from Species WHERE Name = %s", (species_name,))
species_ids = cursor.fetchall()
if len(species_ids) != 1:
raise MissingDBDataException(
@@ -52,7 +53,8 @@ def get_next_comment_version(cursor, comment_id: int) -> int:
)
latest_version = cursor.fetchone()[0]
if latest_version is None:
- raise MissingDBDataException(f"No comment found with comment_id={comment_id}")
+ raise MissingDBDataException(
+ f"No comment found with comment_id={comment_id}")
return latest_version + 1
@@ -63,17 +65,22 @@ def get_categories_ids(cursor, categories: List[str]) -> List[int]:
for category in set(categories):
cat_id = dict_cats.get(category.strip())
if cat_id is None:
- raise MissingDBDataException(f"Category with Name={category} not found")
+ raise MissingDBDataException(
+ f"Category with Name={category} not found")
category_ids.append(cat_id)
return category_ids
+
def get_categories(cursor) -> Dict[str, int]:
+ """Get all categories"""
cursor.execute("SELECT Name, Id from GeneCategory")
raw_categories = cursor.fetchall()
dict_cats = dict(raw_categories)
return dict_cats
+
def get_species(cursor) -> Dict[str, str]:
+ """Get all species"""
cursor.execute("SELECT Name, SpeciesName from Species")
raw_species = cursor.fetchall()
dict_cats = dict(raw_species)