Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ruff checks #393

Merged
merged 3 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,17 @@ disable = [
max-attributes = 12
max-branches = 15

[tool.ruff]
line-length = 110
show-fixes = true

[tool.ruff.format]
docstring-code-format = true

[tool.ruff.lint.per-file-ignores]
# Ignore `F403` (unable to detect undefined names) in all `__init__.py` files
"__init__.py" = ["F403"]

[tool.mypy]
mypy_path = "src/python"
explicit_package_bases = true
Expand Down
1 change: 0 additions & 1 deletion src/python/ensembl/brc4/runnable/seqregion_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from pathlib import Path
import re
import gzip
import csv
from typing import Any, Dict, Tuple

Expand Down
2 changes: 1 addition & 1 deletion src/python/ensembl/io/genomio/assembly/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def _download_file(
"""
has_md5 = True
expected_sum = ""
if not ftp_file in md5_sums:
if ftp_file not in md5_sums:
logging.warning(f" File not in the md5 checksums: {ftp_file}")
has_md5 = False
else:
Expand Down
8 changes: 4 additions & 4 deletions src/python/ensembl/io/genomio/genome_metadata/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def add_provider(genome_metadata: Dict, ncbi_data: Dict) -> None:

# Add assembly provider (if missing)
assembly = genome_metadata["assembly"]
if (not "provider_name" in assembly) and (not "provider_url" in assembly):
if ("provider_name" not in assembly) and ("provider_url" not in assembly):
assembly["provider_name"] = provider["assembly"]["provider_name"]
assembly["provider_url"] = f'{provider["assembly"]["provider_url"]}/{accession}'

Expand All @@ -111,7 +111,7 @@ def add_assembly_version(genome_data: Dict) -> None:
genome_data: Genome information of assembly, accession and annotation.
"""
assembly = genome_data["assembly"]
if not "version" in assembly:
if "version" not in assembly:
accession = assembly["accession"]
version = accession.partition(".")[2]
if version:
Expand All @@ -128,9 +128,9 @@ def add_genebuild_metadata(genome_data: Dict) -> None:
"""
genebuild = genome_data.setdefault("genebuild", {})
current_date = datetime.date.today().isoformat()
if not "version" in genebuild:
if "version" not in genebuild:
genebuild["version"] = current_date
if not "start_date" in genebuild:
if "start_date" not in genebuild:
genebuild["start_date"] = current_date


Expand Down
2 changes: 1 addition & 1 deletion src/python/ensembl/io/genomio/genome_stats/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def get_feature_stats(self, table: Any) -> Dict[str, int]:
totals_st = select(func.count(table.stable_id))
(total,) = session.execute(totals_st).one()
# pylint: disable-next=singleton-comparison
no_desc_st = select(func.count(table.stable_id)).filter(table.description == None)
no_desc_st = select(func.count(table.stable_id)).filter(table.description.is_(None))
(no_desc,) = session.execute(no_desc_st).one()
xref_desc_st = select(func.count(table.stable_id)).where(table.description.like("%[Source:%"))
(xref_desc,) = session.execute(xref_desc_st).one()
Expand Down