From db8fb57d9e1c6962b7653213b44e784c84446c21 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Thu, 29 Aug 2024 22:37:20 +0300 Subject: Add missing doc-strings to make pylint pass. Signed-off-by: Munyoki Kilyungi --- gn3/db/wiki.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'gn3/db') 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) -- cgit v1.2.3