Skip to content

Commit 330a8c2

Browse files
committed
pre-commit format
1 parent a1cdaca commit 330a8c2

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ python3 chebai/result/prediction.py predict_from_file --checkpoint_path=[path-t
8484
* **`--save_to`** *(optional)*: Predictions will be saved to the path as CSV file. The CSV will contain one row per SMILES string and one column per predicted class. Default path will be the current working directory with file name as `predictions.csv`.
8585

8686
* **`--classes_path`** *(optional)*: Path to the dataset’s `classes.txt` file, which maps model output indices to ChEBI IDs.
87-
* Checkpoints created after PR #135 will have the classification labels stored in them and hence this parameter is not required.
87+
* Checkpoints created after PR #135 will have the classification labels stored in them and hence this parameter is not required.
8888
* If provided, the CSV columns will be named using the ChEBI IDs.
8989
* If omitted, then script will located the file automatically. If unable to locate then the columns will be numbered sequentially.
9090

chebai/preprocessing/datasets/base.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ def __init__(
9696
self.prediction_kind = prediction_kind
9797
self.data_limit = data_limit
9898
self.label_filter = label_filter
99-
assert (balance_after_filter is not None) or (self.label_filter is None), (
100-
"Filter balancing requires a filter"
101-
)
99+
assert (balance_after_filter is not None) or (
100+
self.label_filter is None
101+
), "Filter balancing requires a filter"
102102
self.balance_after_filter = balance_after_filter
103103
self.num_workers = num_workers
104104
self.persistent_workers: bool = bool(persistent_workers)
@@ -108,13 +108,13 @@ def __init__(
108108
self.use_inner_cross_validation = (
109109
inner_k_folds > 1
110110
) # only use cv if there are at least 2 folds
111-
assert fold_index is None or self.use_inner_cross_validation is not None, (
112-
"fold_index can only be set if cross validation is used"
113-
)
111+
assert (
112+
fold_index is None or self.use_inner_cross_validation is not None
113+
), "fold_index can only be set if cross validation is used"
114114
if fold_index is not None and self.inner_k_folds is not None:
115-
assert fold_index < self.inner_k_folds, (
116-
"fold_index can't be larger than the total number of folds"
117-
)
115+
assert (
116+
fold_index < self.inner_k_folds
117+
), "fold_index can't be larger than the total number of folds"
118118
self.fold_index = fold_index
119119
self._base_dir = base_dir
120120
self.n_token_limit = n_token_limit
@@ -137,9 +137,9 @@ def num_of_labels(self):
137137

138138
@property
139139
def feature_vector_size(self):
140-
assert self._feature_vector_size is not None, (
141-
"size of feature vector must be set"
142-
)
140+
assert (
141+
self._feature_vector_size is not None
142+
), "size of feature vector must be set"
143143
return self._feature_vector_size
144144

145145
@property

chebai/result/prediction.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def __init__(
6767
)
6868
if self._classification_labels is not None:
6969
print(f"Loaded {len(self._classification_labels)} classification labels.")
70-
assert len(self._classification_labels) > 0, (
71-
"Classification labels list is empty."
72-
)
70+
assert (
71+
len(self._classification_labels) > 0
72+
), "Classification labels list is empty."
7373
assert len(self._classification_labels) == self._model.out_dim, (
7474
f"Number of class labels ({len(self._classification_labels)}) does not match "
7575
f"the model output dimension ({self._model.out_dim})."

0 commit comments

Comments
 (0)