diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1497d9c5..e34bc3b9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,9 +12,9 @@ repos: - id: mixed-line-ending args: [ --fix=lf ] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.12.1 hooks: - id: ruff-format - id: ruff args: [ --fix, --exit-non-zero-on-fix ] -minimum_pre_commit_version: 4.0.1 +minimum_pre_commit_version: 4.2.0 diff --git a/pyproject.toml b/pyproject.toml index 1d488cff..983a4ad7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,11 +40,11 @@ dynamic = ["version"] [project.optional-dependencies] dev = [ - "pre-commit>=4.0.1", + "pre-commit>=4.2.0", "ipython", "ipykernel", "psycopg2-binary", - "ruff==0.8.6" + "ruff==0.12.1", ] tests = ["pytest", "pytest-cov", "pytest-asyncio==0.18.3", "mock"] docs = [ diff --git a/src/cool_seq_tool/handlers/seqrepo_access.py b/src/cool_seq_tool/handlers/seqrepo_access.py index 2161a9ef..76a8fb08 100644 --- a/src/cool_seq_tool/handlers/seqrepo_access.py +++ b/src/cool_seq_tool/handlers/seqrepo_access.py @@ -75,9 +75,7 @@ def get_reference_sequence( f"Start inter-residue coordinate ({start}) is out of index on {ac}" ) elif error.startswith("stop out of range"): - msg = ( - f"End inter-residue coordinate ({end}) is out of " f"index on {ac}" - ) + msg = f"End inter-residue coordinate ({end}) is out of index on {ac}" else: msg = f"{e}" _logger.warning(msg) diff --git a/src/cool_seq_tool/mappers/exon_genomic_coords.py b/src/cool_seq_tool/mappers/exon_genomic_coords.py index 78084d7b..33ccd65f 100644 --- a/src/cool_seq_tool/mappers/exon_genomic_coords.py +++ b/src/cool_seq_tool/mappers/exon_genomic_coords.py @@ -776,7 +776,7 @@ async def _genomic_to_tx_segment( GRCh38 by default. Will attempt to liftover if starting assembly is GRCh37 :return: Data for a transcript segment boundary (inter-residue coordinates) """ - params = {key: None for key in GenomicTxSeg.model_fields} + params = dict.fromkeys(GenomicTxSeg.model_fields) # Validate inputs exist in UTA if gene: diff --git a/src/cool_seq_tool/mappers/mane_transcript.py b/src/cool_seq_tool/mappers/mane_transcript.py index 70975474..ab1f236f 100644 --- a/src/cool_seq_tool/mappers/mane_transcript.py +++ b/src/cool_seq_tool/mappers/mane_transcript.py @@ -268,7 +268,7 @@ async def _liftover_to_38(self, genomic_tx_data: GenomicTxMetadata) -> None: query = f""" SELECT alt_ac FROM {self.uta_db.schema}.genomic - WHERE alt_ac LIKE '{genomic_tx_data.alt_ac.split('.')[0]}%' + WHERE alt_ac LIKE '{genomic_tx_data.alt_ac.split(".")[0]}%' {order_by_cond} """ # noqa: S608 nc_acs = await self.uta_db.execute_query(query) diff --git a/src/cool_seq_tool/sources/uta_database.py b/src/cool_seq_tool/sources/uta_database.py index 9753fcb3..35fc8736 100644 --- a/src/cool_seq_tool/sources/uta_database.py +++ b/src/cool_seq_tool/sources/uta_database.py @@ -221,7 +221,7 @@ async def _create_genomic_table(self) -> None: WHERE table_schema = '{self.schema}' AND table_name = 'genomic' ); - """ + """ # noqa: S608 genomic_table_exists = await self.execute_query(check_table_exists) genomic_table_exists = genomic_table_exists[0].get("exists") if genomic_table_exists is None: @@ -250,7 +250,7 @@ async def _create_genomic_table(self) -> None: LEFT JOIN {self.schema}.exon_aln ea ON (((te.exon_id = ea.tx_exon_id) AND (ae.exon_id = ea.alt_exon_id)))); - """ + """ # noqa: S608 await self.execute_query(create_genomic_table) indexes = [ @@ -325,13 +325,13 @@ async def get_cds_start_end(self, tx_ac: str) -> tuple[int, int] | None: cds_start_end = await self.execute_query(query) if cds_start_end: cds_start_end = cds_start_end[0] - if cds_start_end[0] is not None and cds_start_end[1] is not None: # noqa: RET503 + if cds_start_end[0] is not None and cds_start_end[1] is not None: return cds_start_end[0], cds_start_end[1] else: _logger.warning( "Unable to get coding start/end site for accession: %s", tx_ac ) - return None + return None async def get_newest_assembly_ac(self, ac: str) -> list[str]: """Find accession associated to latest genomic assembly @@ -352,7 +352,7 @@ async def get_newest_assembly_ac(self, ac: str) -> list[str]: query = f""" SELECT ac FROM {self.schema}._seq_anno_most_recent - WHERE ac LIKE '{ac.split('.')[0]}%' + WHERE ac LIKE '{ac.split(".")[0]}%' AND ((descr IS NULL) OR (descr = '')) {order_by_cond} """ # noqa: S608 @@ -499,7 +499,7 @@ async def get_tx_exon_aln_v_data( AND {start_pos} BETWEEN {pos_q} AND {end_pos} BETWEEN {pos_q} {order_by_cond} - """ + """ # noqa: S608 result = await self.execute_query(query) if not result: _logger.warning("Unable to find transcript alignment for query: %s", query) diff --git a/tests/handlers/test_seqrepo_access.py b/tests/handlers/test_seqrepo_access.py index c2b21f78..cbd80f09 100644 --- a/tests/handlers/test_seqrepo_access.py +++ b/tests/handlers/test_seqrepo_access.py @@ -89,7 +89,7 @@ def test_translate_identifier(test_seqrepo_access): resp = test_seqrepo_access.translate_identifier("refseq_152263.3") assert resp == ( [], - "SeqRepo unable to get translated identifiers for" " refseq_152263.3", + "SeqRepo unable to get translated identifiers for refseq_152263.3", )