Skip to content

Commit e976af1

Browse files
committed
fixes from review
1 parent d85b1d6 commit e976af1

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

src/cool_seq_tool/sources/uta_database.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import logging
2020
import os
2121
import warnings
22-
from collections.abc import AsyncIterator, Mapping, Sequence
22+
from collections.abc import AsyncGenerator, Mapping, Sequence
2323
from contextlib import asynccontextmanager
2424
from typing import Literal
2525
from urllib.parse import ParseResult as UrlLibParseResult
@@ -478,7 +478,7 @@ async def get_tx_exon_aln_data(
478478
]
479479

480480
@staticmethod
481-
def data_from_result(result: TxExonAlnData) -> GenomicTxData | None:
481+
def _process_aln_data(result: TxExonAlnData) -> GenomicTxData | None:
482482
"""Return data found from result.
483483
484484
:param result: Transcript exon alignment data
@@ -543,7 +543,7 @@ async def get_mane_c_genomic_data(
543543
# Sort by most recent chromosomal accession
544544
result = results[-1]
545545

546-
genomic_tx_data = self.data_from_result(result)
546+
genomic_tx_data = self._process_aln_data(result)
547547
if not genomic_tx_data:
548548
return None
549549

@@ -612,7 +612,7 @@ async def get_genomic_tx_data(
612612
else:
613613
result = results[0]
614614

615-
genomic_tx_data = self.data_from_result(result)
615+
genomic_tx_data = self._process_aln_data(result)
616616
if not genomic_tx_data:
617617
return None
618618

@@ -960,7 +960,7 @@ def _get_secret_args() -> str:
960960
return f"postgresql://{username}{':' + password if password else ''}@{host}:{port}/{database}?options=-csearch_path%3D{schema},public"
961961

962962

963-
DEFAULT_UTA_DB_URL = "postgresql://uta_admin@localhost:5432/uta?options=-csearch_path%3Duta_20241220,public"
963+
DEFAULT_UTA_DB_URL = "postgresql://anonymous@localhost:5432/uta?options=-csearch_path%3Duta_20241220,public"
964964

965965

966966
def _normalize_uta_db_url(db_url: str) -> str:
@@ -986,13 +986,7 @@ def _normalize_uta_db_url(db_url: str) -> str:
986986
raise ValueError(msg)
987987

988988
warnings.warn(
989-
(
990-
"UTA DB URLs of the form "
991-
"'postgresql://user:password@host:port/database/schema' are deprecated. "
992-
"Use "
993-
"'postgresql://user:password@host:port/database"
994-
"?options=-csearch_path%3Dschema,public' instead."
995-
),
989+
"UTA DB URLs of the form 'postgresql://user:password@host:port/database/schema' are deprecated. Use 'postgresql://user:password@host:port/database?options=-csearch_path%3Dschema,public' instead.",
996990
DeprecationWarning,
997991
stacklevel=2,
998992
)
@@ -1054,6 +1048,11 @@ async def create_uta_connection_pool(
10541048
pool = AsyncConnectionPool(conninfo=db_url, open=False)
10551049
await pool.open()
10561050
if initialize_genomic_table:
1051+
warnings.warn(
1052+
"Genomic table initialization during connection pool construction is deprecated and subject to deletion in future releases. Users should perform this operation manually using `UtaRepository.create_genomic_table()`.",
1053+
DeprecationWarning,
1054+
stacklevel=2,
1055+
)
10571056
try:
10581057
async with pool.connection() as conn:
10591058
await UtaRepository(conn).create_genomic_table()
@@ -1085,7 +1084,7 @@ def __init__(self, pool: AsyncConnectionPool) -> None:
10851084
self._connection_pool = pool
10861085

10871086
@asynccontextmanager
1088-
async def repository(self) -> AsyncIterator[UtaRepository]:
1087+
async def repository(self) -> AsyncGenerator[UtaRepository]:
10891088
"""Yield a ``UtaRepository`` backed by a pooled connection.
10901089
10911090
If no pool has been provided yet, a default one is created on first use.
@@ -1145,7 +1144,7 @@ async def open(self) -> None:
11451144
self._connection_pool = await create_uta_connection_pool()
11461145

11471146
@asynccontextmanager
1148-
async def repository(self) -> AsyncIterator[UtaRepository]:
1147+
async def repository(self) -> AsyncGenerator[UtaRepository]:
11491148
"""Yield a repository backed by a pooled UTA connection.
11501149
11511150
This method ensures that a connection pool exists, creating one if

0 commit comments

Comments
 (0)