Skip to content

Commit d899ea4

Browse files
authored
style: update ruff and precommit (#409)
1 parent f96919e commit d899ea4

File tree

7 files changed

+14
-16
lines changed

7 files changed

+14
-16
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ repos:
1212
- id: mixed-line-ending
1313
args: [ --fix=lf ]
1414
- repo: https://github.com/astral-sh/ruff-pre-commit
15-
rev: v0.8.6
15+
rev: v0.12.1
1616
hooks:
1717
- id: ruff-format
1818
- id: ruff
1919
args: [ --fix, --exit-non-zero-on-fix ]
20-
minimum_pre_commit_version: 4.0.1
20+
minimum_pre_commit_version: 4.2.0

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ dynamic = ["version"]
4040

4141
[project.optional-dependencies]
4242
dev = [
43-
"pre-commit>=4.0.1",
43+
"pre-commit>=4.2.0",
4444
"ipython",
4545
"ipykernel",
4646
"psycopg2-binary",
47-
"ruff==0.8.6"
47+
"ruff==0.12.1",
4848
]
4949
tests = ["pytest", "pytest-cov", "pytest-asyncio==0.18.3", "mock"]
5050
docs = [

src/cool_seq_tool/handlers/seqrepo_access.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ def get_reference_sequence(
7575
f"Start inter-residue coordinate ({start}) is out of index on {ac}"
7676
)
7777
elif error.startswith("stop out of range"):
78-
msg = (
79-
f"End inter-residue coordinate ({end}) is out of " f"index on {ac}"
80-
)
78+
msg = f"End inter-residue coordinate ({end}) is out of index on {ac}"
8179
else:
8280
msg = f"{e}"
8381
_logger.warning(msg)

src/cool_seq_tool/mappers/exon_genomic_coords.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ async def _genomic_to_tx_segment(
776776
GRCh38 by default. Will attempt to liftover if starting assembly is GRCh37
777777
:return: Data for a transcript segment boundary (inter-residue coordinates)
778778
"""
779-
params = {key: None for key in GenomicTxSeg.model_fields}
779+
params = dict.fromkeys(GenomicTxSeg.model_fields)
780780

781781
# Validate inputs exist in UTA
782782
if gene:

src/cool_seq_tool/mappers/mane_transcript.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ async def _liftover_to_38(self, genomic_tx_data: GenomicTxMetadata) -> None:
268268
query = f"""
269269
SELECT alt_ac
270270
FROM {self.uta_db.schema}.genomic
271-
WHERE alt_ac LIKE '{genomic_tx_data.alt_ac.split('.')[0]}%'
271+
WHERE alt_ac LIKE '{genomic_tx_data.alt_ac.split(".")[0]}%'
272272
{order_by_cond}
273273
""" # noqa: S608
274274
nc_acs = await self.uta_db.execute_query(query)

src/cool_seq_tool/sources/uta_database.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ async def _create_genomic_table(self) -> None:
221221
WHERE table_schema = '{self.schema}'
222222
AND table_name = 'genomic'
223223
);
224-
"""
224+
""" # noqa: S608
225225
genomic_table_exists = await self.execute_query(check_table_exists)
226226
genomic_table_exists = genomic_table_exists[0].get("exists")
227227
if genomic_table_exists is None:
@@ -250,7 +250,7 @@ async def _create_genomic_table(self) -> None:
250250
LEFT JOIN {self.schema}.exon_aln ea ON
251251
(((te.exon_id = ea.tx_exon_id) AND
252252
(ae.exon_id = ea.alt_exon_id))));
253-
"""
253+
""" # noqa: S608
254254
await self.execute_query(create_genomic_table)
255255

256256
indexes = [
@@ -325,13 +325,13 @@ async def get_cds_start_end(self, tx_ac: str) -> tuple[int, int] | None:
325325
cds_start_end = await self.execute_query(query)
326326
if cds_start_end:
327327
cds_start_end = cds_start_end[0]
328-
if cds_start_end[0] is not None and cds_start_end[1] is not None: # noqa: RET503
328+
if cds_start_end[0] is not None and cds_start_end[1] is not None:
329329
return cds_start_end[0], cds_start_end[1]
330330
else:
331331
_logger.warning(
332332
"Unable to get coding start/end site for accession: %s", tx_ac
333333
)
334-
return None
334+
return None
335335

336336
async def get_newest_assembly_ac(self, ac: str) -> list[str]:
337337
"""Find accession associated to latest genomic assembly
@@ -352,7 +352,7 @@ async def get_newest_assembly_ac(self, ac: str) -> list[str]:
352352
query = f"""
353353
SELECT ac
354354
FROM {self.schema}._seq_anno_most_recent
355-
WHERE ac LIKE '{ac.split('.')[0]}%'
355+
WHERE ac LIKE '{ac.split(".")[0]}%'
356356
AND ((descr IS NULL) OR (descr = ''))
357357
{order_by_cond}
358358
""" # noqa: S608
@@ -499,7 +499,7 @@ async def get_tx_exon_aln_v_data(
499499
AND {start_pos} BETWEEN {pos_q}
500500
AND {end_pos} BETWEEN {pos_q}
501501
{order_by_cond}
502-
"""
502+
""" # noqa: S608
503503
result = await self.execute_query(query)
504504
if not result:
505505
_logger.warning("Unable to find transcript alignment for query: %s", query)

tests/handlers/test_seqrepo_access.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def test_translate_identifier(test_seqrepo_access):
8989
resp = test_seqrepo_access.translate_identifier("refseq_152263.3")
9090
assert resp == (
9191
[],
92-
"SeqRepo unable to get translated identifiers for" " refseq_152263.3",
92+
"SeqRepo unable to get translated identifiers for refseq_152263.3",
9393
)
9494

9595

0 commit comments

Comments
 (0)