Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed Nov 2, 2023
1 parent 41a427b commit 8d30f0c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
4 changes: 1 addition & 3 deletions bbconf/__init__.py
Original file line number Diff line number Diff line change
@@ -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"]
15 changes: 6 additions & 9 deletions bbconf/bbconf.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand All @@ -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

Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions bbconf/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_bbconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:[email protected]:5432/pipestat-test"
Expand All @@ -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
Expand Down

0 comments on commit 8d30f0c

Please sign in to comment.