Skip to content

Commit

Permalink
build: updated precommits including adjustments to docstrings (openta…
Browse files Browse the repository at this point in the history
  • Loading branch information
d0choa authored Sep 24, 2024
1 parent d2a68d9 commit 95be9f6
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 21 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ci:
skip: [poetry-lock]
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
rev: v0.6.7
hooks:
- id: ruff
args:
Expand Down Expand Up @@ -58,14 +58,14 @@ repos:
exclude: "CHANGELOG.md"

- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.16.0
rev: v9.18.0
hooks:
- id: commitlint
additional_dependencies: ["@commitlint/[email protected]"]
stages: [commit-msg]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.11.1"
rev: "v1.11.2"
hooks:
- id: mypy
args:
Expand Down Expand Up @@ -98,7 +98,7 @@ repos:
- id: beautysh

- repo: https://github.com/jsh9/pydoclint
rev: 0.5.6
rev: 0.5.8
hooks:
- id: pydoclint

Expand Down
1 change: 0 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/gentropy/common/version_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ def amend_version(


class DatasourceVersionSeeker(ABC):
"""Interface for datasource version seeker."""
"""Interface for datasource version seeker.
Raises:
NotImplementedError: if method is not implemented in the subclass
"""

@staticmethod
@abstractmethod
Expand All @@ -115,7 +119,7 @@ def seek_version(text: str) -> str:
str: seeked version
Raises:
ValueError: if version can not be seeked
NotImplementedError: if method is not implemented in the subclass
"""
raise NotImplementedError
Expand Down
3 changes: 1 addition & 2 deletions src/gentropy/dataset/colocalisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ def extract_maximum_coloc_probability_per_region_and_gene(
DataFrame: table with the maximum colocalisation scores for the provided study loci
Raises:
ValueError: if filter_by_qtl is not in the list of valid QTL types
ValueError: if filter_by_colocalisation_method is not in the list of valid colocalisation methods
ValueError: if filter_by_qtl is not in the list of valid QTL types or is not in the list of valid colocalisation methods
"""
from gentropy.colocalisation import ColocalisationStep

Expand Down
3 changes: 1 addition & 2 deletions src/gentropy/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ def valid_rows(self: Self, invalid_flags: list[str], invalid: bool = False) -> S
Self: filtered dataset.
Raises:
ValueError: If the Dataset does not contain a QC column.
ValueError: If the invalid_flags elements do not exist in QC mappings flags.
ValueError: If the Dataset does not contain a QC column or if the invalid_flags elements do not exist in QC mappings flags.
"""
# If the invalid flags are not valid quality checks (enum) for this Dataset we raise an error:
invalid_reasons = []
Expand Down
3 changes: 1 addition & 2 deletions src/gentropy/datasource/ensembl/vep_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ def extract_variant_index_from_vep(
VariantIndex: Variant index dataset.
Raises:
ValueError: Failed reading file.
ValueError: The dataset is empty.
ValueError: Failed reading file or if the dataset is empty.
"""
# To speed things up and simplify the json structure, read data following an expected schema:
vep_schema = cls.get_schema()
Expand Down
3 changes: 1 addition & 2 deletions src/gentropy/l2g.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ def _generate_feature_matrix(self, write_feature_matrix: bool) -> L2GFeatureMatr
L2GFeatureMatrix: Feature matrix with gold standards annotated with features.
Raises:
ValueError: If write_feature_matrix is set to True but a path is not provided.
ValueError: If dependencies to build features are not set.
ValueError: If write_feature_matrix is set to True but a path is not provided or if dependencies to build features are not set.
"""
if self.gs_curation and self.interactions and self.v2g:
study_locus_overlap = StudyLocus(
Expand Down
7 changes: 3 additions & 4 deletions src/gentropy/method/l2g/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ def save(self: LocusToGeneModel, path: str) -> None:
path (str): Path to save the persisted model. Should end with .skops

Raises:
ValueError: If the model has not been fitted yet
ValueError: If the path does not end with .skops
ValueError: If the model has not been fitted yet or if the path does not end with .skops
"""
if self.model is None:
raise ValueError("Model has not been fitted yet.")
Expand Down Expand Up @@ -215,7 +214,7 @@ def export_to_hugging_face_hub(
local_repo (str): Path to the folder where the contents of the model repo + the documentation are located. This is used to push the model to the Hugging Face Hub.

Raises:
Exception: If the push to the Hugging Face Hub fails
RuntimeError: If the push to the Hugging Face Hub fails
"""
from sklearn import __version__ as sklearn_version

Expand All @@ -241,4 +240,4 @@ def export_to_hugging_face_hub(
for p in Path(local_repo).glob("*"):
p.unlink()
Path(local_repo).rmdir()
raise e
raise RuntimeError from e
7 changes: 5 additions & 2 deletions src/gentropy/method/susie_inf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class SUSIE_inf:

Note: code copied from fine-mapping-inf package as a placeholder
https://github.com/FinucaneLab/fine-mapping-inf

Raises:
RuntimeError: if missing LD or if unsupported variance estimation
"""

@staticmethod
Expand Down Expand Up @@ -89,8 +92,7 @@ def susie_inf( # noqa: C901
lbf -- length-p array of log-Bayes-factors for each CS

Raises:
RuntimeError: if missing LD
RuntimeError: if unsupported variance estimation method
RuntimeError: if missing LD or if unsupported variance estimation method
"""
p = len(z)
# Precompute V,D^2 in the SVD X=UDV', and V'X'y and y'y
Expand Down Expand Up @@ -428,6 +430,7 @@ def cred_inf(

Raises:
RuntimeError: if missing inputs for purity filtering
ValueError: if either LD or V, Dsq are None
"""
if (V is None or Dsq is None or n is None) and LD is None:
raise RuntimeError("Missing inputs for purity filtering")
Expand Down

0 comments on commit 95be9f6

Please sign in to comment.