Skip to content

Commit ed018e3

Browse files
committed
feat: adjustments to comply with pre-commits
1 parent 28cd6bc commit ed018e3

File tree

8 files changed

+18
-17
lines changed

8 files changed

+18
-17
lines changed

poetry.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gentropy/common/version_engine.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ def amend_version(
101101

102102

103103
class DatasourceVersionSeeker(ABC):
104-
"""Interface for datasource version seeker."""
104+
"""Interface for datasource version seeker.
105+
106+
Raises:
107+
NotImplementedError: if method is not implemented in the subclass
108+
"""
105109

106110
@staticmethod
107111
@abstractmethod
@@ -115,7 +119,7 @@ def seek_version(text: str) -> str:
115119
str: seeked version
116120
117121
Raises:
118-
ValueError: if version can not be seeked
122+
NotImplementedError: if method is not implemented in the subclass
119123
120124
"""
121125
raise NotImplementedError

src/gentropy/dataset/colocalisation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ def extract_maximum_coloc_probability_per_region_and_gene(
5555
DataFrame: table with the maximum colocalisation scores for the provided study loci
5656
5757
Raises:
58-
ValueError: if filter_by_qtl is not in the list of valid QTL types
59-
ValueError: if filter_by_colocalisation_method is not in the list of valid colocalisation methods
58+
ValueError: if filter_by_qtl is not in the list of valid QTL types or is not in the list of valid colocalisation methods
6059
"""
6160
from gentropy.colocalisation import ColocalisationStep
6261

src/gentropy/dataset/dataset.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ def valid_rows(self: Self, invalid_flags: list[str], invalid: bool = False) -> S
211211
Self: filtered dataset.
212212
213213
Raises:
214-
ValueError: If the Dataset does not contain a QC column.
215-
ValueError: If the invalid_flags elements do not exist in QC mappings flags.
214+
ValueError: If the Dataset does not contain a QC column or if the invalid_flags elements do not exist in QC mappings flags.
216215
"""
217216
# If the invalid flags are not valid quality checks (enum) for this Dataset we raise an error:
218217
invalid_reasons = []

src/gentropy/datasource/ensembl/vep_parser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ def extract_variant_index_from_vep(
7171
VariantIndex: Variant index dataset.
7272
7373
Raises:
74-
ValueError: Failed reading file.
75-
ValueError: The dataset is empty.
74+
ValueError: Failed reading file or if the dataset is empty.
7675
"""
7776
# To speed things up and simplify the json structure, read data following an expected schema:
7877
vep_schema = cls.get_schema()

src/gentropy/l2g.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ def _generate_feature_matrix(self, write_feature_matrix: bool) -> L2GFeatureMatr
201201
L2GFeatureMatrix: Feature matrix with gold standards annotated with features.
202202
203203
Raises:
204-
ValueError: If write_feature_matrix is set to True but a path is not provided.
205-
ValueError: If dependencies to build features are not set.
204+
ValueError: If write_feature_matrix is set to True but a path is not provided or if dependencies to build features are not set.
206205
"""
207206
if self.gs_curation and self.interactions and self.v2g:
208207
study_locus_overlap = StudyLocus(

src/gentropy/method/l2g/model.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ def save(self: LocusToGeneModel, path: str) -> None:
135135
path (str): Path to save the persisted model. Should end with .skops
136136
137137
Raises:
138-
ValueError: If the model has not been fitted yet
139-
ValueError: If the path does not end with .skops
138+
ValueError: If the model has not been fitted yet or if the path does not end with .skops
140139
"""
141140
if self.model is None:
142141
raise ValueError("Model has not been fitted yet.")
@@ -215,7 +214,7 @@ def export_to_hugging_face_hub(
215214
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.
216215
217216
Raises:
218-
Exception: If the push to the Hugging Face Hub fails
217+
RuntimeError: If the push to the Hugging Face Hub fails
219218
"""
220219
from sklearn import __version__ as sklearn_version
221220

@@ -241,4 +240,4 @@ def export_to_hugging_face_hub(
241240
for p in Path(local_repo).glob("*"):
242241
p.unlink()
243242
Path(local_repo).rmdir()
244-
raise e
243+
raise RuntimeError from e

src/gentropy/method/susie_inf.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ class SUSIE_inf:
2323
2424
Note: code copied from fine-mapping-inf package as a placeholder
2525
https://github.com/FinucaneLab/fine-mapping-inf
26+
27+
Raises:
28+
RuntimeError: if missing LD or if unsupported variance estimation
2629
"""
2730

2831
@staticmethod
@@ -89,8 +92,7 @@ def susie_inf( # noqa: C901
8992
lbf -- length-p array of log-Bayes-factors for each CS
9093
9194
Raises:
92-
RuntimeError: if missing LD
93-
RuntimeError: if unsupported variance estimation method
95+
RuntimeError: if missing LD or if unsupported variance estimation method
9496
"""
9597
p = len(z)
9698
# Precompute V,D^2 in the SVD X=UDV', and V'X'y and y'y
@@ -428,6 +430,7 @@ def cred_inf(
428430
429431
Raises:
430432
RuntimeError: if missing inputs for purity filtering
433+
ValueError: if either LD or V, Dsq are None
431434
"""
432435
if (V is None or Dsq is None or n is None) and LD is None:
433436
raise RuntimeError("Missing inputs for purity filtering")

0 commit comments

Comments
 (0)