Skip to content

Commit efa7e02

Browse files
committed
more ruff rules
1 parent 6127198 commit efa7e02

5 files changed

Lines changed: 14 additions & 6 deletions

File tree

ensembl_genes/ensembl_genes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Ensembl_Gene_Queries:
2323
Regex to separate source information from the gene description text.
2424
https://regex101.com/r/wbW1Qc/1
2525
"""
26-
_column_dtypes: dict[str, str] = {
26+
_column_dtypes: ClassVar[dict[str, str]] = {
2727
"alt_allele_is_representative": "bool",
2828
"primary_assembly": "bool",
2929
}
@@ -464,7 +464,7 @@ class DatasetExport:
464464

465465

466466
class Ensembl_Gene_Catalog_Writer(Ensembl_Gene_Queries):
467-
exports: list[DatasetExport] = [
467+
exports: ClassVar[list[DatasetExport]] = [
468468
DatasetExport(
469469
name="genes",
470470
query_fxn="gene_df",
@@ -528,7 +528,7 @@ class Ensembl_Gene_Catalog_Writer(Ensembl_Gene_Queries):
528528
),
529529
),
530530
]
531-
ipynb_exports = [
531+
ipynb_exports: ClassVar[list[str]] = [
532532
"ensembl_genes_output.ipynb",
533533
"ensembl_genes_eda.ipynb",
534534
"ensembl_database_tables.ipynb",

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ select = [
6060
"C90", # mccabe
6161
"E", # pycodestyle errors
6262
"F", # pyflakes
63+
"FURB", # refurbish and modernize
6364
"I", # isort
65+
"PT", # flake8-pytest-style
66+
"RUF", # ruff
67+
"SIM", # simplify
6468
"UP", # pyupgrade
6569
"W", # pycode warnings
6670
]

tests/ensembl_gene_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def test_ensembl_gene_queries() -> None:
88

99

1010
@pytest.mark.parametrize(
11-
"raw_description,expect_description,expect_src,expect_id",
11+
("raw_description", "expect_description", "expect_src", "expect_id"),
1212
[
1313
(
1414
"G protein subunit gamma 5 pseudogene 3 [Source:HGNC Symbol;Acc:HGNC:33552]",

tests/releases_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import re
2+
13
import pytest
24

35
from ensembl_genes.releases import check_ensembl_release, get_latest_ensembl_release
@@ -13,6 +15,8 @@ def test_check_ensembl_release() -> None:
1315
assert int(check_ensembl_release("latest")) >= 104
1416
with pytest.raises(
1517
ValueError,
16-
match="release should be convertible to an int, like '104'. Received 'v104'",
18+
match=re.escape(
19+
"release should be convertible to an int, like '104'. Received 'v104'"
20+
),
1721
):
1822
check_ensembl_release("v104")

tests/species_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_get_species() -> None:
1313

1414

1515
@pytest.mark.parametrize(
16-
"gene, category",
16+
("gene", "category"),
1717
[
1818
# from ENSG00000112493
1919
(Gene("6", 33_221_298, 33_235_989), "MHC"),

0 commit comments

Comments
 (0)