diff --git a/bbconf/__init__.py b/bbconf/__init__.py index 153392c..6717196 100644 --- a/bbconf/__init__.py +++ b/bbconf/__init__.py @@ -1,5 +1,3 @@ -from bbconf._version import __version__ -from bbconf.bbconf import * -from bbconf.const import * +from bbconf.bbconf import BedBaseConf, get_bedbase_cfg __all__ = ["BedBaseConf", "get_bedbase_cfg"] diff --git a/bbconf/bbconf.py b/bbconf/bbconf.py index cb2645e..5e325cd 100644 --- a/bbconf/bbconf.py +++ b/bbconf/bbconf.py @@ -1,13 +1,11 @@ import os from logging import getLogger -from typing import List, Optional, Tuple, Union, Dict +from typing import List, Optional, Tuple, Union from textwrap import indent import yacman - import pipestat - from sqlmodel import SQLModel, Field, select import qdrant_client @@ -16,7 +14,6 @@ from bbconf.const import ( CFG_PATH_KEY, - PKG_NAME, CFG_PATH_PIPELINE_OUTPUT_KEY, CFG_PATH_BEDSTAT_DIR_KEY, DEFAULT_SECTION_VALUES, @@ -157,7 +154,7 @@ def _read_config_file(self, config_path: str) -> yacman.YAMLConfigManager: _config[section][key] = default if CFG_PATH_REGION2VEC_KEY not in _config[CFG_PATH_KEY]: - _LOGGER.warning(f"Region2vec config key is missing in configuration file") + _LOGGER.warning("Region2vec config key is missing in configuration file") _config[CFG_PATH_KEY][CFG_PATH_REGION2VEC_KEY] = None return _config @@ -183,7 +180,7 @@ def search_bed_by_text( """ if self._t2bsi is None: raise BedBaseConfError( - f"Can't perform search, qdrant_db credentials are not provided in config file" + "Can't perform search, qdrant_db credentials are not provided in config file" ) return self._t2bsi.nl_vec_search(query) @@ -199,7 +196,7 @@ def __str__(self): res += f"{indent(str(self.bed), ' ')}" res += f"\n{BEDSET_TABLE}:\n" res += f"{indent(str(self.bedset), ' ')}" - res += f"\nconfig:\n" + res += "\nconfig:\n" res += f"{indent(str(self.config), ' ')}" return res @@ -453,10 +450,10 @@ def select_unique(self, table_name: str, column: str = None) -> list: """ if table_name == "bedfile__sample": - with self.bed.backend.session as s: + with self.bed.backend.session: values = self.bed.backend.select(columns=column) elif table_name == "bedsets__sample": - with self.bedset.backend.session as s: + with self.bedset.backend.session: values = self.bedset.backend.select(columns=column) else: raise pipestat.exceptions.SchemaError( diff --git a/bbconf/helpers.py b/bbconf/helpers.py index e07bf23..f6ab3b1 100644 --- a/bbconf/helpers.py +++ b/bbconf/helpers.py @@ -2,8 +2,8 @@ from yacman.yacman1 import select_config -from .const import * -from .exceptions import * +from .const import CFG_ENV_VARS +from .exceptions import MissingConfigDataError, BedBaseConnectionError from typing import NoReturn _LOGGER = logging.getLogger(__name__) diff --git a/tests/test_bbconf.py b/tests/test_bbconf.py index 71700eb..3f71f72 100644 --- a/tests/test_bbconf.py +++ b/tests/test_bbconf.py @@ -9,7 +9,7 @@ import warnings from bbconf import BedBaseConf, get_bedbase_cfg -from bbconf.exceptions import * +from bbconf.exceptions import MissingConfigDataError DB_URL = "postgresql+psycopg2://postgres:dockerpassword@127.0.0.1:5432/pipestat-test" @@ -21,7 +21,7 @@ def db_setup(): # Check if the database is setup try: BedBaseConf(os.path.join(DATA_PATH, "config.yaml")) - except Exception as err: + except Exception: warnings.warn(UserWarning(f"{pytest_db_skip_reason}")) return False return True