Skip to content

Commit

Permalink
Merge branch 'main' into setuptools-scm
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson committed Jul 11, 2024
2 parents 45c7ab8 + 5df58e9 commit 05c3651
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.5.0
hooks:
- id: ruff-format
- id: ruff
Expand Down
25 changes: 20 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dynamic=["version"]

[project.optional-dependencies]
tests = ["pytest", "pytest-cov", "pytest-asyncio"]
dev = ["pre-commit", "pytest", "pytest-cov", "pytest-asyncio", "ruff==0.2.0"]
dev = ["pre-commit", "pytest", "pytest-cov", "pytest-asyncio", "ruff==0.5.0"]

[project.urls]
Homepage = "https://github.com/cancervariants/fusor"
Expand Down Expand Up @@ -84,16 +84,22 @@ select = [
"DTZ", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
"T10", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
"EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
"LOG", # https://docs.astral.sh/ruff/rules/#flake8-logging-log
"G", # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
"INP", # https://docs.astral.sh/ruff/rules/#flake8-no-pep420-inp
"PIE", # https://docs.astral.sh/ruff/rules/#flake8-pie-pie
"T20", # https://docs.astral.sh/ruff/rules/#flake8-print-t20
"PT", # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
"Q", # https://docs.astral.sh/ruff/rules/#flake8-quotes-q
"RSE", # https://docs.astral.sh/ruff/rules/#flake8-raise-rse
"RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret
"SLF", # https://docs.astral.sh/ruff/rules/#flake8-self-slf
"SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
"ARG", # https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-arg
"PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
"PGH", # https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
"PERF", # https://docs.astral.sh/ruff/rules/#perflint-perf
"FURB", # https://docs.astral.sh/ruff/rules/#refurb-furb
"RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
]
fixable = [
Expand All @@ -104,15 +110,19 @@ fixable = [
"ANN",
"B",
"C4",
"LOG",
"G",
"PIE",
"PT",
"RSE",
"SIM",
"RUF"
"PERF",
"FURB",
"RUF",
]
# ANN101 - missing-type-self
# ANN003 - missing-type-kwargs
# ANN101 - missing-type-self
# ANN102 - missing-type-cls
# D203 - one-blank-line-before-class
# D205 - blank-line-after-summary
# D206 - indent-with-spaces*
Expand All @@ -128,7 +138,7 @@ fixable = [
# S321 - suspicious-ftp-lib-usage
# *ignored for compatibility with formatter
ignore = [
"ANN101", "ANN003",
"ANN003", "ANN101", "ANN102",
"D203", "D205", "D206", "D213", "D300", "D400", "D415",
"E111", "E114", "E117", "E501",
"W191",
Expand All @@ -144,5 +154,10 @@ ignore = [
# S101 - assert
# B011 - assert-false
# N805 - invalid-first-argument-name-for-method
"tests/*" = ["ANN001", "ANN2", "ANN102", "S101", "B011"]
# INP001 - implicit-namespace-package
# SLF001 - private-member-access
"tests/*" = ["ANN001", "ANN2", "ANN102", "S101", "B011", "INP001", "SLF001"]
"src/fusor/models.py" = ["ANN201", "N805", "ANN001", "ANN2", "ANN102"]

[tool.ruff.format]
docstring-code-format = true
1 change: 1 addition & 0 deletions src/fusor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide computable object representation and validation for gene fusions"""

from importlib.metadata import PackageNotFoundError, version

from fusor.fusor import FUSOR
Expand Down
1 change: 1 addition & 0 deletions src/fusor/examples/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide programmatic access to example objects."""

import json
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions src/fusor/fusor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for modifying fusion objects."""

import logging
import re
from urllib.parse import quote
Expand Down
17 changes: 9 additions & 8 deletions src/fusor/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model for fusion class"""

from abc import ABC
from enum import Enum
from typing import Any, Literal
Expand Down Expand Up @@ -120,9 +121,9 @@ class BaseStructuralElement(ABC, BaseModel):
class TranscriptSegmentElement(BaseStructuralElement):
"""Define TranscriptSegment class"""

type: Literal[
type: Literal[FUSORTypes.TRANSCRIPT_SEGMENT_ELEMENT] = (
FUSORTypes.TRANSCRIPT_SEGMENT_ELEMENT
] = FUSORTypes.TRANSCRIPT_SEGMENT_ELEMENT
)
transcript: CURIE
exon_start: StrictInt | None = None
exon_start_offset: StrictInt | None = 0
Expand Down Expand Up @@ -212,9 +213,9 @@ def check_exons(cls, values):
class LinkerElement(BaseStructuralElement, extra="forbid"):
"""Define Linker class (linker sequence)"""

type: Literal[
type: Literal[FUSORTypes.LINKER_SEQUENCE_ELEMENT] = (
FUSORTypes.LINKER_SEQUENCE_ELEMENT
] = FUSORTypes.LINKER_SEQUENCE_ELEMENT
)
linker_sequence: SequenceDescriptor

@field_validator("linker_sequence", mode="before")
Expand Down Expand Up @@ -260,9 +261,9 @@ class TemplatedSequenceElement(BaseStructuralElement):
product.
"""

type: Literal[
type: Literal[FUSORTypes.TEMPLATED_SEQUENCE_ELEMENT] = (
FUSORTypes.TEMPLATED_SEQUENCE_ELEMENT
] = FUSORTypes.TEMPLATED_SEQUENCE_ELEMENT
)
region: LocationDescriptor
strand: Strand

Expand Down Expand Up @@ -340,9 +341,9 @@ class MultiplePossibleGenesElement(BaseStructuralElement):
MultiplePossibleGenesElement.
"""

type: Literal[
type: Literal[FUSORTypes.MULTIPLE_POSSIBLE_GENES_ELEMENT] = (
FUSORTypes.MULTIPLE_POSSIBLE_GENES_ELEMENT
] = FUSORTypes.MULTIPLE_POSSIBLE_GENES_ELEMENT
)

model_config = ConfigDict(
json_schema_extra={"example": {"type": "MultiplePossibleGenesElement"}},
Expand Down
1 change: 1 addition & 0 deletions src/fusor/nomenclature.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide helper methods for fusion nomenclature generation."""

from biocommons.seqrepo.seqrepo import SeqRepo
from ga4gh.vrsatile.pydantic.vrs_models import SequenceLocation

Expand Down
1 change: 1 addition & 0 deletions src/fusor/tools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide miscellaneous tools for fusion modeling."""

import logging

from biocommons.seqrepo.seqrepo import SeqRepo
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module containing methods and fixtures used throughout tests."""

import logging

import pytest
Expand Down
7 changes: 4 additions & 3 deletions tests/test_fusor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for testing the FUSOR class."""

import copy

import pytest
Expand Down Expand Up @@ -817,9 +818,9 @@ def test_templated_sequence_element(
assert tsg.model_dump() == templated_sequence_element.model_dump()

expected = copy.deepcopy(templated_sequence_element.model_dump())
expected["region"]["location"][
"sequence_id"
] = "ga4gh:SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO"
expected["region"]["location"]["sequence_id"] = (
"ga4gh:SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO"
)
expected["region"]["location_id"] = "ga4gh:VSL.bL1N-PQfp4dGlEz6PEd34fGxdxo82Zkb"
tsg = fusor_instance.templated_sequence_element(
100,
Expand Down
1 change: 1 addition & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for testing the fusion model."""

import copy

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_nomenclature.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test nomenclature generation."""

import pytest

from fusor.models import AssayedFusion, CategoricalFusion, TranscriptSegmentElement
Expand Down
1 change: 1 addition & 0 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test FUSOR tools."""

import pytest

from fusor.exceptions import IDTranslationException
Expand Down

0 comments on commit 05c3651

Please sign in to comment.